diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 47bef2f..4c3423b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,8 +14,6 @@ jobs: strategy: matrix: php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" @@ -27,10 +25,6 @@ jobs: - composer phpcs - composer phpstan exclude: - - php-version: "7.2" - run: composer lint - - php-version: "7.3" - run: composer lint - php-version: "7.4" run: composer lint - php-version: "8.0" @@ -40,10 +34,6 @@ jobs: - php-version: "8.2" run: composer lint include: - - php-version: "7.2" - run: composer lint-7.x - - php-version: "7.3" - run: composer lint-7.x - php-version: "7.4" run: composer lint-7.x - php-version: "8.0" @@ -115,8 +105,6 @@ jobs: strategy: matrix: php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" diff --git a/composer.json b/composer.json index a31dcaf..ad637f8 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,8 @@ } }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12.6" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "require-dev": { "nette/neon": "^3.2", @@ -30,7 +30,7 @@ "phpunit/phpunit": "^8.5 || ^10.1 || ^11.0", "php-parallel-lint/php-parallel-lint": "^1.2", "php-parallel-lint/php-console-highlighter": "^1.0", - "phpstan/phpstan-deprecation-rules": "^1.2", + "phpstan/phpstan-deprecation-rules": "^2.0", "spaze/coding-standard": "^1.7" }, "autoload": { diff --git a/src/Allowed/Allowed.php b/src/Allowed/Allowed.php index dad0840..44ead1b 100644 --- a/src/Allowed/Allowed.php +++ b/src/Allowed/Allowed.php @@ -34,17 +34,13 @@ class Allowed { - /** @var Formatter */ - private $formatter; + private Formatter $formatter; - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; - /** @var AllowedPath */ - private $allowedPath; + private AllowedPath $allowedPath; - /** @var TypeStringResolver */ - private $typeStringResolver; + private TypeStringResolver $typeStringResolver; public function __construct( @@ -62,7 +58,7 @@ public function __construct( /** * @param Scope $scope - * @param array|null $args + * @param array|null $args * @param DisallowedWithParams $disallowed * @return bool */ @@ -116,7 +112,7 @@ private function callMatches(Scope $scope, string $call): bool /** * @param Scope $scope - * @param array|null $args + * @param array|null $args * @param array $allowConfig * @param bool $paramsRequired * @return bool @@ -152,7 +148,7 @@ private function hasAllowedParams(Scope $scope, ?array $args, array $allowConfig /** * @param Scope $scope - * @param array|null $args + * @param array|null $args * @param DisallowedWithParams $disallowed * @return bool */ @@ -169,7 +165,7 @@ private function hasAllowedParamsInAllowed(Scope $scope, ?array $args, Disallowe /** - * @param array $args + * @param array $args * @param Scope $scope * @param Param $param * @return Type|null diff --git a/src/Allowed/AllowedConfig.php b/src/Allowed/AllowedConfig.php index 0d40e47..fdfb965 100644 --- a/src/Allowed/AllowedConfig.php +++ b/src/Allowed/AllowedConfig.php @@ -9,28 +9,28 @@ class AllowedConfig { /** @var list */ - private $allowIn; + private array $allowIn; /** @var list */ - private $allowExceptIn; + private array $allowExceptIn; /** @var list */ - private $allowInCalls; + private array $allowInCalls; /** @var list */ - private $allowExceptInCalls; + private array $allowExceptInCalls; /** @var array */ - private $allowParamsInAllowed; + private array $allowParamsInAllowed; /** @var array */ - private $allowParamsAnywhere; + private array $allowParamsAnywhere; /** @var array */ - private $allowExceptParamsInAllowed; + private array $allowExceptParamsInAllowed; /** @var array */ - private $allowExceptParams; + private array $allowExceptParams; /** diff --git a/src/Allowed/AllowedPath.php b/src/Allowed/AllowedPath.php index 3207804..66d6086 100644 --- a/src/Allowed/AllowedPath.php +++ b/src/Allowed/AllowedPath.php @@ -10,8 +10,7 @@ class AllowedPath { - /** @var FilePath */ - private $filePath; + private FilePath $filePath; public function __construct(FilePath $filePath) diff --git a/src/Calls/EchoCalls.php b/src/Calls/EchoCalls.php index 92d70ab..7bad5b6 100644 --- a/src/Calls/EchoCalls.php +++ b/src/Calls/EchoCalls.php @@ -22,11 +22,10 @@ class EchoCalls implements Rule { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/EmptyCalls.php b/src/Calls/EmptyCalls.php index 53c9d12..7682e19 100644 --- a/src/Calls/EmptyCalls.php +++ b/src/Calls/EmptyCalls.php @@ -22,11 +22,10 @@ class EmptyCalls implements Rule { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/EvalCalls.php b/src/Calls/EvalCalls.php index 3841e8e..8cc9301 100644 --- a/src/Calls/EvalCalls.php +++ b/src/Calls/EvalCalls.php @@ -22,11 +22,10 @@ class EvalCalls implements Rule { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/ExitDieCalls.php b/src/Calls/ExitDieCalls.php index b6dd090..984a4bf 100644 --- a/src/Calls/ExitDieCalls.php +++ b/src/Calls/ExitDieCalls.php @@ -22,11 +22,10 @@ class ExitDieCalls implements Rule { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/FunctionCalls.php b/src/Calls/FunctionCalls.php index db7cf7e..05e4dbe 100644 --- a/src/Calls/FunctionCalls.php +++ b/src/Calls/FunctionCalls.php @@ -25,14 +25,12 @@ class FunctionCalls implements Rule { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; - /** @var ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** diff --git a/src/Calls/MethodCalls.php b/src/Calls/MethodCalls.php index 6c8be92..38f9fc5 100644 --- a/src/Calls/MethodCalls.php +++ b/src/Calls/MethodCalls.php @@ -24,11 +24,10 @@ class MethodCalls implements Rule { - /** @var DisallowedMethodRuleErrors */ - private $disallowedMethodRuleErrors; + private DisallowedMethodRuleErrors $disallowedMethodRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/NewCalls.php b/src/Calls/NewCalls.php index 31c2efc..4c1951d 100644 --- a/src/Calls/NewCalls.php +++ b/src/Calls/NewCalls.php @@ -26,11 +26,10 @@ class NewCalls implements Rule { private const CONSTRUCT = '::__construct'; - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/PrintCalls.php b/src/Calls/PrintCalls.php index 509fc43..57263b4 100644 --- a/src/Calls/PrintCalls.php +++ b/src/Calls/PrintCalls.php @@ -22,11 +22,10 @@ class PrintCalls implements Rule { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/ShellExecCalls.php b/src/Calls/ShellExecCalls.php index 44e1217..1b73008 100644 --- a/src/Calls/ShellExecCalls.php +++ b/src/Calls/ShellExecCalls.php @@ -26,11 +26,10 @@ class ShellExecCalls implements Rule { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/Calls/StaticCalls.php b/src/Calls/StaticCalls.php index b6c341b..e9b2a68 100644 --- a/src/Calls/StaticCalls.php +++ b/src/Calls/StaticCalls.php @@ -24,11 +24,10 @@ class StaticCalls implements Rule { - /** @var DisallowedMethodRuleErrors */ - private $disallowedMethodRuleErrors; + private DisallowedMethodRuleErrors $disallowedMethodRuleErrors; /** @var list */ - private $disallowedCalls; + private array $disallowedCalls; /** diff --git a/src/ControlStructures/BreakControlStructure.php b/src/ControlStructures/BreakControlStructure.php index 030ce1e..5956090 100644 --- a/src/ControlStructures/BreakControlStructure.php +++ b/src/ControlStructures/BreakControlStructure.php @@ -22,11 +22,10 @@ class BreakControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/ContinueControlStructure.php b/src/ControlStructures/ContinueControlStructure.php index d91151a..4b1519f 100644 --- a/src/ControlStructures/ContinueControlStructure.php +++ b/src/ControlStructures/ContinueControlStructure.php @@ -22,11 +22,10 @@ class ContinueControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/DeclareControlStructure.php b/src/ControlStructures/DeclareControlStructure.php index 775a551..0fe3e4a 100644 --- a/src/ControlStructures/DeclareControlStructure.php +++ b/src/ControlStructures/DeclareControlStructure.php @@ -22,11 +22,10 @@ class DeclareControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/DoWhileControlStructure.php b/src/ControlStructures/DoWhileControlStructure.php index f92b06b..4ea015f 100644 --- a/src/ControlStructures/DoWhileControlStructure.php +++ b/src/ControlStructures/DoWhileControlStructure.php @@ -22,11 +22,10 @@ class DoWhileControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/ElseControlStructure.php b/src/ControlStructures/ElseControlStructure.php index 1fb3750..504adc1 100644 --- a/src/ControlStructures/ElseControlStructure.php +++ b/src/ControlStructures/ElseControlStructure.php @@ -22,11 +22,10 @@ class ElseControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/ElseIfControlStructure.php b/src/ControlStructures/ElseIfControlStructure.php index f65bb2c..a9d963c 100644 --- a/src/ControlStructures/ElseIfControlStructure.php +++ b/src/ControlStructures/ElseIfControlStructure.php @@ -23,11 +23,10 @@ class ElseIfControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/ForControlStructure.php b/src/ControlStructures/ForControlStructure.php index 361f739..640aaa2 100644 --- a/src/ControlStructures/ForControlStructure.php +++ b/src/ControlStructures/ForControlStructure.php @@ -22,11 +22,10 @@ class ForControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/ForeachControlStructure.php b/src/ControlStructures/ForeachControlStructure.php index dd31941..7196fac 100644 --- a/src/ControlStructures/ForeachControlStructure.php +++ b/src/ControlStructures/ForeachControlStructure.php @@ -22,11 +22,10 @@ class ForeachControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/GotoControlStructure.php b/src/ControlStructures/GotoControlStructure.php index 50886fc..9f079ad 100644 --- a/src/ControlStructures/GotoControlStructure.php +++ b/src/ControlStructures/GotoControlStructure.php @@ -22,11 +22,10 @@ class GotoControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/IfControlStructure.php b/src/ControlStructures/IfControlStructure.php index 5a3dbfb..8a1d138 100644 --- a/src/ControlStructures/IfControlStructure.php +++ b/src/ControlStructures/IfControlStructure.php @@ -22,11 +22,10 @@ class IfControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/MatchControlStructure.php b/src/ControlStructures/MatchControlStructure.php index 03f916f..81c3985 100644 --- a/src/ControlStructures/MatchControlStructure.php +++ b/src/ControlStructures/MatchControlStructure.php @@ -22,11 +22,10 @@ class MatchControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/RequireIncludeControlStructure.php b/src/ControlStructures/RequireIncludeControlStructure.php index ffa2edf..179d9d9 100644 --- a/src/ControlStructures/RequireIncludeControlStructure.php +++ b/src/ControlStructures/RequireIncludeControlStructure.php @@ -22,11 +22,10 @@ class RequireIncludeControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/ReturnControlStructure.php b/src/ControlStructures/ReturnControlStructure.php index a599378..f31a66d 100644 --- a/src/ControlStructures/ReturnControlStructure.php +++ b/src/ControlStructures/ReturnControlStructure.php @@ -22,11 +22,10 @@ class ReturnControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/SwitchControlStructure.php b/src/ControlStructures/SwitchControlStructure.php index e1db270..f67959d 100644 --- a/src/ControlStructures/SwitchControlStructure.php +++ b/src/ControlStructures/SwitchControlStructure.php @@ -22,11 +22,10 @@ class SwitchControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/ControlStructures/WhileControlStructure.php b/src/ControlStructures/WhileControlStructure.php index 7d6a4c7..cae7157 100644 --- a/src/ControlStructures/WhileControlStructure.php +++ b/src/ControlStructures/WhileControlStructure.php @@ -22,11 +22,10 @@ class WhileControlStructure implements Rule { - /** @var DisallowedControlStructureRuleErrors */ - private $disallowedControlStructureRuleErrors; + private DisallowedControlStructureRuleErrors $disallowedControlStructureRuleErrors; /** @var list */ - private $disallowedControlStructures; + private array $disallowedControlStructures; /** diff --git a/src/DisallowedAttribute.php b/src/DisallowedAttribute.php index b74318b..e587013 100644 --- a/src/DisallowedAttribute.php +++ b/src/DisallowedAttribute.php @@ -8,23 +8,18 @@ class DisallowedAttribute implements DisallowedWithParams { - /** @var string */ - private $attribute; + private string $attribute; /** @var list */ - private $excludes; + private array $excludes; - /** @var string|null */ - private $message; + private ?string $message; - /** @var AllowedConfig */ - private $allowedConfig; + private AllowedConfig $allowedConfig; - /** @var string|null */ - private $errorIdentifier; + private ?string $errorIdentifier; - /** @var string|null */ - private $errorTip; + private ?string $errorTip; /** diff --git a/src/DisallowedAttributeFactory.php b/src/DisallowedAttributeFactory.php index 1b36edc..5e23ff8 100644 --- a/src/DisallowedAttributeFactory.php +++ b/src/DisallowedAttributeFactory.php @@ -10,11 +10,9 @@ class DisallowedAttributeFactory { - /** @var Allowed */ - private $allowed; + private Allowed $allowed; - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; public function __construct(Allowed $allowed, Normalizer $normalizer) diff --git a/src/DisallowedCall.php b/src/DisallowedCall.php index 9419c44..ea25aff 100644 --- a/src/DisallowedCall.php +++ b/src/DisallowedCall.php @@ -8,26 +8,21 @@ class DisallowedCall implements DisallowedWithParams { - /** @var string */ - private $call; + private string $call; /** @var list */ - private $excludes; + private array $excludes; /** @var list */ - private $definedIn; + private array $definedIn; - /** @var string|null */ - private $message; + private ?string $message; - /** @var AllowedConfig */ - private $allowedConfig; + private AllowedConfig $allowedConfig; - /** @var string|null */ - private $errorIdentifier; + private ?string $errorIdentifier; - /** @var string|null */ - private $errorTip; + private ?string $errorTip; /** diff --git a/src/DisallowedCallFactory.php b/src/DisallowedCallFactory.php index 907f564..5b35e84 100644 --- a/src/DisallowedCallFactory.php +++ b/src/DisallowedCallFactory.php @@ -12,14 +12,11 @@ class DisallowedCallFactory { - /** @var Formatter */ - private $formatter; + private Formatter $formatter; - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; - /** @var Allowed */ - private $allowed; + private Allowed $allowed; public function __construct(Formatter $formatter, Normalizer $normalizer, Allowed $allowed) diff --git a/src/DisallowedConstant.php b/src/DisallowedConstant.php index ba5dbde..ec1d770 100644 --- a/src/DisallowedConstant.php +++ b/src/DisallowedConstant.php @@ -8,23 +8,19 @@ class DisallowedConstant implements Disallowed { - /** @var string */ - private $constant; + private string $constant; - /** @var string|null */ - private $message; + private ?string $message; /** @var list */ - private $allowIn; + private array $allowIn; /** @var list */ - private $allowExceptIn; + private array $allowExceptIn; - /** @var string|null */ - private $errorIdentifier; + private ?string $errorIdentifier; - /** @var string|null */ - private $errorTip; + private ?string $errorTip; /** diff --git a/src/DisallowedConstantFactory.php b/src/DisallowedConstantFactory.php index 0429a84..8048644 100644 --- a/src/DisallowedConstantFactory.php +++ b/src/DisallowedConstantFactory.php @@ -9,8 +9,7 @@ class DisallowedConstantFactory { - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; public function __construct(Normalizer $normalizer) diff --git a/src/DisallowedControlStructure.php b/src/DisallowedControlStructure.php index c6ce39a..16004fa 100644 --- a/src/DisallowedControlStructure.php +++ b/src/DisallowedControlStructure.php @@ -8,23 +8,19 @@ class DisallowedControlStructure implements Disallowed { - /** @var string */ - private $controlStructure; + private string $controlStructure; - /** @var string|null */ - private $message; + private ?string $message; /** @var list */ - private $allowIn; + private array $allowIn; /** @var list */ - private $allowExceptIn; + private array $allowExceptIn; - /** @var string|null */ - private $errorIdentifier; + private ?string $errorIdentifier; - /** @var string|null */ - private $errorTip; + private ?string $errorTip; /** diff --git a/src/DisallowedNamespace.php b/src/DisallowedNamespace.php index 4ee6f0e..0276973 100644 --- a/src/DisallowedNamespace.php +++ b/src/DisallowedNamespace.php @@ -8,26 +8,22 @@ class DisallowedNamespace implements Disallowed { - /** @var string */ - private $namespace; + private string $namespace; /** @var list */ - private $excludes; + private array $excludes; - /** @var string|null */ - private $message; + private ?string $message; /** @var list */ - private $allowIn; + private array $allowIn; /** @var list */ - private $allowExceptIn; + private array $allowExceptIn; - /** @var string|null */ - private $errorIdentifier; + private ?string $errorIdentifier; - /** @var string|null */ - private $errorTip; + private ?string $errorTip; /** diff --git a/src/DisallowedNamespaceFactory.php b/src/DisallowedNamespaceFactory.php index a1780e2..4ae3223 100644 --- a/src/DisallowedNamespaceFactory.php +++ b/src/DisallowedNamespaceFactory.php @@ -9,8 +9,7 @@ class DisallowedNamespaceFactory { - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; public function __construct(Normalizer $normalizer) diff --git a/src/DisallowedVariable.php b/src/DisallowedVariable.php index 9a86ae4..3579c8d 100644 --- a/src/DisallowedVariable.php +++ b/src/DisallowedVariable.php @@ -8,23 +8,19 @@ class DisallowedVariable implements Disallowed { - /** @var string */ - private $variable; + private string $variable; - /** @var string|null */ - private $message; + private ?string $message; /** @var list */ - private $allowIn; + private array $allowIn; /** @var list */ - private $allowExceptIn; + private array $allowExceptIn; - /** @var string|null */ - private $errorIdentifier; + private ?string $errorIdentifier; - /** @var string|null */ - private $errorTip; + private ?string $errorTip; /** diff --git a/src/File/FilePath.php b/src/File/FilePath.php index f640670..c92a474 100644 --- a/src/File/FilePath.php +++ b/src/File/FilePath.php @@ -8,11 +8,9 @@ class FilePath { - /** @var FileHelper */ - private $fileHelper; + private FileHelper $fileHelper; - /** @var string|null */ - private $rootDir; + private ?string $rootDir; public function __construct(FileHelper $fileHelper, ?string $rootDir = null) diff --git a/src/Formatter/Formatter.php b/src/Formatter/Formatter.php index 2cd6c0f..9ecb4e2 100644 --- a/src/Formatter/Formatter.php +++ b/src/Formatter/Formatter.php @@ -9,8 +9,7 @@ class Formatter { - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; public function __construct(Normalizer $normalizer) diff --git a/src/Params/ParamValue.php b/src/Params/ParamValue.php index 9863349..894d329 100644 --- a/src/Params/ParamValue.php +++ b/src/Params/ParamValue.php @@ -8,14 +8,11 @@ abstract class ParamValue implements Param { - /** @var ?int */ - private $position; + private ?int $position; - /** @var ?string */ - private $name; + private ?string $name; - /** @var Type */ - private $type; + private Type $type; abstract public function matches(Type $type): bool; diff --git a/src/Params/ParamValueFlagExcept.php b/src/Params/ParamValueFlagExcept.php index 6186b1d..b828ccb 100644 --- a/src/Params/ParamValueFlagExcept.php +++ b/src/Params/ParamValueFlagExcept.php @@ -5,14 +5,12 @@ use PHPStan\Type\Type; use Spaze\PHPStan\Rules\Disallowed\Exceptions\UnsupportedParamTypeException; -use Spaze\PHPStan\Rules\Disallowed\Exceptions\UnsupportedParamTypeInConfigException; class ParamValueFlagExcept extends ParamValueFlag { /** * @throws UnsupportedParamTypeException - * @throws UnsupportedParamTypeInConfigException */ public function matches(Type $type): bool { diff --git a/src/Params/ParamValueFlagSpecific.php b/src/Params/ParamValueFlagSpecific.php index fcc6817..e9b5a26 100644 --- a/src/Params/ParamValueFlagSpecific.php +++ b/src/Params/ParamValueFlagSpecific.php @@ -5,14 +5,12 @@ use PHPStan\Type\Type; use Spaze\PHPStan\Rules\Disallowed\Exceptions\UnsupportedParamTypeException; -use Spaze\PHPStan\Rules\Disallowed\Exceptions\UnsupportedParamTypeInConfigException; class ParamValueFlagSpecific extends ParamValueFlag { /** * @throws UnsupportedParamTypeException - * @throws UnsupportedParamTypeInConfigException */ public function matches(Type $type): bool { diff --git a/src/RuleErrors/DisallowedAttributeRuleErrors.php b/src/RuleErrors/DisallowedAttributeRuleErrors.php index 179080b..fb53eeb 100644 --- a/src/RuleErrors/DisallowedAttributeRuleErrors.php +++ b/src/RuleErrors/DisallowedAttributeRuleErrors.php @@ -15,14 +15,11 @@ class DisallowedAttributeRuleErrors { - /** @var Allowed */ - private $allowed; + private Allowed $allowed; - /** @var Identifier */ - private $identifier; + private Identifier $identifier; - /** @var Formatter */ - private $formatter; + private Formatter $formatter; public function __construct(Allowed $allowed, Identifier $identifier, Formatter $formatter) diff --git a/src/RuleErrors/DisallowedCallsRuleErrors.php b/src/RuleErrors/DisallowedCallsRuleErrors.php index 3032a88..5c73c15 100644 --- a/src/RuleErrors/DisallowedCallsRuleErrors.php +++ b/src/RuleErrors/DisallowedCallsRuleErrors.php @@ -17,17 +17,13 @@ class DisallowedCallsRuleErrors { - /** @var Allowed */ - private $allowed; + private Allowed $allowed; - /** @var Identifier */ - private $identifier; + private Identifier $identifier; - /** @var FilePath */ - private $filePath; + private FilePath $filePath; - /** @var Formatter */ - private $formatter; + private Formatter $formatter; public function __construct(Allowed $allowed, Identifier $identifier, FilePath $filePath, Formatter $formatter) diff --git a/src/RuleErrors/DisallowedConstantRuleErrors.php b/src/RuleErrors/DisallowedConstantRuleErrors.php index 441d384..a753f6f 100644 --- a/src/RuleErrors/DisallowedConstantRuleErrors.php +++ b/src/RuleErrors/DisallowedConstantRuleErrors.php @@ -14,12 +14,9 @@ class DisallowedConstantRuleErrors { + private AllowedPath $allowedPath; - /** @var AllowedPath */ - private $allowedPath; - - /** @var Formatter */ - private $formatter; + private Formatter $formatter; public function __construct(AllowedPath $allowedPath, Formatter $formatter) diff --git a/src/RuleErrors/DisallowedControlStructureRuleErrors.php b/src/RuleErrors/DisallowedControlStructureRuleErrors.php index da58e7b..5156c9e 100644 --- a/src/RuleErrors/DisallowedControlStructureRuleErrors.php +++ b/src/RuleErrors/DisallowedControlStructureRuleErrors.php @@ -14,11 +14,9 @@ class DisallowedControlStructureRuleErrors { - /** @var AllowedPath */ - private $allowedPath; + private AllowedPath $allowedPath; - /** @var Formatter */ - private $formatter; + private Formatter $formatter; public function __construct(AllowedPath $allowedPath, Formatter $formatter) diff --git a/src/RuleErrors/DisallowedMethodRuleErrors.php b/src/RuleErrors/DisallowedMethodRuleErrors.php index d151c3f..eb80b6b 100644 --- a/src/RuleErrors/DisallowedMethodRuleErrors.php +++ b/src/RuleErrors/DisallowedMethodRuleErrors.php @@ -21,14 +21,11 @@ class DisallowedMethodRuleErrors { - /** @var DisallowedCallsRuleErrors */ - private $disallowedCallsRuleErrors; + private DisallowedCallsRuleErrors $disallowedCallsRuleErrors; - /** @var TypeResolver */ - private $typeResolver; + private TypeResolver $typeResolver; - /** @var Formatter */ - private $formatter; + private Formatter $formatter; public function __construct( diff --git a/src/RuleErrors/DisallowedNamespaceRuleErrors.php b/src/RuleErrors/DisallowedNamespaceRuleErrors.php index 189b94a..30daa71 100644 --- a/src/RuleErrors/DisallowedNamespaceRuleErrors.php +++ b/src/RuleErrors/DisallowedNamespaceRuleErrors.php @@ -14,14 +14,11 @@ class DisallowedNamespaceRuleErrors { - /** @var AllowedPath */ - private $allowedPath; + private AllowedPath $allowedPath; - /** @var Identifier */ - private $identifier; + private Identifier $identifier; - /** @var Formatter */ - private $formatter; + private Formatter $formatter; public function __construct(AllowedPath $allowedPath, Identifier $identifier, Formatter $formatter) diff --git a/src/RuleErrors/DisallowedVariableRuleErrors.php b/src/RuleErrors/DisallowedVariableRuleErrors.php index a69da88..f353185 100644 --- a/src/RuleErrors/DisallowedVariableRuleErrors.php +++ b/src/RuleErrors/DisallowedVariableRuleErrors.php @@ -14,11 +14,9 @@ class DisallowedVariableRuleErrors { - /** @var AllowedPath */ - private $allowedPath; + private AllowedPath $allowedPath; - /** @var Formatter */ - private $formatter; + private Formatter $formatter; public function __construct(AllowedPath $allowedPath, Formatter $formatter) diff --git a/src/Usages/AttributeUsages.php b/src/Usages/AttributeUsages.php index 7a594e0..f1b3109 100644 --- a/src/Usages/AttributeUsages.php +++ b/src/Usages/AttributeUsages.php @@ -24,14 +24,13 @@ class AttributeUsages implements Rule { - /** @var DisallowedAttributeRuleErrors */ - private $disallowedAttributeRuleErrors; + private DisallowedAttributeRuleErrors $disallowedAttributeRuleErrors; /** @var list */ - private $disallowedAttributes; + private array $disallowedAttributes; /** @var list */ - private $attributes; + private array $attributes; /** diff --git a/src/Usages/ClassConstantUsages.php b/src/Usages/ClassConstantUsages.php index 0adba34..ed0c8de 100644 --- a/src/Usages/ClassConstantUsages.php +++ b/src/Usages/ClassConstantUsages.php @@ -30,17 +30,14 @@ class ClassConstantUsages implements Rule { - /** @var DisallowedConstantRuleErrors */ - private $disallowedConstantRuleErrors; + private DisallowedConstantRuleErrors $disallowedConstantRuleErrors; - /** @var TypeResolver */ - private $typeResolver; + private TypeResolver $typeResolver; - /** @var Formatter */ - private $formatter; + private Formatter $formatter; /** @var list */ - private $disallowedConstants; + private array $disallowedConstants; /** diff --git a/src/Usages/ConstantUsages.php b/src/Usages/ConstantUsages.php index 9e0c422..9ac75fb 100644 --- a/src/Usages/ConstantUsages.php +++ b/src/Usages/ConstantUsages.php @@ -23,11 +23,10 @@ class ConstantUsages implements Rule { - /** @var DisallowedConstantRuleErrors */ - private $disallowedConstantRuleError; + private DisallowedConstantRuleErrors $disallowedConstantRuleError; /** @var list */ - private $disallowedConstants; + private array $disallowedConstants; /** diff --git a/src/Usages/NamespaceUsages.php b/src/Usages/NamespaceUsages.php index 90c290c..90267e0 100644 --- a/src/Usages/NamespaceUsages.php +++ b/src/Usages/NamespaceUsages.php @@ -30,14 +30,12 @@ class NamespaceUsages implements Rule { - /** @var DisallowedNamespaceRuleErrors */ - private $disallowedNamespaceRuleErrors; + private DisallowedNamespaceRuleErrors $disallowedNamespaceRuleErrors; /** @var list */ - private $disallowedNamespace; + private array $disallowedNamespace; - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; /** diff --git a/src/Usages/VariableUsages.php b/src/Usages/VariableUsages.php index 4c06502..f30c5d6 100644 --- a/src/Usages/VariableUsages.php +++ b/src/Usages/VariableUsages.php @@ -21,11 +21,10 @@ class VariableUsages implements Rule { - /** @var DisallowedVariableRuleErrors */ - private $disallowedVariableRuleErrors; + private DisallowedVariableRuleErrors $disallowedVariableRuleErrors; /** @var list */ - private $disallowedVariables; + private array $disallowedVariables; /** diff --git a/tests/Allowed/AllowedPathTest.php b/tests/Allowed/AllowedPathTest.php index 92c18d7..f21c60d 100644 --- a/tests/Allowed/AllowedPathTest.php +++ b/tests/Allowed/AllowedPathTest.php @@ -19,17 +19,13 @@ class AllowedPathTest extends PHPStanTestCase { - /** @var AllowedPath */ - private $allowedPath; + private AllowedPath $allowedPath; - /** @var AllowedPath */ - private $allowedPathWithRootDir; + private AllowedPath $allowedPathWithRootDir; - /** @var ScopeFactory */ - private $scopeFactory; + private ScopeFactory $scopeFactory; - /** @var ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; protected function setUp(): void diff --git a/tests/File/FilePathTest.php b/tests/File/FilePathTest.php index 08e2e26..1ca270d 100644 --- a/tests/File/FilePathTest.php +++ b/tests/File/FilePathTest.php @@ -11,11 +11,9 @@ class FilePathTest extends PHPStanTestCase { - /** @var FilePath */ - private $filePath; + private FilePath $filePath; - /** @var FilePath */ - private $filePathWithRootDir; + private FilePath $filePathWithRootDir; protected function setUp(): void diff --git a/tests/Formatter/FormatterTest.php b/tests/Formatter/FormatterTest.php index f7256f1..9afa4f1 100644 --- a/tests/Formatter/FormatterTest.php +++ b/tests/Formatter/FormatterTest.php @@ -8,8 +8,7 @@ class FormatterTest extends PHPStanTestCase { - /** @var Formatter */ - private $formatter; + private Formatter $formatter; protected function setUp(): void diff --git a/tests/Identifier/IdentifierTest.php b/tests/Identifier/IdentifierTest.php index 90209bd..b071dd5 100644 --- a/tests/Identifier/IdentifierTest.php +++ b/tests/Identifier/IdentifierTest.php @@ -10,8 +10,7 @@ class IdentifierTest extends PHPStanTestCase { - /** @var Identifier */ - private $identifier; + private Identifier $identifier; protected function setUp(): void diff --git a/tests/Normalizer/NormalizerTest.php b/tests/Normalizer/NormalizerTest.php index 2bf7516..dee0db6 100644 --- a/tests/Normalizer/NormalizerTest.php +++ b/tests/Normalizer/NormalizerTest.php @@ -9,8 +9,7 @@ class NormalizerTest extends PHPStanTestCase { - /** @var Normalizer */ - private $normalizer; + private Normalizer $normalizer; protected function setUp(): void diff --git a/tests/src/Option.php b/tests/src/Option.php index 5eca7b7..26bdc33 100644 --- a/tests/src/Option.php +++ b/tests/src/Option.php @@ -48,8 +48,7 @@ public static function fromArraysValue($array, $key) */ final class None extends Option { - /** @var None|null */ - private static $instance; + private static ?None $instance; /** * @return None