diff --git a/composer.json b/composer.json index a0a2b51..4dfdb70 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,8 @@ "php": "^8.0" }, "require-dev": { + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-strict-rules": "^1.5", "friendsofphp/php-cs-fixer": "^3.0" }, "autoload": { diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 0000000..c063526 --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,14 @@ +# +# Configuration for PHPStan. +# @see https://phpstan.org/config-reference +# + +includes: + - vendor/phpstan/phpstan-strict-rules/rules.neon + +parameters: + level: 2 + strictRules: + noVariableVariables: false + paths: + - src diff --git a/src/DataStructures/StrictList.php b/src/DataStructures/StrictList.php index e1f1090..d717046 100644 --- a/src/DataStructures/StrictList.php +++ b/src/DataStructures/StrictList.php @@ -31,11 +31,6 @@ use OCC\Basics\Traits\Getter; * * @author Sebastian Meyer * @package opencultureconsulting/basics - * - * @implements \ArrayAccess - * @implements \Countable - * @implements \Iterator - * @implements \Serializable */ class StrictList extends SplDoublyLinkedList { diff --git a/src/DataStructures/StrictQueue.php b/src/DataStructures/StrictQueue.php index e07b431..cfaf2ca 100644 --- a/src/DataStructures/StrictQueue.php +++ b/src/DataStructures/StrictQueue.php @@ -29,11 +29,6 @@ use RuntimeException; * * @author Sebastian Meyer * @package opencultureconsulting/basics - * - * @implements \ArrayAccess - * @implements \Countable - * @implements \Iterator - * @implements \Serializable */ class StrictQueue extends StrictList { diff --git a/src/DataStructures/StrictStack.php b/src/DataStructures/StrictStack.php index c46130f..bbb79d8 100644 --- a/src/DataStructures/StrictStack.php +++ b/src/DataStructures/StrictStack.php @@ -29,11 +29,6 @@ use RuntimeException; * * @author Sebastian Meyer * @package opencultureconsulting/basics - * - * @implements \ArrayAccess - * @implements \Countable - * @implements \Iterator - * @implements \Serializable */ class StrictStack extends StrictList { diff --git a/src/Functions/throwErrorException.php b/src/Functions/throwErrorException.php index 03b2593..e1321d2 100644 --- a/src/Functions/throwErrorException.php +++ b/src/Functions/throwErrorException.php @@ -43,7 +43,7 @@ use ErrorException; */ function throwErrorException(int $severity = E_USER_ERROR, string $message = '', ?string $file = null, ?int $line = null): bool { - if (error_reporting() & $severity) { + if ((error_reporting() & $severity) > 0) { throw new ErrorException($message, 0, $severity, $file, $line); } return false; diff --git a/src/InterfaceTraits/ArrayAccess.php b/src/InterfaceTraits/ArrayAccess.php index e1b8ed7..9d2a13a 100644 --- a/src/InterfaceTraits/ArrayAccess.php +++ b/src/InterfaceTraits/ArrayAccess.php @@ -27,8 +27,6 @@ namespace OCC\Basics\InterfaceTraits; * * @author Sebastian Meyer * @package opencultureconsulting/basics - * - * @implements \ArrayAccess */ trait ArrayAccess /* implements \ArrayAccess */ { diff --git a/src/InterfaceTraits/Countable.php b/src/InterfaceTraits/Countable.php index 90978f1..84dd143 100644 --- a/src/InterfaceTraits/Countable.php +++ b/src/InterfaceTraits/Countable.php @@ -27,8 +27,6 @@ namespace OCC\Basics\InterfaceTraits; * * @author Sebastian Meyer * @package opencultureconsulting/basics - * - * @implements \Countable */ trait Countable /* implements \Countable */ { diff --git a/src/InterfaceTraits/Iterator.php b/src/InterfaceTraits/Iterator.php index 198e25b..9faf5b9 100644 --- a/src/InterfaceTraits/Iterator.php +++ b/src/InterfaceTraits/Iterator.php @@ -27,8 +27,6 @@ namespace OCC\Basics\InterfaceTraits; * * @author Sebastian Meyer * @package opencultureconsulting/basics - * - * @implements \Iterator */ trait Iterator /* implements \Iterator */ { diff --git a/src/InterfaceTraits/IteratorAggregate.php b/src/InterfaceTraits/IteratorAggregate.php index fddb307..256c0bd 100644 --- a/src/InterfaceTraits/IteratorAggregate.php +++ b/src/InterfaceTraits/IteratorAggregate.php @@ -29,8 +29,6 @@ use ArrayIterator; * * @author Sebastian Meyer * @package opencultureconsulting/basics - * - * @implements \IteratorAggregate */ trait IteratorAggregate /* implements \IteratorAggregate */ {