Test phpstan

This commit is contained in:
Dennis Eichhorn 2018-03-13 20:43:22 +01:00
parent 7064cd6e7e
commit 301aa59d61
6 changed files with 48 additions and 25 deletions

View File

@ -306,19 +306,19 @@ class Account implements ArrayableInterface, \JsonSerializable
* *
* Checks if the account has a permission defined * Checks if the account has a permission defined
* *
* @param int $permission Permission to check * @param int $permission Permission to check
* @param int $unit Unit Unit to check (null if all are acceptable) * @param int|null $unit Unit Unit to check (null if all are acceptable)
* @param string $app App App to check (null if all are acceptable) * @param string|null $app App App to check (null if all are acceptable)
* @param string $module Module Module to check (null if all are acceptable) * @param string|null $module Module Module to check (null if all are acceptable)
* @param int $type Type (e.g. customer) (null if all are acceptable) * @param int|null $type Type (e.g. customer) (null if all are acceptable)
* @param int $element (e.g. customer id) (null if all are acceptable) * @param int|null $element (e.g. customer id) (null if all are acceptable)
* @param int $component (e.g. address) (null if all are acceptable) * @param int|null $component (e.g. address) (null if all are acceptable)
* *
* @return bool Returns true if the account has the permission, false otherwise * @return bool Returns true if the account has the permission, false otherwise
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function hasPermission(int $permission, int $unit = null, string $app = null, string $module = null, int $type = null, $element = null, $component = null) : bool public function hasPermission(int $permission, ?int $unit = null, ?string $app = null, ?string $module = null, ?int $type = null, ?int $element = null, ?int $component = null) : bool
{ {
$app = $app !== null ? strtolower($app) : $app; $app = $app !== null ? strtolower($app) : $app;

View File

@ -15,6 +15,7 @@ declare(strict_types=1);
namespace phpOMS\Account; namespace phpOMS\Account;
use phpOMS\Contract\ArrayableInterface; use phpOMS\Contract\ArrayableInterface;
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
/** /**
* Account group class. * Account group class.
@ -54,7 +55,7 @@ class Group implements ArrayableInterface, \JsonSerializable
/** /**
* Account name. * Account name.
* *
* @var int * @var array
* @since 1.0.0 * @since 1.0.0
*/ */
protected $members = []; protected $members = [];

View File

@ -38,7 +38,7 @@ class PermissionAbstract
/** /**
* Unit id. * Unit id.
* *
* @var int * @var int|null
* @since 1.0.0 * @since 1.0.0
*/ */
protected $unit = null; protected $unit = null;
@ -46,7 +46,7 @@ class PermissionAbstract
/** /**
* App name. * App name.
* *
* @var string * @var string|null
* @since 1.0.0 * @since 1.0.0
*/ */
protected $app = null; protected $app = null;
@ -54,7 +54,7 @@ class PermissionAbstract
/** /**
* Module id. * Module id.
* *
* @var int * @var int|null
* @since 1.0.0 * @since 1.0.0
*/ */
protected $module = null; protected $module = null;
@ -62,7 +62,7 @@ class PermissionAbstract
/** /**
* Providing module id. * Providing module id.
* *
* @var int * @var int|null
* @since 1.0.0 * @since 1.0.0
*/ */
protected $from = 0; protected $from = 0;
@ -70,7 +70,7 @@ class PermissionAbstract
/** /**
* Type. * Type.
* *
* @var int * @var int|null
* @since 1.0.0 * @since 1.0.0
*/ */
protected $type = null; protected $type = null;
@ -78,7 +78,7 @@ class PermissionAbstract
/** /**
* Element id. * Element id.
* *
* @var int * @var int|null
* @since 1.0.0 * @since 1.0.0
*/ */
protected $element = null; protected $element = null;
@ -86,7 +86,7 @@ class PermissionAbstract
/** /**
* Component id. * Component id.
* *
* @var int * @var int|null
* @since 1.0.0 * @since 1.0.0
*/ */
protected $component = null; protected $component = null;
@ -114,7 +114,7 @@ class PermissionAbstract
/** /**
* Get unit id. * Get unit id.
* *
* @return int * @return int|null
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -126,7 +126,7 @@ class PermissionAbstract
/** /**
* Set unit id. * Set unit id.
* *
* @param int $unit Unit * @param int|null $unit Unit
* *
* @return void * @return void
* *
@ -140,7 +140,7 @@ class PermissionAbstract
/** /**
* Get app name. * Get app name.
* *
* @return string * @return string|null
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -166,7 +166,7 @@ class PermissionAbstract
/** /**
* Get module id. * Get module id.
* *
* @return int * @return int|null
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -192,7 +192,7 @@ class PermissionAbstract
/** /**
* Get providing module id. * Get providing module id.
* *
* @return int * @return int|null
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -218,7 +218,7 @@ class PermissionAbstract
/** /**
* Get type. * Get type.
* *
* @return int * @return int|null
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -244,7 +244,7 @@ class PermissionAbstract
/** /**
* Get element id. * Get element id.
* *
* @return int * @return int|null
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -270,7 +270,7 @@ class PermissionAbstract
/** /**
* Get component id. * Get component id.
* *
* @return int * @return int|null
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -40,7 +40,6 @@ class MemCached extends ConnectionAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
private $threshold = 10; private $threshold = 10;
private $status;
/** /**
* Constructor. * Constructor.
@ -52,6 +51,14 @@ class MemCached extends ConnectionAbstract
$this->memc = null; $this->memc = null;
} }
/**
* {@inheritdoc}
*/
public function connect(array $data) /* : void */
{
$this->status = CacheStatus::ACTIVE;
}
/** /**
* Adding server to server pool. * Adding server to server pool.
* *

View File

@ -27,6 +27,14 @@ namespace phpOMS\DataStorage\Cache\Connection;
class RedisCache extends ConnectionAbstract class RedisCache extends ConnectionAbstract
{ {
/**
* {@inheritdoc}
*/
public function connect(array $data) /* : void */
{
$this->status = CacheStatus::ACTIVE;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -26,6 +26,13 @@ namespace phpOMS\DataStorage\Cache\Connection;
*/ */
class WinCache extends ConnectionAbstract class WinCache extends ConnectionAbstract
{ {
/**
* {@inheritdoc}
*/
public function connect(array $data) /* : void */
{
$this->status = CacheStatus::ACTIVE;
}
/** /**
* {@inheritdoc} * {@inheritdoc}