diff --git a/bin/generate-rule-error-classes.php b/bin/generate-rule-error-classes.php index b8b3219e5d..633b1824b4 100755 --- a/bin/generate-rule-error-classes.php +++ b/bin/generate-rule-error-classes.php @@ -14,7 +14,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError%s implements %s +final class RuleError%s implements %s { %s diff --git a/build/enum-adapter-errors.neon b/build/enum-adapter-errors.neon index 04a18bb846..eccbd3eb1a 100644 --- a/build/enum-adapter-errors.neon +++ b/build/enum-adapter-errors.neon @@ -144,8 +144,3 @@ parameters: message: "#^Method PHPStan\\\\Reflection\\\\Php\\\\BuiltinMethodReflection\\:\\:getDeclaringClass\\(\\) has invalid return type PHPStan\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\ReflectionEnum\\.$#" count: 1 path: ../src/Reflection/Php/BuiltinMethodReflection.php - - - - message: "#^Method PHPStan\\\\Reflection\\\\Php\\\\NativeBuiltinMethodReflection\\:\\:getDeclaringClass\\(\\) has invalid return type PHPStan\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\ReflectionEnum\\.$#" - count: 1 - path: ../src/Reflection/Php/NativeBuiltinMethodReflection.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c664a131e7..d79870622a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -212,31 +212,6 @@ parameters: count: 1 path: src/PhpDoc/StubValidator.php - - - message: "#^Return type \\(PHPStan\\\\PhpDoc\\\\Tag\\\\ParamOutTag\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\ParamOutTag\\:\\:withType\\(\\) should be covariant with return type \\(static\\(PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\)\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\:\\:withType\\(\\)$#" - count: 1 - path: src/PhpDoc/Tag/ParamOutTag.php - - - - message: "#^Return type \\(PHPStan\\\\PhpDoc\\\\Tag\\\\ParamTag\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\ParamTag\\:\\:withType\\(\\) should be covariant with return type \\(static\\(PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\)\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\:\\:withType\\(\\)$#" - count: 1 - path: src/PhpDoc/Tag/ParamTag.php - - - - message: "#^Return type \\(PHPStan\\\\PhpDoc\\\\Tag\\\\ReturnTag\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\ReturnTag\\:\\:withType\\(\\) should be covariant with return type \\(static\\(PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\)\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\:\\:withType\\(\\)$#" - count: 1 - path: src/PhpDoc/Tag/ReturnTag.php - - - - message: "#^Return type \\(PHPStan\\\\PhpDoc\\\\Tag\\\\SelfOutTypeTag\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\SelfOutTypeTag\\:\\:withType\\(\\) should be covariant with return type \\(static\\(PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\)\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\:\\:withType\\(\\)$#" - count: 1 - path: src/PhpDoc/Tag/SelfOutTypeTag.php - - - - message: "#^Return type \\(PHPStan\\\\PhpDoc\\\\Tag\\\\VarTag\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\VarTag\\:\\:withType\\(\\) should be covariant with return type \\(static\\(PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\)\\) of method PHPStan\\\\PhpDoc\\\\Tag\\\\TypedTag\\:\\:withType\\(\\)$#" - count: 1 - path: src/PhpDoc/Tag/VarTag.php - - message: "#^Doing instanceof PHPStan\\\\Type\\\\ArrayType is error\\-prone and deprecated\\. Use Type\\:\\:isArray\\(\\) or Type\\:\\:getArrays\\(\\) instead\\.$#" count: 1 diff --git a/src/Analyser/Analyser.php b/src/Analyser/Analyser.php index ed161671c6..4ab99fc5d3 100644 --- a/src/Analyser/Analyser.php +++ b/src/Analyser/Analyser.php @@ -12,7 +12,7 @@ use function count; use function memory_get_peak_usage; -class Analyser +final class Analyser { public function __construct( diff --git a/src/Analyser/AnalyserResult.php b/src/Analyser/AnalyserResult.php index 903ab9c5dc..212fdcf422 100644 --- a/src/Analyser/AnalyserResult.php +++ b/src/Analyser/AnalyserResult.php @@ -9,7 +9,7 @@ /** * @phpstan-import-type LinesToIgnore from FileAnalyserResult */ -class AnalyserResult +final class AnalyserResult { /** @var list|null */ diff --git a/src/Analyser/AnalyserResultFinalizer.php b/src/Analyser/AnalyserResultFinalizer.php index 707ac02005..b88b3e0d31 100644 --- a/src/Analyser/AnalyserResultFinalizer.php +++ b/src/Analyser/AnalyserResultFinalizer.php @@ -14,7 +14,7 @@ use function get_class; use function sprintf; -class AnalyserResultFinalizer +final class AnalyserResultFinalizer { public function __construct( diff --git a/src/Analyser/ConditionalExpressionHolder.php b/src/Analyser/ConditionalExpressionHolder.php index 561feac059..6907183966 100644 --- a/src/Analyser/ConditionalExpressionHolder.php +++ b/src/Analyser/ConditionalExpressionHolder.php @@ -8,7 +8,7 @@ use function implode; use function sprintf; -class ConditionalExpressionHolder +final class ConditionalExpressionHolder { /** diff --git a/src/Analyser/ConstantResolver.php b/src/Analyser/ConstantResolver.php index d8df652c42..b209533fac 100644 --- a/src/Analyser/ConstantResolver.php +++ b/src/Analyser/ConstantResolver.php @@ -25,7 +25,7 @@ use const NAN; use const PHP_INT_SIZE; -class ConstantResolver +final class ConstantResolver { /** @var array */ diff --git a/src/Analyser/ConstantResolverFactory.php b/src/Analyser/ConstantResolverFactory.php index bd63830f59..67a98408a0 100644 --- a/src/Analyser/ConstantResolverFactory.php +++ b/src/Analyser/ConstantResolverFactory.php @@ -5,7 +5,7 @@ use PHPStan\DependencyInjection\Container; use PHPStan\Reflection\ReflectionProvider\ReflectionProviderProvider; -class ConstantResolverFactory +final class ConstantResolverFactory { public function __construct( diff --git a/src/Analyser/DirectInternalScopeFactory.php b/src/Analyser/DirectInternalScopeFactory.php index c662e1d9a0..49a3395d2e 100644 --- a/src/Analyser/DirectInternalScopeFactory.php +++ b/src/Analyser/DirectInternalScopeFactory.php @@ -17,7 +17,7 @@ use PHPStan\ShouldNotHappenException; use function is_a; -class DirectInternalScopeFactory implements InternalScopeFactory +final class DirectInternalScopeFactory implements InternalScopeFactory { /** diff --git a/src/Analyser/EndStatementResult.php b/src/Analyser/EndStatementResult.php index 32d0809bef..18f97ddc50 100644 --- a/src/Analyser/EndStatementResult.php +++ b/src/Analyser/EndStatementResult.php @@ -4,7 +4,7 @@ use PhpParser\Node\Stmt; -class EndStatementResult +final class EndStatementResult { public function __construct( diff --git a/src/Analyser/EnsuredNonNullabilityResult.php b/src/Analyser/EnsuredNonNullabilityResult.php index 258a16b18b..6a9e539cf1 100644 --- a/src/Analyser/EnsuredNonNullabilityResult.php +++ b/src/Analyser/EnsuredNonNullabilityResult.php @@ -2,7 +2,7 @@ namespace PHPStan\Analyser; -class EnsuredNonNullabilityResult +final class EnsuredNonNullabilityResult { /** diff --git a/src/Analyser/EnsuredNonNullabilityResultExpression.php b/src/Analyser/EnsuredNonNullabilityResultExpression.php index 33f94341e6..59f5eba2ee 100644 --- a/src/Analyser/EnsuredNonNullabilityResultExpression.php +++ b/src/Analyser/EnsuredNonNullabilityResultExpression.php @@ -6,7 +6,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class EnsuredNonNullabilityResultExpression +final class EnsuredNonNullabilityResultExpression { public function __construct( diff --git a/src/Analyser/Error.php b/src/Analyser/Error.php index f378d912d9..d92f983a3e 100644 --- a/src/Analyser/Error.php +++ b/src/Analyser/Error.php @@ -12,7 +12,10 @@ use function is_bool; use function sprintf; -/** @api */ +/** + * @api + * @final + */ class Error implements JsonSerializable { diff --git a/src/Analyser/ExpressionContext.php b/src/Analyser/ExpressionContext.php index c2a5a6c78a..c910b0cc3d 100644 --- a/src/Analyser/ExpressionContext.php +++ b/src/Analyser/ExpressionContext.php @@ -4,7 +4,7 @@ use PHPStan\Type\Type; -class ExpressionContext +final class ExpressionContext { private function __construct( diff --git a/src/Analyser/ExpressionResult.php b/src/Analyser/ExpressionResult.php index cae75b1609..0a50465169 100644 --- a/src/Analyser/ExpressionResult.php +++ b/src/Analyser/ExpressionResult.php @@ -2,7 +2,7 @@ namespace PHPStan\Analyser; -class ExpressionResult +final class ExpressionResult { /** @var (callable(): MutatingScope)|null */ diff --git a/src/Analyser/ExpressionTypeHolder.php b/src/Analyser/ExpressionTypeHolder.php index 6211e211c8..a3ea8273e6 100644 --- a/src/Analyser/ExpressionTypeHolder.php +++ b/src/Analyser/ExpressionTypeHolder.php @@ -7,7 +7,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ExpressionTypeHolder +final class ExpressionTypeHolder { public function __construct(private Expr $expr, private Type $type, private TrinaryLogic $certainty) diff --git a/src/Analyser/FileAnalyser.php b/src/Analyser/FileAnalyser.php index 13ee1ba1b6..8d8cf59016 100644 --- a/src/Analyser/FileAnalyser.php +++ b/src/Analyser/FileAnalyser.php @@ -36,7 +36,7 @@ use const E_USER_WARNING; use const E_WARNING; -class FileAnalyser +final class FileAnalyser { /** @var list */ diff --git a/src/Analyser/FileAnalyserResult.php b/src/Analyser/FileAnalyserResult.php index 23e34a9278..d1727f5824 100644 --- a/src/Analyser/FileAnalyserResult.php +++ b/src/Analyser/FileAnalyserResult.php @@ -8,7 +8,7 @@ /** * @phpstan-type LinesToIgnore = array|null>> */ -class FileAnalyserResult +final class FileAnalyserResult { /** diff --git a/src/Analyser/FinalizerResult.php b/src/Analyser/FinalizerResult.php index dfc7761743..c196b25d99 100644 --- a/src/Analyser/FinalizerResult.php +++ b/src/Analyser/FinalizerResult.php @@ -2,7 +2,7 @@ namespace PHPStan\Analyser; -class FinalizerResult +final class FinalizerResult { /** diff --git a/src/Analyser/Ignore/IgnoreParseException.php b/src/Analyser/Ignore/IgnoreParseException.php index fc8eec134c..c355cb5ad2 100644 --- a/src/Analyser/Ignore/IgnoreParseException.php +++ b/src/Analyser/Ignore/IgnoreParseException.php @@ -4,7 +4,7 @@ use Exception; -class IgnoreParseException extends Exception +final class IgnoreParseException extends Exception { public function __construct(string $message, private int $phpDocLine) diff --git a/src/Analyser/Ignore/IgnoredError.php b/src/Analyser/Ignore/IgnoredError.php index 00cc1e7df8..b420ae29ce 100644 --- a/src/Analyser/Ignore/IgnoredError.php +++ b/src/Analyser/Ignore/IgnoredError.php @@ -14,7 +14,7 @@ use function sprintf; use function str_replace; -class IgnoredError +final class IgnoredError { /** diff --git a/src/Analyser/Ignore/IgnoredErrorHelper.php b/src/Analyser/Ignore/IgnoredErrorHelper.php index bff07c1085..d72f73ed82 100644 --- a/src/Analyser/Ignore/IgnoredErrorHelper.php +++ b/src/Analyser/Ignore/IgnoredErrorHelper.php @@ -12,7 +12,7 @@ use function is_file; use function sprintf; -class IgnoredErrorHelper +final class IgnoredErrorHelper { /** diff --git a/src/Analyser/Ignore/IgnoredErrorHelperProcessedResult.php b/src/Analyser/Ignore/IgnoredErrorHelperProcessedResult.php index 4ffacf46d4..67bcfa176c 100644 --- a/src/Analyser/Ignore/IgnoredErrorHelperProcessedResult.php +++ b/src/Analyser/Ignore/IgnoredErrorHelperProcessedResult.php @@ -4,7 +4,7 @@ use PHPStan\Analyser\Error; -class IgnoredErrorHelperProcessedResult +final class IgnoredErrorHelperProcessedResult { /** diff --git a/src/Analyser/Ignore/IgnoredErrorHelperResult.php b/src/Analyser/Ignore/IgnoredErrorHelperResult.php index 95d4273ef8..529e1ae4a4 100644 --- a/src/Analyser/Ignore/IgnoredErrorHelperResult.php +++ b/src/Analyser/Ignore/IgnoredErrorHelperResult.php @@ -13,7 +13,7 @@ use function is_string; use function sprintf; -class IgnoredErrorHelperResult +final class IgnoredErrorHelperResult { /** diff --git a/src/Analyser/ImpurePoint.php b/src/Analyser/ImpurePoint.php index e87e8866b0..d4dc6fe133 100644 --- a/src/Analyser/ImpurePoint.php +++ b/src/Analyser/ImpurePoint.php @@ -8,6 +8,7 @@ /** * @phpstan-type ImpurePointIdentifier = 'echo'|'die'|'exit'|'propertyAssign'|'propertyAssignByRef'|'propertyUnset'|'methodCall'|'new'|'functionCall'|'include'|'require'|'print'|'eval'|'superglobal'|'yield'|'yieldFrom'|'static'|'global'|'betweenPhpTags' * @api + * @final */ class ImpurePoint { diff --git a/src/Analyser/InternalError.php b/src/Analyser/InternalError.php index 9a3ddd2820..d778e89462 100644 --- a/src/Analyser/InternalError.php +++ b/src/Analyser/InternalError.php @@ -10,6 +10,7 @@ /** * @api + * @final * @phpstan-type Trace = list */ class InternalError implements JsonSerializable diff --git a/src/Analyser/LazyInternalScopeFactory.php b/src/Analyser/LazyInternalScopeFactory.php index 028600646c..fec1521768 100644 --- a/src/Analyser/LazyInternalScopeFactory.php +++ b/src/Analyser/LazyInternalScopeFactory.php @@ -17,7 +17,7 @@ use PHPStan\ShouldNotHappenException; use function is_a; -class LazyInternalScopeFactory implements InternalScopeFactory +final class LazyInternalScopeFactory implements InternalScopeFactory { private bool $explicitMixedInUnknownGenericNew; diff --git a/src/Analyser/LocalIgnoresProcessor.php b/src/Analyser/LocalIgnoresProcessor.php index 04368960b0..d5c0197dd6 100644 --- a/src/Analyser/LocalIgnoresProcessor.php +++ b/src/Analyser/LocalIgnoresProcessor.php @@ -10,7 +10,7 @@ /** * @phpstan-import-type LinesToIgnore from FileAnalyserResult */ -class LocalIgnoresProcessor +final class LocalIgnoresProcessor { /** diff --git a/src/Analyser/LocalIgnoresProcessorResult.php b/src/Analyser/LocalIgnoresProcessorResult.php index 8c7a36287f..1d44c98f1f 100644 --- a/src/Analyser/LocalIgnoresProcessorResult.php +++ b/src/Analyser/LocalIgnoresProcessorResult.php @@ -5,7 +5,7 @@ /** * @phpstan-import-type LinesToIgnore from FileAnalyserResult */ -class LocalIgnoresProcessorResult +final class LocalIgnoresProcessorResult { /** diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 6632716bd7..fca60cc869 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -158,7 +158,7 @@ use const PHP_INT_MAX; use const PHP_INT_MIN; -class MutatingScope implements Scope +final class MutatingScope implements Scope { private const BOOLEAN_EXPRESSION_MAX_PROCESS_DEPTH = 4; diff --git a/src/Analyser/NameScope.php b/src/Analyser/NameScope.php index e083daf91b..fbc602329e 100644 --- a/src/Analyser/NameScope.php +++ b/src/Analyser/NameScope.php @@ -16,7 +16,10 @@ use function str_starts_with; use function strtolower; -/** @api */ +/** + * @api + * @final + */ class NameScope { diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index dbd1418a1d..c48b2e439b 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -211,7 +211,7 @@ use const PHP_VERSION_ID; use const SORT_NUMERIC; -class NodeScopeResolver +final class NodeScopeResolver { private const LOOP_SCOPE_ITERATIONS = 3; diff --git a/src/Analyser/NullsafeOperatorHelper.php b/src/Analyser/NullsafeOperatorHelper.php index 9b34346264..0b439191c7 100644 --- a/src/Analyser/NullsafeOperatorHelper.php +++ b/src/Analyser/NullsafeOperatorHelper.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Type\TypeCombinator; -class NullsafeOperatorHelper +final class NullsafeOperatorHelper { public static function getNullsafeShortcircuitedExprRespectingScope(Scope $scope, Expr $expr): Expr diff --git a/src/Analyser/OutOfClassScope.php b/src/Analyser/OutOfClassScope.php index d9ddf23f2f..42a85108c9 100644 --- a/src/Analyser/OutOfClassScope.php +++ b/src/Analyser/OutOfClassScope.php @@ -8,7 +8,7 @@ use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\PropertyReflection; -class OutOfClassScope implements ClassMemberAccessAnswerer +final class OutOfClassScope implements ClassMemberAccessAnswerer { /** @api */ diff --git a/src/Analyser/ProcessClosureResult.php b/src/Analyser/ProcessClosureResult.php index 7423ac220d..0051383278 100644 --- a/src/Analyser/ProcessClosureResult.php +++ b/src/Analyser/ProcessClosureResult.php @@ -4,7 +4,7 @@ use PHPStan\Node\InvalidateExprNode; -class ProcessClosureResult +final class ProcessClosureResult { /** diff --git a/src/Analyser/ResultCache/ResultCache.php b/src/Analyser/ResultCache/ResultCache.php index 8b592f68fe..f409f9c062 100644 --- a/src/Analyser/ResultCache/ResultCache.php +++ b/src/Analyser/ResultCache/ResultCache.php @@ -10,7 +10,7 @@ /** * @phpstan-import-type LinesToIgnore from FileAnalyserResult */ -class ResultCache +final class ResultCache { /** diff --git a/src/Analyser/ResultCache/ResultCacheClearer.php b/src/Analyser/ResultCache/ResultCacheClearer.php index d9cbee81c6..75f3d25628 100644 --- a/src/Analyser/ResultCache/ResultCacheClearer.php +++ b/src/Analyser/ResultCache/ResultCacheClearer.php @@ -6,7 +6,7 @@ use function is_file; use function unlink; -class ResultCacheClearer +final class ResultCacheClearer { public function __construct(private string $cacheFilePath) diff --git a/src/Analyser/ResultCache/ResultCacheManager.php b/src/Analyser/ResultCache/ResultCacheManager.php index 416ce41108..d8cfceb646 100644 --- a/src/Analyser/ResultCache/ResultCacheManager.php +++ b/src/Analyser/ResultCache/ResultCacheManager.php @@ -47,7 +47,7 @@ /** * @phpstan-import-type LinesToIgnore from FileAnalyserResult */ -class ResultCacheManager +final class ResultCacheManager { private const CACHE_VERSION = 'v12-linesToIgnore'; diff --git a/src/Analyser/ResultCache/ResultCacheProcessResult.php b/src/Analyser/ResultCache/ResultCacheProcessResult.php index 27326f33a0..9789eefcbb 100644 --- a/src/Analyser/ResultCache/ResultCacheProcessResult.php +++ b/src/Analyser/ResultCache/ResultCacheProcessResult.php @@ -4,7 +4,7 @@ use PHPStan\Analyser\AnalyserResult; -class ResultCacheProcessResult +final class ResultCacheProcessResult { public function __construct(private AnalyserResult $analyserResult, private bool $saved) diff --git a/src/Analyser/RuleErrorTransformer.php b/src/Analyser/RuleErrorTransformer.php index 464e8cd776..0cb9f9ef98 100644 --- a/src/Analyser/RuleErrorTransformer.php +++ b/src/Analyser/RuleErrorTransformer.php @@ -12,7 +12,7 @@ use PHPStan\Rules\TipRuleError; use function is_string; -class RuleErrorTransformer +final class RuleErrorTransformer { /** diff --git a/src/Analyser/ScopeContext.php b/src/Analyser/ScopeContext.php index 4118909860..dfa0c1f17b 100644 --- a/src/Analyser/ScopeContext.php +++ b/src/Analyser/ScopeContext.php @@ -5,7 +5,7 @@ use PHPStan\Reflection\ClassReflection; use PHPStan\ShouldNotHappenException; -class ScopeContext +final class ScopeContext { private function __construct( diff --git a/src/Analyser/ScopeFactory.php b/src/Analyser/ScopeFactory.php index c2401d375c..ae35c9d74c 100644 --- a/src/Analyser/ScopeFactory.php +++ b/src/Analyser/ScopeFactory.php @@ -2,7 +2,10 @@ namespace PHPStan\Analyser; -/** @api */ +/** + * @api + * @final + */ class ScopeFactory { diff --git a/src/Analyser/SpecifiedTypes.php b/src/Analyser/SpecifiedTypes.php index 578a34cdc2..ca290a17c4 100644 --- a/src/Analyser/SpecifiedTypes.php +++ b/src/Analyser/SpecifiedTypes.php @@ -6,7 +6,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class SpecifiedTypes +final class SpecifiedTypes { /** diff --git a/src/Analyser/StatementContext.php b/src/Analyser/StatementContext.php index 222d768b52..e9308cfb77 100644 --- a/src/Analyser/StatementContext.php +++ b/src/Analyser/StatementContext.php @@ -2,7 +2,7 @@ namespace PHPStan\Analyser; -class StatementContext +final class StatementContext { private function __construct( diff --git a/src/Analyser/StatementExitPoint.php b/src/Analyser/StatementExitPoint.php index f7f46ca091..14c8d24824 100644 --- a/src/Analyser/StatementExitPoint.php +++ b/src/Analyser/StatementExitPoint.php @@ -4,7 +4,10 @@ use PhpParser\Node\Stmt; -/** @api */ +/** + * @api + * @final + */ class StatementExitPoint { diff --git a/src/Analyser/StatementResult.php b/src/Analyser/StatementResult.php index 20365299c0..bb9ae78f2e 100644 --- a/src/Analyser/StatementResult.php +++ b/src/Analyser/StatementResult.php @@ -5,7 +5,10 @@ use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; -/** @api */ +/** + * @api + * @final + */ class StatementResult { diff --git a/src/Analyser/ThrowPoint.php b/src/Analyser/ThrowPoint.php index 26ceec4260..1de4b937f9 100644 --- a/src/Analyser/ThrowPoint.php +++ b/src/Analyser/ThrowPoint.php @@ -8,7 +8,10 @@ use PHPStan\Type\TypeCombinator; use Throwable; -/** @api */ +/** + * @api + * @final + */ class ThrowPoint { diff --git a/src/Analyser/TypeSpecifier.php b/src/Analyser/TypeSpecifier.php index 4115a752e0..06b9afceed 100644 --- a/src/Analyser/TypeSpecifier.php +++ b/src/Analyser/TypeSpecifier.php @@ -82,7 +82,7 @@ use function substr; use const COUNT_NORMAL; -class TypeSpecifier +final class TypeSpecifier { /** @var MethodTypeSpecifyingExtension[][]|null */ diff --git a/src/Analyser/TypeSpecifierContext.php b/src/Analyser/TypeSpecifierContext.php index a14aba7112..3cd0ead0f9 100644 --- a/src/Analyser/TypeSpecifierContext.php +++ b/src/Analyser/TypeSpecifierContext.php @@ -4,7 +4,10 @@ use PHPStan\ShouldNotHappenException; -/** @api */ +/** + * @api + * @final + */ class TypeSpecifierContext { diff --git a/src/Analyser/TypeSpecifierFactory.php b/src/Analyser/TypeSpecifierFactory.php index eddf559900..60219c3b6d 100644 --- a/src/Analyser/TypeSpecifierFactory.php +++ b/src/Analyser/TypeSpecifierFactory.php @@ -8,7 +8,7 @@ use PHPStan\Reflection\ReflectionProvider; use function array_merge; -class TypeSpecifierFactory +final class TypeSpecifierFactory { public const FUNCTION_TYPE_SPECIFYING_EXTENSION_TAG = 'phpstan.typeSpecifier.functionTypeSpecifyingExtension'; diff --git a/src/Analyser/UndefinedVariableException.php b/src/Analyser/UndefinedVariableException.php index 6719de349c..4755296c6b 100644 --- a/src/Analyser/UndefinedVariableException.php +++ b/src/Analyser/UndefinedVariableException.php @@ -5,7 +5,7 @@ use PHPStan\AnalysedCodeException; use function sprintf; -class UndefinedVariableException extends AnalysedCodeException +final class UndefinedVariableException extends AnalysedCodeException { public function __construct(private Scope $scope, private string $variableName) diff --git a/src/Broker/AnonymousClassNameHelper.php b/src/Broker/AnonymousClassNameHelper.php index 20e3087b00..ba1c0554fa 100644 --- a/src/Broker/AnonymousClassNameHelper.php +++ b/src/Broker/AnonymousClassNameHelper.php @@ -9,7 +9,7 @@ use function md5; use function sprintf; -class AnonymousClassNameHelper +final class AnonymousClassNameHelper { public function __construct( diff --git a/src/Broker/Broker.php b/src/Broker/Broker.php index fee5eab88d..8db42d1f45 100644 --- a/src/Broker/Broker.php +++ b/src/Broker/Broker.php @@ -11,7 +11,10 @@ use PHPStan\Reflection\ReflectionProvider; use PHPStan\ShouldNotHappenException; -/** @api */ +/** + * @api + * @final + */ class Broker implements ReflectionProvider { diff --git a/src/Broker/BrokerFactory.php b/src/Broker/BrokerFactory.php index d35b68e30d..177b6b5843 100644 --- a/src/Broker/BrokerFactory.php +++ b/src/Broker/BrokerFactory.php @@ -5,7 +5,7 @@ use PHPStan\DependencyInjection\Container; use PHPStan\Reflection\ReflectionProvider; -class BrokerFactory +final class BrokerFactory { public const PROPERTIES_CLASS_REFLECTION_EXTENSION_TAG = 'phpstan.broker.propertiesClassReflectionExtension'; diff --git a/src/Broker/ClassAutoloadingException.php b/src/Broker/ClassAutoloadingException.php index 23e99fe5a5..5451987023 100644 --- a/src/Broker/ClassAutoloadingException.php +++ b/src/Broker/ClassAutoloadingException.php @@ -7,7 +7,7 @@ use function get_class; use function sprintf; -class ClassAutoloadingException extends AnalysedCodeException +final class ClassAutoloadingException extends AnalysedCodeException { private string $className; @@ -39,7 +39,7 @@ public function getClassName(): string return $this->className; } - public function getTip(): ?string + public function getTip(): string { return 'Learn more at https://phpstan.org/user-guide/discovering-symbols'; } diff --git a/src/Broker/ClassNotFoundException.php b/src/Broker/ClassNotFoundException.php index d86a1bcb08..1276d663ff 100644 --- a/src/Broker/ClassNotFoundException.php +++ b/src/Broker/ClassNotFoundException.php @@ -5,7 +5,7 @@ use PHPStan\AnalysedCodeException; use function sprintf; -class ClassNotFoundException extends AnalysedCodeException +final class ClassNotFoundException extends AnalysedCodeException { public function __construct(private string $className) @@ -18,7 +18,7 @@ public function getClassName(): string return $this->className; } - public function getTip(): ?string + public function getTip(): string { return 'Learn more at https://phpstan.org/user-guide/discovering-symbols'; } diff --git a/src/Broker/ConstantNotFoundException.php b/src/Broker/ConstantNotFoundException.php index 2c490e3653..5d633de380 100644 --- a/src/Broker/ConstantNotFoundException.php +++ b/src/Broker/ConstantNotFoundException.php @@ -5,7 +5,7 @@ use PHPStan\AnalysedCodeException; use function sprintf; -class ConstantNotFoundException extends AnalysedCodeException +final class ConstantNotFoundException extends AnalysedCodeException { public function __construct(private string $constantName) @@ -18,7 +18,7 @@ public function getConstantName(): string return $this->constantName; } - public function getTip(): ?string + public function getTip(): string { return 'Learn more at https://phpstan.org/user-guide/discovering-symbols'; } diff --git a/src/Broker/FunctionNotFoundException.php b/src/Broker/FunctionNotFoundException.php index de2728001f..a313b60e2a 100644 --- a/src/Broker/FunctionNotFoundException.php +++ b/src/Broker/FunctionNotFoundException.php @@ -5,7 +5,7 @@ use PHPStan\AnalysedCodeException; use function sprintf; -class FunctionNotFoundException extends AnalysedCodeException +final class FunctionNotFoundException extends AnalysedCodeException { public function __construct(private string $functionName) @@ -18,7 +18,7 @@ public function getFunctionName(): string return $this->functionName; } - public function getTip(): ?string + public function getTip(): string { return 'Learn more at https://phpstan.org/user-guide/discovering-symbols'; } diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php index 0180ab6610..a4b66596fa 100644 --- a/src/Cache/Cache.php +++ b/src/Cache/Cache.php @@ -2,7 +2,7 @@ namespace PHPStan\Cache; -class Cache +final class Cache { public function __construct(private CacheStorage $storage) diff --git a/src/Cache/CacheItem.php b/src/Cache/CacheItem.php index 61d9946c90..101bbfe2fd 100644 --- a/src/Cache/CacheItem.php +++ b/src/Cache/CacheItem.php @@ -2,7 +2,7 @@ namespace PHPStan\Cache; -class CacheItem +final class CacheItem { /** diff --git a/src/Cache/FileCacheStorage.php b/src/Cache/FileCacheStorage.php index 38b36d25aa..5ba76a768a 100644 --- a/src/Cache/FileCacheStorage.php +++ b/src/Cache/FileCacheStorage.php @@ -18,7 +18,7 @@ use function var_export; use const DIRECTORY_SEPARATOR; -class FileCacheStorage implements CacheStorage +final class FileCacheStorage implements CacheStorage { public function __construct(private string $directory) diff --git a/src/Cache/MemoryCacheStorage.php b/src/Cache/MemoryCacheStorage.php index 158c285031..324dfcf37f 100644 --- a/src/Cache/MemoryCacheStorage.php +++ b/src/Cache/MemoryCacheStorage.php @@ -4,7 +4,7 @@ use function var_export; -class MemoryCacheStorage implements CacheStorage +final class MemoryCacheStorage implements CacheStorage { /** @var array */ diff --git a/src/Collectors/CollectedData.php b/src/Collectors/CollectedData.php index 76d7bb5fe4..e6817382b6 100644 --- a/src/Collectors/CollectedData.php +++ b/src/Collectors/CollectedData.php @@ -6,7 +6,10 @@ use PhpParser\Node; use ReturnTypeWillChange; -/** @api */ +/** + * @api + * @final + */ class CollectedData implements JsonSerializable { diff --git a/src/Collectors/Registry.php b/src/Collectors/Registry.php index 65b80118b2..11586e3097 100644 --- a/src/Collectors/Registry.php +++ b/src/Collectors/Registry.php @@ -6,7 +6,7 @@ use function class_implements; use function class_parents; -class Registry +final class Registry { /** @var Collector[][] */ diff --git a/src/Collectors/RegistryFactory.php b/src/Collectors/RegistryFactory.php index 0f852d3210..675740d99a 100644 --- a/src/Collectors/RegistryFactory.php +++ b/src/Collectors/RegistryFactory.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class RegistryFactory +final class RegistryFactory { public const COLLECTOR_TAG = 'phpstan.collector'; diff --git a/src/Command/AnalyseApplication.php b/src/Command/AnalyseApplication.php index 85acf2d88c..af739bc02c 100644 --- a/src/Command/AnalyseApplication.php +++ b/src/Command/AnalyseApplication.php @@ -19,7 +19,7 @@ use function sha1_file; use function sprintf; -class AnalyseApplication +final class AnalyseApplication { public function __construct( diff --git a/src/Command/AnalyseCommand.php b/src/Command/AnalyseCommand.php index 6ecfba9105..b4d73589a5 100644 --- a/src/Command/AnalyseCommand.php +++ b/src/Command/AnalyseCommand.php @@ -56,7 +56,7 @@ use const PATHINFO_BASENAME; use const PATHINFO_EXTENSION; -class AnalyseCommand extends Command +final class AnalyseCommand extends Command { private const NAME = 'analyse'; diff --git a/src/Command/AnalyserRunner.php b/src/Command/AnalyserRunner.php index da6eb42962..5b88529382 100644 --- a/src/Command/AnalyserRunner.php +++ b/src/Command/AnalyserRunner.php @@ -16,7 +16,7 @@ use function is_file; use function memory_get_peak_usage; -class AnalyserRunner +final class AnalyserRunner { public function __construct( diff --git a/src/Command/AnalysisResult.php b/src/Command/AnalysisResult.php index f7c4424284..6ddf536bc1 100644 --- a/src/Command/AnalysisResult.php +++ b/src/Command/AnalysisResult.php @@ -9,7 +9,10 @@ use function count; use function usort; -/** @api */ +/** + * @api + * @final + */ class AnalysisResult { diff --git a/src/Command/ClearResultCacheCommand.php b/src/Command/ClearResultCacheCommand.php index 30c59100ec..89e3c45ee7 100644 --- a/src/Command/ClearResultCacheCommand.php +++ b/src/Command/ClearResultCacheCommand.php @@ -11,7 +11,7 @@ use function is_bool; use function is_string; -class ClearResultCacheCommand extends Command +final class ClearResultCacheCommand extends Command { private const NAME = 'clear-result-cache'; diff --git a/src/Command/CommandHelper.php b/src/Command/CommandHelper.php index d38aee7f23..10abe7d23d 100644 --- a/src/Command/CommandHelper.php +++ b/src/Command/CommandHelper.php @@ -64,7 +64,7 @@ use const E_ERROR; use const PHP_VERSION_ID; -class CommandHelper +final class CommandHelper { public const DEFAULT_LEVEL = '0'; diff --git a/src/Command/DiagnoseCommand.php b/src/Command/DiagnoseCommand.php index 608cf732f1..2f8a5a47b0 100644 --- a/src/Command/DiagnoseCommand.php +++ b/src/Command/DiagnoseCommand.php @@ -11,7 +11,7 @@ use Symfony\Component\Console\Output\OutputInterface; use function is_string; -class DiagnoseCommand extends Command +final class DiagnoseCommand extends Command { private const NAME = 'diagnose'; diff --git a/src/Command/DumpParametersCommand.php b/src/Command/DumpParametersCommand.php index 50e6e57b4b..b3085db0c6 100644 --- a/src/Command/DumpParametersCommand.php +++ b/src/Command/DumpParametersCommand.php @@ -11,7 +11,7 @@ use Symfony\Component\Console\Output\OutputInterface; use function is_string; -class DumpParametersCommand extends Command +final class DumpParametersCommand extends Command { private const NAME = 'dump-parameters'; diff --git a/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php b/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php index 545eeed111..b6dd1e2c2f 100644 --- a/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php +++ b/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php @@ -14,7 +14,7 @@ use function substr; use const SORT_STRING; -class BaselineNeonErrorFormatter +final class BaselineNeonErrorFormatter { public function __construct(private RelativePathHelper $relativePathHelper) diff --git a/src/Command/ErrorFormatter/BaselinePhpErrorFormatter.php b/src/Command/ErrorFormatter/BaselinePhpErrorFormatter.php index 0af50dba47..8107aba19b 100644 --- a/src/Command/ErrorFormatter/BaselinePhpErrorFormatter.php +++ b/src/Command/ErrorFormatter/BaselinePhpErrorFormatter.php @@ -16,7 +16,7 @@ use function var_export; use const SORT_STRING; -class BaselinePhpErrorFormatter +final class BaselinePhpErrorFormatter { public function __construct(private RelativePathHelper $relativePathHelper) diff --git a/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php b/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php index cfb2ddc559..9072bd8dd2 100644 --- a/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php +++ b/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php @@ -12,7 +12,7 @@ use const ENT_COMPAT; use const ENT_XML1; -class CheckstyleErrorFormatter implements ErrorFormatter +final class CheckstyleErrorFormatter implements ErrorFormatter { public function __construct(private RelativePathHelper $relativePathHelper) diff --git a/src/Command/ErrorFormatter/CiDetectedErrorFormatter.php b/src/Command/ErrorFormatter/CiDetectedErrorFormatter.php index 541dfd77e3..a6c66bbafb 100644 --- a/src/Command/ErrorFormatter/CiDetectedErrorFormatter.php +++ b/src/Command/ErrorFormatter/CiDetectedErrorFormatter.php @@ -7,7 +7,10 @@ use PHPStan\Command\AnalysisResult; use PHPStan\Command\Output; -/** @api */ +/** + * @api + * @final + */ class CiDetectedErrorFormatter implements ErrorFormatter { diff --git a/src/Command/ErrorFormatter/GithubErrorFormatter.php b/src/Command/ErrorFormatter/GithubErrorFormatter.php index 03dc1aa8d0..21ffdd2650 100644 --- a/src/Command/ErrorFormatter/GithubErrorFormatter.php +++ b/src/Command/ErrorFormatter/GithubErrorFormatter.php @@ -14,7 +14,7 @@ * Allow errors to be reported in pull-requests diff when run in a GitHub Action * @see https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message */ -class GithubErrorFormatter implements ErrorFormatter +final class GithubErrorFormatter implements ErrorFormatter { public function __construct( diff --git a/src/Command/ErrorFormatter/GitlabErrorFormatter.php b/src/Command/ErrorFormatter/GitlabErrorFormatter.php index 6aa4b61bef..9a8ccb35cd 100644 --- a/src/Command/ErrorFormatter/GitlabErrorFormatter.php +++ b/src/Command/ErrorFormatter/GitlabErrorFormatter.php @@ -12,7 +12,7 @@ /** * @see https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool */ -class GitlabErrorFormatter implements ErrorFormatter +final class GitlabErrorFormatter implements ErrorFormatter { public function __construct(private RelativePathHelper $relativePathHelper) diff --git a/src/Command/ErrorFormatter/JsonErrorFormatter.php b/src/Command/ErrorFormatter/JsonErrorFormatter.php index 9f9f1edcfb..a46396f12c 100644 --- a/src/Command/ErrorFormatter/JsonErrorFormatter.php +++ b/src/Command/ErrorFormatter/JsonErrorFormatter.php @@ -9,7 +9,7 @@ use function array_key_exists; use function count; -class JsonErrorFormatter implements ErrorFormatter +final class JsonErrorFormatter implements ErrorFormatter { public function __construct(private bool $pretty) diff --git a/src/Command/ErrorFormatter/JunitErrorFormatter.php b/src/Command/ErrorFormatter/JunitErrorFormatter.php index b7562f4733..59131dcf01 100644 --- a/src/Command/ErrorFormatter/JunitErrorFormatter.php +++ b/src/Command/ErrorFormatter/JunitErrorFormatter.php @@ -10,7 +10,7 @@ use const ENT_COMPAT; use const ENT_XML1; -class JunitErrorFormatter implements ErrorFormatter +final class JunitErrorFormatter implements ErrorFormatter { public function __construct(private RelativePathHelper $relativePathHelper) diff --git a/src/Command/ErrorFormatter/RawErrorFormatter.php b/src/Command/ErrorFormatter/RawErrorFormatter.php index add31fa48f..f761a5a47e 100644 --- a/src/Command/ErrorFormatter/RawErrorFormatter.php +++ b/src/Command/ErrorFormatter/RawErrorFormatter.php @@ -6,7 +6,7 @@ use PHPStan\Command\Output; use function sprintf; -class RawErrorFormatter implements ErrorFormatter +final class RawErrorFormatter implements ErrorFormatter { public function formatErrors( diff --git a/src/Command/ErrorFormatter/TableErrorFormatter.php b/src/Command/ErrorFormatter/TableErrorFormatter.php index eb040735d0..fb3d949c4e 100644 --- a/src/Command/ErrorFormatter/TableErrorFormatter.php +++ b/src/Command/ErrorFormatter/TableErrorFormatter.php @@ -21,7 +21,7 @@ use function str_contains; use function str_replace; -class TableErrorFormatter implements ErrorFormatter +final class TableErrorFormatter implements ErrorFormatter { public function __construct( diff --git a/src/Command/ErrorFormatter/TeamcityErrorFormatter.php b/src/Command/ErrorFormatter/TeamcityErrorFormatter.php index a6e6e2cf32..8ea1d5bb1e 100644 --- a/src/Command/ErrorFormatter/TeamcityErrorFormatter.php +++ b/src/Command/ErrorFormatter/TeamcityErrorFormatter.php @@ -15,7 +15,7 @@ /** * @see https://www.jetbrains.com/help/teamcity/build-script-interaction-with-teamcity.html#Reporting+Inspections */ -class TeamcityErrorFormatter implements ErrorFormatter +final class TeamcityErrorFormatter implements ErrorFormatter { public function __construct(private RelativePathHelper $relativePathHelper) diff --git a/src/Command/ErrorsConsoleStyle.php b/src/Command/ErrorsConsoleStyle.php index 520ce7add3..f953d40c49 100644 --- a/src/Command/ErrorsConsoleStyle.php +++ b/src/Command/ErrorsConsoleStyle.php @@ -18,7 +18,7 @@ use function wordwrap; use const DIRECTORY_SEPARATOR; -class ErrorsConsoleStyle extends SymfonyStyle +final class ErrorsConsoleStyle extends SymfonyStyle { public const OPTION_NO_PROGRESS = 'no-progress'; diff --git a/src/Command/FixerApplication.php b/src/Command/FixerApplication.php index 75caa6420c..6236c3c63f 100644 --- a/src/Command/FixerApplication.php +++ b/src/Command/FixerApplication.php @@ -63,7 +63,7 @@ use const PHP_URL_PORT; use const PHP_VERSION_ID; -class FixerApplication +final class FixerApplication { /** @var PromiseInterface|null */ diff --git a/src/Command/FixerProcessException.php b/src/Command/FixerProcessException.php index 9473f35716..c9e4097d58 100644 --- a/src/Command/FixerProcessException.php +++ b/src/Command/FixerProcessException.php @@ -4,7 +4,7 @@ use Exception; -class FixerProcessException extends Exception +final class FixerProcessException extends Exception { } diff --git a/src/Command/FixerWorkerCommand.php b/src/Command/FixerWorkerCommand.php index 3cc415b3f4..70a7624453 100644 --- a/src/Command/FixerWorkerCommand.php +++ b/src/Command/FixerWorkerCommand.php @@ -42,7 +42,7 @@ use function usort; use const JSON_INVALID_UTF8_IGNORE; -class FixerWorkerCommand extends Command +final class FixerWorkerCommand extends Command { private const NAME = 'fixer:worker'; diff --git a/src/Command/IgnoredRegexValidator.php b/src/Command/IgnoredRegexValidator.php index e7a90c5bd2..613779b2e6 100644 --- a/src/Command/IgnoredRegexValidator.php +++ b/src/Command/IgnoredRegexValidator.php @@ -17,7 +17,7 @@ use function strrpos; use function substr; -class IgnoredRegexValidator +final class IgnoredRegexValidator { public function __construct( diff --git a/src/Command/IgnoredRegexValidatorResult.php b/src/Command/IgnoredRegexValidatorResult.php index fcda6a015b..0906a3c84b 100644 --- a/src/Command/IgnoredRegexValidatorResult.php +++ b/src/Command/IgnoredRegexValidatorResult.php @@ -2,7 +2,7 @@ namespace PHPStan\Command; -class IgnoredRegexValidatorResult +final class IgnoredRegexValidatorResult { /** diff --git a/src/Command/InceptionNotSuccessfulException.php b/src/Command/InceptionNotSuccessfulException.php index f17c3e08ec..5cbcf4425e 100644 --- a/src/Command/InceptionNotSuccessfulException.php +++ b/src/Command/InceptionNotSuccessfulException.php @@ -4,7 +4,7 @@ use Exception; -class InceptionNotSuccessfulException extends Exception +final class InceptionNotSuccessfulException extends Exception { } diff --git a/src/Command/InceptionResult.php b/src/Command/InceptionResult.php index 14a1d5202d..fc6056eccb 100644 --- a/src/Command/InceptionResult.php +++ b/src/Command/InceptionResult.php @@ -13,7 +13,7 @@ use function round; use function sprintf; -class InceptionResult +final class InceptionResult { /** @var callable(): (array{string[], bool}) */ diff --git a/src/Command/Symfony/SymfonyOutput.php b/src/Command/Symfony/SymfonyOutput.php index 5e1a46273a..7f60d04bfc 100644 --- a/src/Command/Symfony/SymfonyOutput.php +++ b/src/Command/Symfony/SymfonyOutput.php @@ -9,7 +9,7 @@ /** * @internal */ -class SymfonyOutput implements Output +final class SymfonyOutput implements Output { public function __construct( diff --git a/src/Command/Symfony/SymfonyStyle.php b/src/Command/Symfony/SymfonyStyle.php index 99ed87ec33..e8782a5f59 100644 --- a/src/Command/Symfony/SymfonyStyle.php +++ b/src/Command/Symfony/SymfonyStyle.php @@ -8,7 +8,7 @@ /** * @internal */ -class SymfonyStyle implements OutputStyle +final class SymfonyStyle implements OutputStyle { public function __construct(private StyleInterface $symfonyStyle) diff --git a/src/Command/WorkerCommand.php b/src/Command/WorkerCommand.php index 9646518839..6e44a11217 100644 --- a/src/Command/WorkerCommand.php +++ b/src/Command/WorkerCommand.php @@ -32,7 +32,7 @@ use function memory_get_peak_usage; use function sprintf; -class WorkerCommand extends Command +final class WorkerCommand extends Command { private const NAME = 'worker'; diff --git a/src/Dependency/DependencyResolver.php b/src/Dependency/DependencyResolver.php index 0688b5d19e..57a80a5a2e 100644 --- a/src/Dependency/DependencyResolver.php +++ b/src/Dependency/DependencyResolver.php @@ -28,7 +28,7 @@ use function array_merge; use function count; -class DependencyResolver +final class DependencyResolver { public function __construct( diff --git a/src/Dependency/ExportedNode/ExportedAttributeNode.php b/src/Dependency/ExportedNode/ExportedAttributeNode.php index 02714f2f59..5612e74ea1 100644 --- a/src/Dependency/ExportedNode/ExportedAttributeNode.php +++ b/src/Dependency/ExportedNode/ExportedAttributeNode.php @@ -7,7 +7,7 @@ use ReturnTypeWillChange; use function count; -class ExportedAttributeNode implements ExportedNode, JsonSerializable +final class ExportedAttributeNode implements ExportedNode, JsonSerializable { /** diff --git a/src/Dependency/ExportedNode/ExportedClassConstantNode.php b/src/Dependency/ExportedNode/ExportedClassConstantNode.php index aab53925f1..8827656c48 100644 --- a/src/Dependency/ExportedNode/ExportedClassConstantNode.php +++ b/src/Dependency/ExportedNode/ExportedClassConstantNode.php @@ -9,7 +9,7 @@ use function array_map; use function count; -class ExportedClassConstantNode implements ExportedNode, JsonSerializable +final class ExportedClassConstantNode implements ExportedNode, JsonSerializable { /** diff --git a/src/Dependency/ExportedNode/ExportedClassConstantsNode.php b/src/Dependency/ExportedNode/ExportedClassConstantsNode.php index 04bace7282..23ebd61ae0 100644 --- a/src/Dependency/ExportedNode/ExportedClassConstantsNode.php +++ b/src/Dependency/ExportedNode/ExportedClassConstantsNode.php @@ -9,7 +9,7 @@ use function array_map; use function count; -class ExportedClassConstantsNode implements ExportedNode, JsonSerializable +final class ExportedClassConstantsNode implements ExportedNode, JsonSerializable { /** diff --git a/src/Dependency/ExportedNode/ExportedClassNode.php b/src/Dependency/ExportedNode/ExportedClassNode.php index b96096cff2..b420a0a9ad 100644 --- a/src/Dependency/ExportedNode/ExportedClassNode.php +++ b/src/Dependency/ExportedNode/ExportedClassNode.php @@ -10,7 +10,7 @@ use function array_map; use function count; -class ExportedClassNode implements RootExportedNode, JsonSerializable +final class ExportedClassNode implements RootExportedNode, JsonSerializable { /** @@ -171,6 +171,9 @@ public static function decode(array $data): ExportedNode ); } + /** + * @return self::TYPE_CLASS + */ public function getType(): string { return self::TYPE_CLASS; diff --git a/src/Dependency/ExportedNode/ExportedEnumCaseNode.php b/src/Dependency/ExportedNode/ExportedEnumCaseNode.php index da304b5893..19f8f6a22b 100644 --- a/src/Dependency/ExportedNode/ExportedEnumCaseNode.php +++ b/src/Dependency/ExportedNode/ExportedEnumCaseNode.php @@ -6,7 +6,7 @@ use PHPStan\Dependency\ExportedNode; use ReturnTypeWillChange; -class ExportedEnumCaseNode implements ExportedNode, JsonSerializable +final class ExportedEnumCaseNode implements ExportedNode, JsonSerializable { public function __construct(private string $name, private ?string $value, private ?ExportedPhpDocNode $phpDoc) diff --git a/src/Dependency/ExportedNode/ExportedEnumNode.php b/src/Dependency/ExportedNode/ExportedEnumNode.php index 3d75abd627..ea5ce3970b 100644 --- a/src/Dependency/ExportedNode/ExportedEnumNode.php +++ b/src/Dependency/ExportedNode/ExportedEnumNode.php @@ -10,7 +10,7 @@ use function array_map; use function count; -class ExportedEnumNode implements RootExportedNode, JsonSerializable +final class ExportedEnumNode implements RootExportedNode, JsonSerializable { /** @@ -134,6 +134,9 @@ public static function decode(array $data): ExportedNode ); } + /** + * @return self::TYPE_ENUM + */ public function getType(): string { return self::TYPE_ENUM; diff --git a/src/Dependency/ExportedNode/ExportedFunctionNode.php b/src/Dependency/ExportedNode/ExportedFunctionNode.php index fcc0f51ad5..c7e98d3643 100644 --- a/src/Dependency/ExportedNode/ExportedFunctionNode.php +++ b/src/Dependency/ExportedNode/ExportedFunctionNode.php @@ -10,7 +10,7 @@ use function array_map; use function count; -class ExportedFunctionNode implements RootExportedNode, JsonSerializable +final class ExportedFunctionNode implements RootExportedNode, JsonSerializable { /** @@ -133,6 +133,9 @@ public static function decode(array $data): ExportedNode ); } + /** + * @return self::TYPE_FUNCTION + */ public function getType(): string { return self::TYPE_FUNCTION; diff --git a/src/Dependency/ExportedNode/ExportedInterfaceNode.php b/src/Dependency/ExportedNode/ExportedInterfaceNode.php index 394eef707d..ef72841c5e 100644 --- a/src/Dependency/ExportedNode/ExportedInterfaceNode.php +++ b/src/Dependency/ExportedNode/ExportedInterfaceNode.php @@ -9,7 +9,7 @@ use function array_map; use function count; -class ExportedInterfaceNode implements RootExportedNode, JsonSerializable +final class ExportedInterfaceNode implements RootExportedNode, JsonSerializable { /** @@ -103,6 +103,9 @@ public static function decode(array $data): ExportedNode ); } + /** + * @return self::TYPE_INTERFACE + */ public function getType(): string { return self::TYPE_INTERFACE; diff --git a/src/Dependency/ExportedNode/ExportedMethodNode.php b/src/Dependency/ExportedNode/ExportedMethodNode.php index a60a6d205e..817482ef93 100644 --- a/src/Dependency/ExportedNode/ExportedMethodNode.php +++ b/src/Dependency/ExportedNode/ExportedMethodNode.php @@ -9,7 +9,7 @@ use function array_map; use function count; -class ExportedMethodNode implements ExportedNode, JsonSerializable +final class ExportedMethodNode implements ExportedNode, JsonSerializable { /** diff --git a/src/Dependency/ExportedNode/ExportedParameterNode.php b/src/Dependency/ExportedNode/ExportedParameterNode.php index d205afafdb..c4a7769e28 100644 --- a/src/Dependency/ExportedNode/ExportedParameterNode.php +++ b/src/Dependency/ExportedNode/ExportedParameterNode.php @@ -9,7 +9,7 @@ use function array_map; use function count; -class ExportedParameterNode implements ExportedNode, JsonSerializable +final class ExportedParameterNode implements ExportedNode, JsonSerializable { /** diff --git a/src/Dependency/ExportedNode/ExportedPhpDocNode.php b/src/Dependency/ExportedNode/ExportedPhpDocNode.php index 64a37c96a4..a39cb4ef8a 100644 --- a/src/Dependency/ExportedNode/ExportedPhpDocNode.php +++ b/src/Dependency/ExportedNode/ExportedPhpDocNode.php @@ -6,7 +6,7 @@ use PHPStan\Dependency\ExportedNode; use ReturnTypeWillChange; -class ExportedPhpDocNode implements ExportedNode, JsonSerializable +final class ExportedPhpDocNode implements ExportedNode, JsonSerializable { /** diff --git a/src/Dependency/ExportedNode/ExportedPropertiesNode.php b/src/Dependency/ExportedNode/ExportedPropertiesNode.php index c801f25642..de0b4d2b49 100644 --- a/src/Dependency/ExportedNode/ExportedPropertiesNode.php +++ b/src/Dependency/ExportedNode/ExportedPropertiesNode.php @@ -9,7 +9,7 @@ use function array_map; use function count; -class ExportedPropertiesNode implements JsonSerializable, ExportedNode +final class ExportedPropertiesNode implements JsonSerializable, ExportedNode { /** diff --git a/src/Dependency/ExportedNode/ExportedTraitNode.php b/src/Dependency/ExportedNode/ExportedTraitNode.php index f90246ad15..f0f47ae021 100644 --- a/src/Dependency/ExportedNode/ExportedTraitNode.php +++ b/src/Dependency/ExportedNode/ExportedTraitNode.php @@ -7,7 +7,7 @@ use PHPStan\Dependency\RootExportedNode; use ReturnTypeWillChange; -class ExportedTraitNode implements RootExportedNode, JsonSerializable +final class ExportedTraitNode implements RootExportedNode, JsonSerializable { public function __construct(private string $traitName) @@ -51,6 +51,9 @@ public function jsonSerialize() ]; } + /** + * @return self::TYPE_TRAIT + */ public function getType(): string { return self::TYPE_TRAIT; diff --git a/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php b/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php index 57f3491010..38e9227624 100644 --- a/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php +++ b/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php @@ -6,7 +6,7 @@ use PHPStan\Dependency\ExportedNode; use ReturnTypeWillChange; -class ExportedTraitUseAdaptation implements ExportedNode, JsonSerializable +final class ExportedTraitUseAdaptation implements ExportedNode, JsonSerializable { /** diff --git a/src/Dependency/ExportedNodeFetcher.php b/src/Dependency/ExportedNodeFetcher.php index 4d562f1275..dbc36c155a 100644 --- a/src/Dependency/ExportedNodeFetcher.php +++ b/src/Dependency/ExportedNodeFetcher.php @@ -6,7 +6,7 @@ use PHPStan\Parser\Parser; use PHPStan\Parser\ParserErrorsException; -class ExportedNodeFetcher +final class ExportedNodeFetcher { public function __construct( diff --git a/src/Dependency/ExportedNodeResolver.php b/src/Dependency/ExportedNodeResolver.php index 89d532512c..c9a0c52154 100644 --- a/src/Dependency/ExportedNodeResolver.php +++ b/src/Dependency/ExportedNodeResolver.php @@ -28,7 +28,7 @@ use function implode; use function is_string; -class ExportedNodeResolver +final class ExportedNodeResolver { public function __construct(private FileTypeMapper $fileTypeMapper, private ExprPrinter $exprPrinter) diff --git a/src/Dependency/ExportedNodeVisitor.php b/src/Dependency/ExportedNodeVisitor.php index 902ca005d6..90df53887b 100644 --- a/src/Dependency/ExportedNodeVisitor.php +++ b/src/Dependency/ExportedNodeVisitor.php @@ -7,7 +7,7 @@ use PhpParser\NodeVisitorAbstract; use PHPStan\ShouldNotHappenException; -class ExportedNodeVisitor extends NodeVisitorAbstract +final class ExportedNodeVisitor extends NodeVisitorAbstract { private ?string $fileName = null; diff --git a/src/Dependency/NodeDependencies.php b/src/Dependency/NodeDependencies.php index a31a6eeadd..ac30175b35 100644 --- a/src/Dependency/NodeDependencies.php +++ b/src/Dependency/NodeDependencies.php @@ -7,7 +7,7 @@ use PHPStan\Reflection\FunctionReflection; use function array_values; -class NodeDependencies +final class NodeDependencies { /** diff --git a/src/DependencyInjection/BleedingEdgeToggle.php b/src/DependencyInjection/BleedingEdgeToggle.php index f510a64c8d..29170f7fe9 100644 --- a/src/DependencyInjection/BleedingEdgeToggle.php +++ b/src/DependencyInjection/BleedingEdgeToggle.php @@ -2,7 +2,7 @@ namespace PHPStan\DependencyInjection; -class BleedingEdgeToggle +final class BleedingEdgeToggle { private static bool $bleedingEdge = false; diff --git a/src/DependencyInjection/ConditionalTagsExtension.php b/src/DependencyInjection/ConditionalTagsExtension.php index e11f095fda..7c593c43dd 100644 --- a/src/DependencyInjection/ConditionalTagsExtension.php +++ b/src/DependencyInjection/ConditionalTagsExtension.php @@ -24,7 +24,7 @@ use function is_array; use function sprintf; -class ConditionalTagsExtension extends CompilerExtension +final class ConditionalTagsExtension extends CompilerExtension { public function getConfigSchema(): Nette\Schema\Schema diff --git a/src/DependencyInjection/Configurator.php b/src/DependencyInjection/Configurator.php index 1c8b1e7bc6..31886c52bf 100644 --- a/src/DependencyInjection/Configurator.php +++ b/src/DependencyInjection/Configurator.php @@ -15,7 +15,7 @@ use const PHP_RELEASE_VERSION; use const PHP_VERSION_ID; -class Configurator extends \Nette\Bootstrap\Configurator +final class Configurator extends \Nette\Bootstrap\Configurator { /** @var string[] */ diff --git a/src/DependencyInjection/ContainerFactory.php b/src/DependencyInjection/ContainerFactory.php index cb3bf3006a..5c8dad2f23 100644 --- a/src/DependencyInjection/ContainerFactory.php +++ b/src/DependencyInjection/ContainerFactory.php @@ -55,7 +55,10 @@ use function time; use function unlink; -/** @api */ +/** + * @api + * @final + */ class ContainerFactory { diff --git a/src/DependencyInjection/DerivativeContainerFactory.php b/src/DependencyInjection/DerivativeContainerFactory.php index 48270f714d..a32bc2eb6a 100644 --- a/src/DependencyInjection/DerivativeContainerFactory.php +++ b/src/DependencyInjection/DerivativeContainerFactory.php @@ -4,7 +4,7 @@ use function array_merge; -class DerivativeContainerFactory +final class DerivativeContainerFactory { /** diff --git a/src/DependencyInjection/DuplicateIncludedFilesException.php b/src/DependencyInjection/DuplicateIncludedFilesException.php index 13ea681636..e377e42553 100644 --- a/src/DependencyInjection/DuplicateIncludedFilesException.php +++ b/src/DependencyInjection/DuplicateIncludedFilesException.php @@ -6,7 +6,7 @@ use function implode; use function sprintf; -class DuplicateIncludedFilesException extends Exception +final class DuplicateIncludedFilesException extends Exception { /** diff --git a/src/DependencyInjection/InvalidIgnoredErrorPatternsException.php b/src/DependencyInjection/InvalidIgnoredErrorPatternsException.php index dd9258c64d..bd4f2466a1 100644 --- a/src/DependencyInjection/InvalidIgnoredErrorPatternsException.php +++ b/src/DependencyInjection/InvalidIgnoredErrorPatternsException.php @@ -5,7 +5,7 @@ use Exception; use function implode; -class InvalidIgnoredErrorPatternsException extends Exception +final class InvalidIgnoredErrorPatternsException extends Exception { /** diff --git a/src/DependencyInjection/LoaderFactory.php b/src/DependencyInjection/LoaderFactory.php index 600fede435..6053ca5828 100644 --- a/src/DependencyInjection/LoaderFactory.php +++ b/src/DependencyInjection/LoaderFactory.php @@ -6,7 +6,7 @@ use PHPStan\File\FileHelper; use function getenv; -class LoaderFactory +final class LoaderFactory { public function __construct( diff --git a/src/DependencyInjection/MemoizingContainer.php b/src/DependencyInjection/MemoizingContainer.php index 07e92fbac5..bdd24bf291 100644 --- a/src/DependencyInjection/MemoizingContainer.php +++ b/src/DependencyInjection/MemoizingContainer.php @@ -4,7 +4,7 @@ use function array_key_exists; -class MemoizingContainer implements Container +final class MemoizingContainer implements Container { /** @var array */ diff --git a/src/DependencyInjection/NeonAdapter.php b/src/DependencyInjection/NeonAdapter.php index 15fb210b33..15f4ab8384 100644 --- a/src/DependencyInjection/NeonAdapter.php +++ b/src/DependencyInjection/NeonAdapter.php @@ -26,7 +26,7 @@ use function str_starts_with; use function substr; -class NeonAdapter implements Adapter +final class NeonAdapter implements Adapter { public const CACHE_KEY = 'v25-nette-di-again'; diff --git a/src/DependencyInjection/NeonLoader.php b/src/DependencyInjection/NeonLoader.php index 4f797d1af7..010b80cfab 100644 --- a/src/DependencyInjection/NeonLoader.php +++ b/src/DependencyInjection/NeonLoader.php @@ -5,7 +5,7 @@ use Nette\DI\Config\Loader; use PHPStan\File\FileHelper; -class NeonLoader extends Loader +final class NeonLoader extends Loader { public function __construct( diff --git a/src/DependencyInjection/Nette/NetteContainer.php b/src/DependencyInjection/Nette/NetteContainer.php index b5e488ca32..7546993297 100644 --- a/src/DependencyInjection/Nette/NetteContainer.php +++ b/src/DependencyInjection/Nette/NetteContainer.php @@ -11,7 +11,7 @@ /** * @internal */ -class NetteContainer implements Container +final class NetteContainer implements Container { public function __construct(private \Nette\DI\Container $container) diff --git a/src/DependencyInjection/ParameterNotFoundException.php b/src/DependencyInjection/ParameterNotFoundException.php index 07a92a376f..ad461ddef5 100644 --- a/src/DependencyInjection/ParameterNotFoundException.php +++ b/src/DependencyInjection/ParameterNotFoundException.php @@ -5,7 +5,7 @@ use Exception; use function sprintf; -class ParameterNotFoundException extends Exception +final class ParameterNotFoundException extends Exception { public function __construct(string $parameterName) diff --git a/src/DependencyInjection/ParametersSchemaExtension.php b/src/DependencyInjection/ParametersSchemaExtension.php index 2b19bafe56..9a703ed8e9 100644 --- a/src/DependencyInjection/ParametersSchemaExtension.php +++ b/src/DependencyInjection/ParametersSchemaExtension.php @@ -7,7 +7,7 @@ use Nette\Schema\Expect; use Nette\Schema\Schema; -class ParametersSchemaExtension extends CompilerExtension +final class ParametersSchemaExtension extends CompilerExtension { public function getConfigSchema(): Schema diff --git a/src/DependencyInjection/ProjectConfigHelper.php b/src/DependencyInjection/ProjectConfigHelper.php index 0ac6ef97a2..47e8481399 100644 --- a/src/DependencyInjection/ProjectConfigHelper.php +++ b/src/DependencyInjection/ProjectConfigHelper.php @@ -9,7 +9,7 @@ use function is_array; use function is_string; -class ProjectConfigHelper +final class ProjectConfigHelper { /** diff --git a/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php b/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php index 899b9153d4..34b91d99a5 100644 --- a/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php +++ b/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php @@ -13,7 +13,7 @@ use PHPStan\Reflection\RequireExtension\RequireExtendsPropertiesClassReflectionExtension; use function array_merge; -class LazyClassReflectionExtensionRegistryProvider implements ClassReflectionExtensionRegistryProvider +final class LazyClassReflectionExtensionRegistryProvider implements ClassReflectionExtensionRegistryProvider { private ?ClassReflectionExtensionRegistry $registry = null; diff --git a/src/DependencyInjection/RulesExtension.php b/src/DependencyInjection/RulesExtension.php index 0c15bfb8b9..f38caac26d 100644 --- a/src/DependencyInjection/RulesExtension.php +++ b/src/DependencyInjection/RulesExtension.php @@ -7,7 +7,7 @@ use Nette\Schema\Schema; use PHPStan\Rules\LazyRegistry; -class RulesExtension extends CompilerExtension +final class RulesExtension extends CompilerExtension { public function getConfigSchema(): Schema diff --git a/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php b/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php index f992ad9ddf..9a15af910f 100644 --- a/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php +++ b/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php @@ -8,7 +8,7 @@ use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\DynamicReturnTypeExtensionRegistry; -class LazyDynamicReturnTypeExtensionRegistryProvider implements DynamicReturnTypeExtensionRegistryProvider +final class LazyDynamicReturnTypeExtensionRegistryProvider implements DynamicReturnTypeExtensionRegistryProvider { private ?DynamicReturnTypeExtensionRegistry $registry = null; diff --git a/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php b/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php index 4696fb8b21..0eb55cbf5b 100644 --- a/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php +++ b/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyDynamicThrowTypeExtensionProvider implements DynamicThrowTypeExtensionProvider +final class LazyDynamicThrowTypeExtensionProvider implements DynamicThrowTypeExtensionProvider { public const FUNCTION_TAG = 'phpstan.dynamicFunctionThrowTypeExtension'; diff --git a/src/DependencyInjection/Type/LazyExpressionTypeResolverExtensionRegistryProvider.php b/src/DependencyInjection/Type/LazyExpressionTypeResolverExtensionRegistryProvider.php index 43910f8668..7136eb40d3 100644 --- a/src/DependencyInjection/Type/LazyExpressionTypeResolverExtensionRegistryProvider.php +++ b/src/DependencyInjection/Type/LazyExpressionTypeResolverExtensionRegistryProvider.php @@ -6,7 +6,7 @@ use PHPStan\DependencyInjection\Container; use PHPStan\Type\ExpressionTypeResolverExtensionRegistry; -class LazyExpressionTypeResolverExtensionRegistryProvider implements ExpressionTypeResolverExtensionRegistryProvider +final class LazyExpressionTypeResolverExtensionRegistryProvider implements ExpressionTypeResolverExtensionRegistryProvider { private ?ExpressionTypeResolverExtensionRegistry $registry = null; diff --git a/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php b/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php index 22e356fe70..5f1a719b48 100644 --- a/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php +++ b/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php @@ -7,7 +7,7 @@ use PHPStan\DependencyInjection\Container; use PHPStan\Type\OperatorTypeSpecifyingExtensionRegistry; -class LazyOperatorTypeSpecifyingExtensionRegistryProvider implements OperatorTypeSpecifyingExtensionRegistryProvider +final class LazyOperatorTypeSpecifyingExtensionRegistryProvider implements OperatorTypeSpecifyingExtensionRegistryProvider { private ?OperatorTypeSpecifyingExtensionRegistry $registry = null; diff --git a/src/DependencyInjection/Type/LazyParameterClosureTypeExtensionProvider.php b/src/DependencyInjection/Type/LazyParameterClosureTypeExtensionProvider.php index 9b1db71fc5..b2877e5993 100644 --- a/src/DependencyInjection/Type/LazyParameterClosureTypeExtensionProvider.php +++ b/src/DependencyInjection/Type/LazyParameterClosureTypeExtensionProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyParameterClosureTypeExtensionProvider implements ParameterClosureTypeExtensionProvider +final class LazyParameterClosureTypeExtensionProvider implements ParameterClosureTypeExtensionProvider { public const FUNCTION_TAG = 'phpstan.functionParameterClosureTypeExtension'; diff --git a/src/DependencyInjection/Type/LazyParameterOutTypeExtensionProvider.php b/src/DependencyInjection/Type/LazyParameterOutTypeExtensionProvider.php index 3cf13bf0ba..5fa75939c5 100644 --- a/src/DependencyInjection/Type/LazyParameterOutTypeExtensionProvider.php +++ b/src/DependencyInjection/Type/LazyParameterOutTypeExtensionProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyParameterOutTypeExtensionProvider implements ParameterOutTypeExtensionProvider +final class LazyParameterOutTypeExtensionProvider implements ParameterOutTypeExtensionProvider { public const FUNCTION_TAG = 'phpstan.functionParameterOutTypeExtension'; diff --git a/src/DependencyInjection/ValidateIgnoredErrorsExtension.php b/src/DependencyInjection/ValidateIgnoredErrorsExtension.php index cd93ab2247..8a429629fd 100644 --- a/src/DependencyInjection/ValidateIgnoredErrorsExtension.php +++ b/src/DependencyInjection/ValidateIgnoredErrorsExtension.php @@ -37,7 +37,7 @@ use function sprintf; use const PHP_VERSION_ID; -class ValidateIgnoredErrorsExtension extends CompilerExtension +final class ValidateIgnoredErrorsExtension extends CompilerExtension { /** diff --git a/src/Diagnose/PHPStanDiagnoseExtension.php b/src/Diagnose/PHPStanDiagnoseExtension.php index 0873b4f802..5d336b845d 100644 --- a/src/Diagnose/PHPStanDiagnoseExtension.php +++ b/src/Diagnose/PHPStanDiagnoseExtension.php @@ -14,7 +14,7 @@ use function sprintf; use const PHP_VERSION_ID; -class PHPStanDiagnoseExtension implements DiagnoseExtension +final class PHPStanDiagnoseExtension implements DiagnoseExtension { /** diff --git a/src/File/CouldNotReadFileException.php b/src/File/CouldNotReadFileException.php index 5803fd53df..63d5a2e41d 100644 --- a/src/File/CouldNotReadFileException.php +++ b/src/File/CouldNotReadFileException.php @@ -5,7 +5,7 @@ use PHPStan\AnalysedCodeException; use function sprintf; -class CouldNotReadFileException extends AnalysedCodeException +final class CouldNotReadFileException extends AnalysedCodeException { public function __construct(string $fileName) diff --git a/src/File/CouldNotWriteFileException.php b/src/File/CouldNotWriteFileException.php index 0fffa54dcf..72e00464b7 100644 --- a/src/File/CouldNotWriteFileException.php +++ b/src/File/CouldNotWriteFileException.php @@ -5,7 +5,7 @@ use PHPStan\AnalysedCodeException; use function sprintf; -class CouldNotWriteFileException extends AnalysedCodeException +final class CouldNotWriteFileException extends AnalysedCodeException { public function __construct(string $fileName, string $error) diff --git a/src/File/FileExcluder.php b/src/File/FileExcluder.php index 2ea5271d5d..9a7db5cbd8 100644 --- a/src/File/FileExcluder.php +++ b/src/File/FileExcluder.php @@ -11,7 +11,7 @@ use const FNM_CASEFOLD; use const FNM_NOESCAPE; -class FileExcluder +final class FileExcluder { /** diff --git a/src/File/FileExcluderFactory.php b/src/File/FileExcluderFactory.php index 26976a3dfb..c15b426f6e 100644 --- a/src/File/FileExcluderFactory.php +++ b/src/File/FileExcluderFactory.php @@ -7,7 +7,7 @@ use function array_unique; use function array_values; -class FileExcluderFactory +final class FileExcluderFactory { /** diff --git a/src/File/FileFinder.php b/src/File/FileFinder.php index 6ca9db6ddd..34ab2c5a16 100644 --- a/src/File/FileFinder.php +++ b/src/File/FileFinder.php @@ -10,7 +10,7 @@ use function implode; use function is_file; -class FileFinder +final class FileFinder { /** diff --git a/src/File/FileFinderResult.php b/src/File/FileFinderResult.php index d88bcbb84c..7ae7634c96 100644 --- a/src/File/FileFinderResult.php +++ b/src/File/FileFinderResult.php @@ -2,7 +2,7 @@ namespace PHPStan\File; -class FileFinderResult +final class FileFinderResult { /** diff --git a/src/File/FileHelper.php b/src/File/FileHelper.php index 06bca961f3..32fad2d253 100644 --- a/src/File/FileHelper.php +++ b/src/File/FileHelper.php @@ -18,7 +18,7 @@ use function trim; use const DIRECTORY_SEPARATOR; -class FileHelper +final class FileHelper { private string $workingDirectory; diff --git a/src/File/FileMonitor.php b/src/File/FileMonitor.php index 26e27454ff..6fd0eaf8ef 100644 --- a/src/File/FileMonitor.php +++ b/src/File/FileMonitor.php @@ -8,7 +8,7 @@ use function count; use function sha1_file; -class FileMonitor +final class FileMonitor { /** @var array|null */ diff --git a/src/File/FileMonitorResult.php b/src/File/FileMonitorResult.php index 940c21e965..8c7e405dc0 100644 --- a/src/File/FileMonitorResult.php +++ b/src/File/FileMonitorResult.php @@ -4,7 +4,7 @@ use function count; -class FileMonitorResult +final class FileMonitorResult { /** diff --git a/src/File/FileReader.php b/src/File/FileReader.php index 46f8933916..7f5a8dc369 100644 --- a/src/File/FileReader.php +++ b/src/File/FileReader.php @@ -5,7 +5,7 @@ use function file_get_contents; use function stream_resolve_include_path; -class FileReader +final class FileReader { /** diff --git a/src/File/FileWriter.php b/src/File/FileWriter.php index 2a40c35bb1..b3659d9536 100644 --- a/src/File/FileWriter.php +++ b/src/File/FileWriter.php @@ -5,7 +5,7 @@ use function error_get_last; use function file_put_contents; -class FileWriter +final class FileWriter { public static function write(string $fileName, string $contents): void diff --git a/src/File/FuzzyRelativePathHelper.php b/src/File/FuzzyRelativePathHelper.php index dc2d44e505..cf56ee124a 100644 --- a/src/File/FuzzyRelativePathHelper.php +++ b/src/File/FuzzyRelativePathHelper.php @@ -14,7 +14,7 @@ use function substr; use const DIRECTORY_SEPARATOR; -class FuzzyRelativePathHelper implements RelativePathHelper +final class FuzzyRelativePathHelper implements RelativePathHelper { private string $directorySeparator; diff --git a/src/File/NullRelativePathHelper.php b/src/File/NullRelativePathHelper.php index 1556984a90..5e5a07dc62 100644 --- a/src/File/NullRelativePathHelper.php +++ b/src/File/NullRelativePathHelper.php @@ -2,7 +2,7 @@ namespace PHPStan\File; -class NullRelativePathHelper implements RelativePathHelper +final class NullRelativePathHelper implements RelativePathHelper { public function getRelativePath(string $filename): string diff --git a/src/File/ParentDirectoryRelativePathHelper.php b/src/File/ParentDirectoryRelativePathHelper.php index 218d4597fc..7654b3ce1e 100644 --- a/src/File/ParentDirectoryRelativePathHelper.php +++ b/src/File/ParentDirectoryRelativePathHelper.php @@ -14,7 +14,7 @@ use function substr; use function trim; -class ParentDirectoryRelativePathHelper implements RelativePathHelper +final class ParentDirectoryRelativePathHelper implements RelativePathHelper { public function __construct(private string $parentDirectory) diff --git a/src/File/PathNotFoundException.php b/src/File/PathNotFoundException.php index fb8f4dd191..b58cda6e15 100644 --- a/src/File/PathNotFoundException.php +++ b/src/File/PathNotFoundException.php @@ -5,7 +5,7 @@ use Exception; use function sprintf; -class PathNotFoundException extends Exception +final class PathNotFoundException extends Exception { public function __construct(private string $path) diff --git a/src/File/SimpleRelativePathHelper.php b/src/File/SimpleRelativePathHelper.php index 854f584b47..eff28f5541 100644 --- a/src/File/SimpleRelativePathHelper.php +++ b/src/File/SimpleRelativePathHelper.php @@ -7,7 +7,7 @@ use function strlen; use function substr; -class SimpleRelativePathHelper implements RelativePathHelper +final class SimpleRelativePathHelper implements RelativePathHelper { public function __construct(private string $currentWorkingDirectory) diff --git a/src/File/SystemAgnosticSimpleRelativePathHelper.php b/src/File/SystemAgnosticSimpleRelativePathHelper.php index d040956fb2..bd4ac68d67 100644 --- a/src/File/SystemAgnosticSimpleRelativePathHelper.php +++ b/src/File/SystemAgnosticSimpleRelativePathHelper.php @@ -6,7 +6,7 @@ use function strlen; use function substr; -class SystemAgnosticSimpleRelativePathHelper implements RelativePathHelper +final class SystemAgnosticSimpleRelativePathHelper implements RelativePathHelper { public function __construct(private FileHelper $fileHelper) diff --git a/src/Internal/BytesHelper.php b/src/Internal/BytesHelper.php index 48a852c0a3..3279501f51 100644 --- a/src/Internal/BytesHelper.php +++ b/src/Internal/BytesHelper.php @@ -7,7 +7,7 @@ use function end; use function round; -class BytesHelper +final class BytesHelper { public static function bytes(int $bytes): string diff --git a/src/Internal/ContainerDynamicReturnTypeExtension.php b/src/Internal/ContainerDynamicReturnTypeExtension.php index f4b0a340bb..7ca1a0a70b 100644 --- a/src/Internal/ContainerDynamicReturnTypeExtension.php +++ b/src/Internal/ContainerDynamicReturnTypeExtension.php @@ -15,7 +15,7 @@ use function count; use function in_array; -class ContainerDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class ContainerDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Internal/SprintfHelper.php b/src/Internal/SprintfHelper.php index 30d08500fa..6938c898f1 100644 --- a/src/Internal/SprintfHelper.php +++ b/src/Internal/SprintfHelper.php @@ -4,7 +4,7 @@ use function str_replace; -class SprintfHelper +final class SprintfHelper { public static function escapeFormatString(string $format): string diff --git a/src/Node/BooleanAndNode.php b/src/Node/BooleanAndNode.php index 55573e7eb8..6d508713e7 100644 --- a/src/Node/BooleanAndNode.php +++ b/src/Node/BooleanAndNode.php @@ -7,7 +7,10 @@ use PhpParser\Node\Expr\BinaryOp\LogicalAnd; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class BooleanAndNode extends Expr implements VirtualNode { diff --git a/src/Node/BooleanOrNode.php b/src/Node/BooleanOrNode.php index 0c1523e60b..ca327164ee 100644 --- a/src/Node/BooleanOrNode.php +++ b/src/Node/BooleanOrNode.php @@ -7,7 +7,10 @@ use PhpParser\Node\Expr\BinaryOp\LogicalOr; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class BooleanOrNode extends Expr implements VirtualNode { diff --git a/src/Node/BreaklessWhileLoopNode.php b/src/Node/BreaklessWhileLoopNode.php index 8a824778bc..3d3ff248a2 100644 --- a/src/Node/BreaklessWhileLoopNode.php +++ b/src/Node/BreaklessWhileLoopNode.php @@ -6,7 +6,10 @@ use PhpParser\NodeAbstract; use PHPStan\Analyser\StatementExitPoint; -/** @api */ +/** + * @api + * @final + */ class BreaklessWhileLoopNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/CatchWithUnthrownExceptionNode.php b/src/Node/CatchWithUnthrownExceptionNode.php index 007fa83218..d1872895dd 100644 --- a/src/Node/CatchWithUnthrownExceptionNode.php +++ b/src/Node/CatchWithUnthrownExceptionNode.php @@ -6,7 +6,10 @@ use PhpParser\NodeAbstract; use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class CatchWithUnthrownExceptionNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/ClassConstantsNode.php b/src/Node/ClassConstantsNode.php index dee7d0019a..0b12946d8c 100644 --- a/src/Node/ClassConstantsNode.php +++ b/src/Node/ClassConstantsNode.php @@ -8,7 +8,10 @@ use PHPStan\Node\Constant\ClassConstantFetch; use PHPStan\Reflection\ClassReflection; -/** @api */ +/** + * @api + * @final + */ class ClassConstantsNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/ClassMethod.php b/src/Node/ClassMethod.php index 6ecfaeead8..e3f2cef221 100644 --- a/src/Node/ClassMethod.php +++ b/src/Node/ClassMethod.php @@ -4,7 +4,10 @@ use PhpParser\Node\Stmt\ClassMethod as PhpParserClassMethod; -/** @api */ +/** + * @api + * @final + */ class ClassMethod extends PhpParserClassMethod { diff --git a/src/Node/ClassMethodsNode.php b/src/Node/ClassMethodsNode.php index e02620532b..3a8a2df77d 100644 --- a/src/Node/ClassMethodsNode.php +++ b/src/Node/ClassMethodsNode.php @@ -7,7 +7,10 @@ use PHPStan\Node\Method\MethodCall; use PHPStan\Reflection\ClassReflection; -/** @api */ +/** + * @api + * @final + */ class ClassMethodsNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/ClassPropertiesNode.php b/src/Node/ClassPropertiesNode.php index 8d9659a68b..302dab88f6 100644 --- a/src/Node/ClassPropertiesNode.php +++ b/src/Node/ClassPropertiesNode.php @@ -28,7 +28,10 @@ use function in_array; use function strtolower; -/** @api */ +/** + * @api + * @final + */ class ClassPropertiesNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/ClassPropertyNode.php b/src/Node/ClassPropertyNode.php index a7c81ff9d4..d8aaea6218 100644 --- a/src/Node/ClassPropertyNode.php +++ b/src/Node/ClassPropertyNode.php @@ -11,7 +11,10 @@ use PHPStan\Reflection\ClassReflection; use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ClassPropertyNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/ClassStatementsGatherer.php b/src/Node/ClassStatementsGatherer.php index 6b8b2438c3..a344e4349f 100644 --- a/src/Node/ClassStatementsGatherer.php +++ b/src/Node/ClassStatementsGatherer.php @@ -23,7 +23,7 @@ use function in_array; use function strtolower; -class ClassStatementsGatherer +final class ClassStatementsGatherer { private const PROPERTY_ENUMERATING_FUNCTIONS = [ diff --git a/src/Node/ClosureReturnStatementsNode.php b/src/Node/ClosureReturnStatementsNode.php index 0a20615ca8..7231c02e5f 100644 --- a/src/Node/ClosureReturnStatementsNode.php +++ b/src/Node/ClosureReturnStatementsNode.php @@ -11,7 +11,10 @@ use PHPStan\Analyser\StatementResult; use function count; -/** @api */ +/** + * @api + * @final + */ class ClosureReturnStatementsNode extends NodeAbstract implements ReturnStatementsNode { diff --git a/src/Node/CollectedDataNode.php b/src/Node/CollectedDataNode.php index 8f7684e1ec..c02175b246 100644 --- a/src/Node/CollectedDataNode.php +++ b/src/Node/CollectedDataNode.php @@ -8,7 +8,10 @@ use PHPStan\Collectors\Collector; use function array_key_exists; -/** @api */ +/** + * @api + * @final + */ class CollectedDataNode extends NodeAbstract { diff --git a/src/Node/Constant/ClassConstantFetch.php b/src/Node/Constant/ClassConstantFetch.php index 30129007d0..8f23935dd1 100644 --- a/src/Node/Constant/ClassConstantFetch.php +++ b/src/Node/Constant/ClassConstantFetch.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr\ClassConstFetch; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class ClassConstantFetch { diff --git a/src/Node/DoWhileLoopConditionNode.php b/src/Node/DoWhileLoopConditionNode.php index c6cbc86572..89f6c7f4bf 100644 --- a/src/Node/DoWhileLoopConditionNode.php +++ b/src/Node/DoWhileLoopConditionNode.php @@ -6,7 +6,7 @@ use PhpParser\NodeAbstract; use PHPStan\Analyser\StatementExitPoint; -class DoWhileLoopConditionNode extends NodeAbstract implements VirtualNode +final class DoWhileLoopConditionNode extends NodeAbstract implements VirtualNode { /** diff --git a/src/Node/ExecutionEndNode.php b/src/Node/ExecutionEndNode.php index c0a0f52dd8..e9cf081b13 100644 --- a/src/Node/ExecutionEndNode.php +++ b/src/Node/ExecutionEndNode.php @@ -6,7 +6,10 @@ use PhpParser\NodeAbstract; use PHPStan\Analyser\StatementResult; -/** @api */ +/** + * @api + * @final + */ class ExecutionEndNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/Expr/AlwaysRememberedExpr.php b/src/Node/Expr/AlwaysRememberedExpr.php index 049ad46a6b..b3ed1cc12e 100644 --- a/src/Node/Expr/AlwaysRememberedExpr.php +++ b/src/Node/Expr/AlwaysRememberedExpr.php @@ -6,7 +6,7 @@ use PHPStan\Node\VirtualNode; use PHPStan\Type\Type; -class AlwaysRememberedExpr extends Expr implements VirtualNode +final class AlwaysRememberedExpr extends Expr implements VirtualNode { public function __construct(public Expr $expr, private Type $type, private Type $nativeType) diff --git a/src/Node/Expr/ExistingArrayDimFetch.php b/src/Node/Expr/ExistingArrayDimFetch.php index 80412b4fa3..c388667cac 100644 --- a/src/Node/Expr/ExistingArrayDimFetch.php +++ b/src/Node/Expr/ExistingArrayDimFetch.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class ExistingArrayDimFetch extends Expr implements VirtualNode +final class ExistingArrayDimFetch extends Expr implements VirtualNode { public function __construct(private Expr $var, private Expr $dim) diff --git a/src/Node/Expr/GetIterableKeyTypeExpr.php b/src/Node/Expr/GetIterableKeyTypeExpr.php index 40301cc29f..4bc9c39ecc 100644 --- a/src/Node/Expr/GetIterableKeyTypeExpr.php +++ b/src/Node/Expr/GetIterableKeyTypeExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class GetIterableKeyTypeExpr extends Expr implements VirtualNode +final class GetIterableKeyTypeExpr extends Expr implements VirtualNode { public function __construct(private Expr $expr) diff --git a/src/Node/Expr/GetIterableValueTypeExpr.php b/src/Node/Expr/GetIterableValueTypeExpr.php index 2fd920f21a..43d3a19a09 100644 --- a/src/Node/Expr/GetIterableValueTypeExpr.php +++ b/src/Node/Expr/GetIterableValueTypeExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class GetIterableValueTypeExpr extends Expr implements VirtualNode +final class GetIterableValueTypeExpr extends Expr implements VirtualNode { public function __construct(private Expr $expr) diff --git a/src/Node/Expr/GetOffsetValueTypeExpr.php b/src/Node/Expr/GetOffsetValueTypeExpr.php index ed7b33a124..6bb047212a 100644 --- a/src/Node/Expr/GetOffsetValueTypeExpr.php +++ b/src/Node/Expr/GetOffsetValueTypeExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class GetOffsetValueTypeExpr extends Expr implements VirtualNode +final class GetOffsetValueTypeExpr extends Expr implements VirtualNode { public function __construct(private Expr $var, private Expr $dim) diff --git a/src/Node/Expr/OriginalPropertyTypeExpr.php b/src/Node/Expr/OriginalPropertyTypeExpr.php index 2250a8158b..b04990efdc 100644 --- a/src/Node/Expr/OriginalPropertyTypeExpr.php +++ b/src/Node/Expr/OriginalPropertyTypeExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class OriginalPropertyTypeExpr extends Expr implements VirtualNode +final class OriginalPropertyTypeExpr extends Expr implements VirtualNode { public function __construct(private Expr\PropertyFetch|Expr\StaticPropertyFetch $propertyFetch) diff --git a/src/Node/Expr/ParameterVariableOriginalValueExpr.php b/src/Node/Expr/ParameterVariableOriginalValueExpr.php index 277d51c040..7f3408becb 100644 --- a/src/Node/Expr/ParameterVariableOriginalValueExpr.php +++ b/src/Node/Expr/ParameterVariableOriginalValueExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class ParameterVariableOriginalValueExpr extends Expr implements VirtualNode +final class ParameterVariableOriginalValueExpr extends Expr implements VirtualNode { public function __construct(private string $variableName) diff --git a/src/Node/Expr/PropertyInitializationExpr.php b/src/Node/Expr/PropertyInitializationExpr.php index 942fa08d5c..6963d25670 100644 --- a/src/Node/Expr/PropertyInitializationExpr.php +++ b/src/Node/Expr/PropertyInitializationExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class PropertyInitializationExpr extends Expr implements VirtualNode +final class PropertyInitializationExpr extends Expr implements VirtualNode { public function __construct(private string $propertyName) diff --git a/src/Node/Expr/SetExistingOffsetValueTypeExpr.php b/src/Node/Expr/SetExistingOffsetValueTypeExpr.php index 52eb9a4b37..ee4292f65c 100644 --- a/src/Node/Expr/SetExistingOffsetValueTypeExpr.php +++ b/src/Node/Expr/SetExistingOffsetValueTypeExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class SetExistingOffsetValueTypeExpr extends Expr implements VirtualNode +final class SetExistingOffsetValueTypeExpr extends Expr implements VirtualNode { public function __construct(private Expr $var, private Expr $dim, private Expr $value) diff --git a/src/Node/Expr/SetOffsetValueTypeExpr.php b/src/Node/Expr/SetOffsetValueTypeExpr.php index 3e42e13b0c..ed6ddae657 100644 --- a/src/Node/Expr/SetOffsetValueTypeExpr.php +++ b/src/Node/Expr/SetOffsetValueTypeExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class SetOffsetValueTypeExpr extends Expr implements VirtualNode +final class SetOffsetValueTypeExpr extends Expr implements VirtualNode { public function __construct(private Expr $var, private ?Expr $dim, private Expr $value) diff --git a/src/Node/Expr/TypeExpr.php b/src/Node/Expr/TypeExpr.php index 4adc5be0e3..35e364f15c 100644 --- a/src/Node/Expr/TypeExpr.php +++ b/src/Node/Expr/TypeExpr.php @@ -6,7 +6,7 @@ use PHPStan\Node\VirtualNode; use PHPStan\Type\Type; -class TypeExpr extends Expr implements VirtualNode +final class TypeExpr extends Expr implements VirtualNode { public function __construct(private Type $exprType) diff --git a/src/Node/Expr/UnsetOffsetExpr.php b/src/Node/Expr/UnsetOffsetExpr.php index 55c81eef92..422affc9af 100644 --- a/src/Node/Expr/UnsetOffsetExpr.php +++ b/src/Node/Expr/UnsetOffsetExpr.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PHPStan\Node\VirtualNode; -class UnsetOffsetExpr extends Expr implements VirtualNode +final class UnsetOffsetExpr extends Expr implements VirtualNode { public function __construct(private Expr $var, private Expr $dim) diff --git a/src/Node/FileNode.php b/src/Node/FileNode.php index 13a6596ced..355a4b9559 100644 --- a/src/Node/FileNode.php +++ b/src/Node/FileNode.php @@ -5,7 +5,10 @@ use PhpParser\Node; use PhpParser\NodeAbstract; -/** @api */ +/** + * @api + * @final + */ class FileNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/FinallyExitPointsNode.php b/src/Node/FinallyExitPointsNode.php index a87bdc516c..32c2adb50c 100644 --- a/src/Node/FinallyExitPointsNode.php +++ b/src/Node/FinallyExitPointsNode.php @@ -5,7 +5,10 @@ use PhpParser\NodeAbstract; use PHPStan\Analyser\StatementExitPoint; -/** @api */ +/** + * @api + * @final + */ class FinallyExitPointsNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/FunctionCallableNode.php b/src/Node/FunctionCallableNode.php index d43e0228ce..00e9e24fba 100644 --- a/src/Node/FunctionCallableNode.php +++ b/src/Node/FunctionCallableNode.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr; use PhpParser\Node\Name; -/** @api */ +/** + * @api + * @final + */ class FunctionCallableNode extends Expr implements VirtualNode { diff --git a/src/Node/FunctionReturnStatementsNode.php b/src/Node/FunctionReturnStatementsNode.php index 86df35e24c..0b065f8a25 100644 --- a/src/Node/FunctionReturnStatementsNode.php +++ b/src/Node/FunctionReturnStatementsNode.php @@ -12,7 +12,10 @@ use PHPStan\Reflection\FunctionReflection; use function count; -/** @api */ +/** + * @api + * @final + */ class FunctionReturnStatementsNode extends NodeAbstract implements ReturnStatementsNode { diff --git a/src/Node/InArrowFunctionNode.php b/src/Node/InArrowFunctionNode.php index 7716f332b4..fb60b2b404 100644 --- a/src/Node/InArrowFunctionNode.php +++ b/src/Node/InArrowFunctionNode.php @@ -7,7 +7,10 @@ use PhpParser\NodeAbstract; use PHPStan\Type\ClosureType; -/** @api */ +/** + * @api + * @final + */ class InArrowFunctionNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/InClassMethodNode.php b/src/Node/InClassMethodNode.php index da1d8a09b7..f74db8e890 100644 --- a/src/Node/InClassMethodNode.php +++ b/src/Node/InClassMethodNode.php @@ -6,7 +6,10 @@ use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\Php\PhpMethodFromParserNodeReflection; -/** @api */ +/** + * @api + * @final + */ class InClassMethodNode extends Node\Stmt implements VirtualNode { diff --git a/src/Node/InClassNode.php b/src/Node/InClassNode.php index 23310aaec0..1be1b7fab2 100644 --- a/src/Node/InClassNode.php +++ b/src/Node/InClassNode.php @@ -6,7 +6,10 @@ use PhpParser\Node\Stmt\ClassLike; use PHPStan\Reflection\ClassReflection; -/** @api */ +/** + * @api + * @final + */ class InClassNode extends Node\Stmt implements VirtualNode { diff --git a/src/Node/InClosureNode.php b/src/Node/InClosureNode.php index 8882ebd0e3..21def5dbef 100644 --- a/src/Node/InClosureNode.php +++ b/src/Node/InClosureNode.php @@ -7,7 +7,10 @@ use PhpParser\NodeAbstract; use PHPStan\Type\ClosureType; -/** @api */ +/** + * @api + * @final + */ class InClosureNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/InForeachNode.php b/src/Node/InForeachNode.php index b39026a9c9..4e474c98b2 100644 --- a/src/Node/InForeachNode.php +++ b/src/Node/InForeachNode.php @@ -5,7 +5,7 @@ use PhpParser\Node\Stmt\Foreach_; use PhpParser\NodeAbstract; -class InForeachNode extends NodeAbstract implements VirtualNode +final class InForeachNode extends NodeAbstract implements VirtualNode { public function __construct(private Foreach_ $originalNode) diff --git a/src/Node/InFunctionNode.php b/src/Node/InFunctionNode.php index 548c2ac422..550c00e41b 100644 --- a/src/Node/InFunctionNode.php +++ b/src/Node/InFunctionNode.php @@ -5,7 +5,10 @@ use PhpParser\Node; use PHPStan\Reflection\Php\PhpFunctionFromParserNodeReflection; -/** @api */ +/** + * @api + * @final + */ class InFunctionNode extends Node\Stmt implements VirtualNode { diff --git a/src/Node/InTraitNode.php b/src/Node/InTraitNode.php index 688c04499b..39b0dc509b 100644 --- a/src/Node/InTraitNode.php +++ b/src/Node/InTraitNode.php @@ -5,7 +5,10 @@ use PhpParser\Node; use PHPStan\Reflection\ClassReflection; -/** @api */ +/** + * @api + * @final + */ class InTraitNode extends Node\Stmt implements VirtualNode { diff --git a/src/Node/InstantiationCallableNode.php b/src/Node/InstantiationCallableNode.php index 382431f70a..289fb6fe5f 100644 --- a/src/Node/InstantiationCallableNode.php +++ b/src/Node/InstantiationCallableNode.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr; use PhpParser\Node\Name; -/** @api */ +/** + * @api + * @final + */ class InstantiationCallableNode extends Expr implements VirtualNode { diff --git a/src/Node/InvalidateExprNode.php b/src/Node/InvalidateExprNode.php index fa8ab6b061..a59799f0aa 100644 --- a/src/Node/InvalidateExprNode.php +++ b/src/Node/InvalidateExprNode.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr; use PhpParser\NodeAbstract; -/** @api */ +/** + * @api + * @final + */ class InvalidateExprNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/IssetExpr.php b/src/Node/IssetExpr.php index 5c45df0ebc..fbe53cbc6a 100644 --- a/src/Node/IssetExpr.php +++ b/src/Node/IssetExpr.php @@ -4,7 +4,7 @@ use PhpParser\Node\Expr; -class IssetExpr extends Expr implements VirtualNode +final class IssetExpr extends Expr implements VirtualNode { public function __construct( diff --git a/src/Node/LiteralArrayItem.php b/src/Node/LiteralArrayItem.php index 48dd0e3705..ea9be27be6 100644 --- a/src/Node/LiteralArrayItem.php +++ b/src/Node/LiteralArrayItem.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr\ArrayItem; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class LiteralArrayItem { diff --git a/src/Node/LiteralArrayNode.php b/src/Node/LiteralArrayNode.php index bcbd3f0a93..e0bd824fad 100644 --- a/src/Node/LiteralArrayNode.php +++ b/src/Node/LiteralArrayNode.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr\Array_; use PhpParser\NodeAbstract; -/** @api */ +/** + * @api + * @final + */ class LiteralArrayNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/MatchExpressionArm.php b/src/Node/MatchExpressionArm.php index bc8643af45..427ed83cae 100644 --- a/src/Node/MatchExpressionArm.php +++ b/src/Node/MatchExpressionArm.php @@ -2,7 +2,10 @@ namespace PHPStan\Node; -/** @api */ +/** + * @api + * @final + */ class MatchExpressionArm { diff --git a/src/Node/MatchExpressionArmBody.php b/src/Node/MatchExpressionArmBody.php index 544d6237de..628f0f777c 100644 --- a/src/Node/MatchExpressionArmBody.php +++ b/src/Node/MatchExpressionArmBody.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class MatchExpressionArmBody { diff --git a/src/Node/MatchExpressionArmCondition.php b/src/Node/MatchExpressionArmCondition.php index 2928175be7..4b3bc54720 100644 --- a/src/Node/MatchExpressionArmCondition.php +++ b/src/Node/MatchExpressionArmCondition.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class MatchExpressionArmCondition { diff --git a/src/Node/MatchExpressionNode.php b/src/Node/MatchExpressionNode.php index 00ec3bcf8c..0dd31d9b2b 100644 --- a/src/Node/MatchExpressionNode.php +++ b/src/Node/MatchExpressionNode.php @@ -6,7 +6,10 @@ use PhpParser\NodeAbstract; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class MatchExpressionNode extends NodeAbstract implements VirtualNode { diff --git a/src/Node/Method/MethodCall.php b/src/Node/Method/MethodCall.php index 19c77316fb..c88997a3f9 100644 --- a/src/Node/Method/MethodCall.php +++ b/src/Node/Method/MethodCall.php @@ -7,7 +7,10 @@ use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class MethodCall { diff --git a/src/Node/MethodCallableNode.php b/src/Node/MethodCallableNode.php index aff7b5cefc..7e7f1240dd 100644 --- a/src/Node/MethodCallableNode.php +++ b/src/Node/MethodCallableNode.php @@ -5,7 +5,10 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; -/** @api */ +/** + * @api + * @final + */ class MethodCallableNode extends Expr implements VirtualNode { diff --git a/src/Node/MethodReturnStatementsNode.php b/src/Node/MethodReturnStatementsNode.php index 3151d12ae3..0103f58059 100644 --- a/src/Node/MethodReturnStatementsNode.php +++ b/src/Node/MethodReturnStatementsNode.php @@ -13,7 +13,10 @@ use PHPStan\Reflection\ExtendedMethodReflection; use function count; -/** @api */ +/** + * @api + * @final + */ class MethodReturnStatementsNode extends NodeAbstract implements ReturnStatementsNode { diff --git a/src/Node/NoopExpressionNode.php b/src/Node/NoopExpressionNode.php index 38e9222a8c..6723ee9259 100644 --- a/src/Node/NoopExpressionNode.php +++ b/src/Node/NoopExpressionNode.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PhpParser\NodeAbstract; -class NoopExpressionNode extends NodeAbstract implements VirtualNode +final class NoopExpressionNode extends NodeAbstract implements VirtualNode { public function __construct(private Expr $originalExpr, private bool $hasAssign) diff --git a/src/Node/Printer/ExprPrinter.php b/src/Node/Printer/ExprPrinter.php index 3763201b5f..6df730ddfc 100644 --- a/src/Node/Printer/ExprPrinter.php +++ b/src/Node/Printer/ExprPrinter.php @@ -4,7 +4,10 @@ use PhpParser\Node\Expr; -/** @api */ +/** + * @api + * @final + */ class ExprPrinter { diff --git a/src/Node/Printer/Printer.php b/src/Node/Printer/Printer.php index 953174fc70..78455184f0 100644 --- a/src/Node/Printer/Printer.php +++ b/src/Node/Printer/Printer.php @@ -19,7 +19,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; -class Printer extends Standard +final class Printer extends Standard { public function __construct() diff --git a/src/Node/Property/PropertyRead.php b/src/Node/Property/PropertyRead.php index 27bc3ba5c4..1c24537453 100644 --- a/src/Node/Property/PropertyRead.php +++ b/src/Node/Property/PropertyRead.php @@ -6,7 +6,10 @@ use PhpParser\Node\Expr\StaticPropertyFetch; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class PropertyRead { diff --git a/src/Node/Property/PropertyWrite.php b/src/Node/Property/PropertyWrite.php index 9577dc7fa8..fec7a1c4f0 100644 --- a/src/Node/Property/PropertyWrite.php +++ b/src/Node/Property/PropertyWrite.php @@ -6,7 +6,10 @@ use PhpParser\Node\Expr\StaticPropertyFetch; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class PropertyWrite { diff --git a/src/Node/PropertyAssignNode.php b/src/Node/PropertyAssignNode.php index 62a5d7ac1e..7537b8935d 100644 --- a/src/Node/PropertyAssignNode.php +++ b/src/Node/PropertyAssignNode.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PhpParser\NodeAbstract; -class PropertyAssignNode extends NodeAbstract implements VirtualNode +final class PropertyAssignNode extends NodeAbstract implements VirtualNode { public function __construct( diff --git a/src/Node/ReturnStatement.php b/src/Node/ReturnStatement.php index 99767fba7b..7a5da6f203 100644 --- a/src/Node/ReturnStatement.php +++ b/src/Node/ReturnStatement.php @@ -6,7 +6,10 @@ use PhpParser\Node\Stmt\Return_; use PHPStan\Analyser\Scope; -/** @api */ +/** + * @api + * @final + */ class ReturnStatement { diff --git a/src/Node/StaticMethodCallableNode.php b/src/Node/StaticMethodCallableNode.php index a4c6e675ef..19e823234b 100644 --- a/src/Node/StaticMethodCallableNode.php +++ b/src/Node/StaticMethodCallableNode.php @@ -6,7 +6,10 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Name; -/** @api */ +/** + * @api + * @final + */ class StaticMethodCallableNode extends Expr implements VirtualNode { diff --git a/src/Node/UnreachableStatementNode.php b/src/Node/UnreachableStatementNode.php index fb05c30a50..7c3cfb163c 100644 --- a/src/Node/UnreachableStatementNode.php +++ b/src/Node/UnreachableStatementNode.php @@ -4,7 +4,10 @@ use PhpParser\Node\Stmt; -/** @api */ +/** + * @api + * @final + */ class UnreachableStatementNode extends Stmt implements VirtualNode { diff --git a/src/Node/VarTagChangedExpressionTypeNode.php b/src/Node/VarTagChangedExpressionTypeNode.php index 6689aa7a0d..c57a90f7a5 100644 --- a/src/Node/VarTagChangedExpressionTypeNode.php +++ b/src/Node/VarTagChangedExpressionTypeNode.php @@ -6,7 +6,7 @@ use PhpParser\NodeAbstract; use PHPStan\PhpDoc\Tag\VarTag; -class VarTagChangedExpressionTypeNode extends NodeAbstract implements VirtualNode +final class VarTagChangedExpressionTypeNode extends NodeAbstract implements VirtualNode { public function __construct(private VarTag $varTag, private Expr $expr) diff --git a/src/Node/VariableAssignNode.php b/src/Node/VariableAssignNode.php index 2857e853ba..695f59bf2a 100644 --- a/src/Node/VariableAssignNode.php +++ b/src/Node/VariableAssignNode.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use PhpParser\NodeAbstract; -class VariableAssignNode extends NodeAbstract implements VirtualNode +final class VariableAssignNode extends NodeAbstract implements VirtualNode { public function __construct( diff --git a/src/Parallel/ParallelAnalyser.php b/src/Parallel/ParallelAnalyser.php index 65f8776c19..2ce90b2160 100644 --- a/src/Parallel/ParallelAnalyser.php +++ b/src/Parallel/ParallelAnalyser.php @@ -33,7 +33,7 @@ use function str_contains; use const PHP_URL_PORT; -class ParallelAnalyser +final class ParallelAnalyser { private const DEFAULT_TIMEOUT = 600.0; diff --git a/src/Parallel/Process.php b/src/Parallel/Process.php index d95609b6ef..e5cf90566f 100644 --- a/src/Parallel/Process.php +++ b/src/Parallel/Process.php @@ -15,7 +15,7 @@ use function stream_get_contents; use function tmpfile; -class Process +final class Process { public \React\ChildProcess\Process $process; diff --git a/src/Parallel/ProcessPool.php b/src/Parallel/ProcessPool.php index ac0569c509..574cabcf6e 100644 --- a/src/Parallel/ProcessPool.php +++ b/src/Parallel/ProcessPool.php @@ -9,7 +9,7 @@ use function count; use function sprintf; -class ProcessPool +final class ProcessPool { /** @var array */ diff --git a/src/Parallel/ProcessTimedOutException.php b/src/Parallel/ProcessTimedOutException.php index 77e42107f7..50667999a1 100644 --- a/src/Parallel/ProcessTimedOutException.php +++ b/src/Parallel/ProcessTimedOutException.php @@ -4,7 +4,7 @@ use Exception; -class ProcessTimedOutException extends Exception +final class ProcessTimedOutException extends Exception { } diff --git a/src/Parallel/Schedule.php b/src/Parallel/Schedule.php index 42935bd6c5..b37935a4ce 100644 --- a/src/Parallel/Schedule.php +++ b/src/Parallel/Schedule.php @@ -2,7 +2,7 @@ namespace PHPStan\Parallel; -class Schedule +final class Schedule { /** diff --git a/src/Parallel/Scheduler.php b/src/Parallel/Scheduler.php index 77394959b2..45ad9086f1 100644 --- a/src/Parallel/Scheduler.php +++ b/src/Parallel/Scheduler.php @@ -11,7 +11,7 @@ use function min; use function sprintf; -class Scheduler implements DiagnoseExtension +final class Scheduler implements DiagnoseExtension { /** @var array{int, int, int, int}|null */ diff --git a/src/Parser/ArrayFilterArgVisitor.php b/src/Parser/ArrayFilterArgVisitor.php index bf7f9eef75..a2730deb3d 100644 --- a/src/Parser/ArrayFilterArgVisitor.php +++ b/src/Parser/ArrayFilterArgVisitor.php @@ -5,7 +5,7 @@ use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -class ArrayFilterArgVisitor extends NodeVisitorAbstract +final class ArrayFilterArgVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'isArrayFilterArg'; diff --git a/src/Parser/ArrayMapArgVisitor.php b/src/Parser/ArrayMapArgVisitor.php index b6e7a12ccb..0c62d0c7c4 100644 --- a/src/Parser/ArrayMapArgVisitor.php +++ b/src/Parser/ArrayMapArgVisitor.php @@ -7,7 +7,7 @@ use function array_slice; use function count; -class ArrayMapArgVisitor extends NodeVisitorAbstract +final class ArrayMapArgVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'arrayMapArgs'; diff --git a/src/Parser/ArrayWalkArgVisitor.php b/src/Parser/ArrayWalkArgVisitor.php index addc7dc1ba..ad776bb175 100644 --- a/src/Parser/ArrayWalkArgVisitor.php +++ b/src/Parser/ArrayWalkArgVisitor.php @@ -5,7 +5,7 @@ use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -class ArrayWalkArgVisitor extends NodeVisitorAbstract +final class ArrayWalkArgVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'isArrayWalkArg'; diff --git a/src/Parser/ArrowFunctionArgVisitor.php b/src/Parser/ArrowFunctionArgVisitor.php index 24b04718fa..f8149dad21 100644 --- a/src/Parser/ArrowFunctionArgVisitor.php +++ b/src/Parser/ArrowFunctionArgVisitor.php @@ -6,7 +6,7 @@ use PhpParser\NodeVisitorAbstract; use function count; -class ArrowFunctionArgVisitor extends NodeVisitorAbstract +final class ArrowFunctionArgVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'arrowFunctionCallArgs'; diff --git a/src/Parser/CachedParser.php b/src/Parser/CachedParser.php index 225375678c..62bba62a2b 100644 --- a/src/Parser/CachedParser.php +++ b/src/Parser/CachedParser.php @@ -6,7 +6,7 @@ use PHPStan\File\FileReader; use function array_slice; -class CachedParser implements Parser +final class CachedParser implements Parser { /** @var array*/ diff --git a/src/Parser/CleaningParser.php b/src/Parser/CleaningParser.php index 98db0e64ef..0f874eafbf 100644 --- a/src/Parser/CleaningParser.php +++ b/src/Parser/CleaningParser.php @@ -6,7 +6,7 @@ use PhpParser\NodeTraverser; use PHPStan\Php\PhpVersion; -class CleaningParser implements Parser +final class CleaningParser implements Parser { private NodeTraverser $traverser; diff --git a/src/Parser/CleaningVisitor.php b/src/Parser/CleaningVisitor.php index 0a2c9aecff..773c36f6e4 100644 --- a/src/Parser/CleaningVisitor.php +++ b/src/Parser/CleaningVisitor.php @@ -8,7 +8,7 @@ use PHPStan\Reflection\ParametersAcceptor; use function in_array; -class CleaningVisitor extends NodeVisitorAbstract +final class CleaningVisitor extends NodeVisitorAbstract { private NodeFinder $nodeFinder; diff --git a/src/Parser/ClosureArgVisitor.php b/src/Parser/ClosureArgVisitor.php index df36796570..58d53a808e 100644 --- a/src/Parser/ClosureArgVisitor.php +++ b/src/Parser/ClosureArgVisitor.php @@ -6,7 +6,7 @@ use PhpParser\NodeVisitorAbstract; use function count; -class ClosureArgVisitor extends NodeVisitorAbstract +final class ClosureArgVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'closureCallArgs'; diff --git a/src/Parser/ClosureBindArgVisitor.php b/src/Parser/ClosureBindArgVisitor.php index de341a57d9..291ede59b4 100644 --- a/src/Parser/ClosureBindArgVisitor.php +++ b/src/Parser/ClosureBindArgVisitor.php @@ -7,7 +7,7 @@ use PhpParser\NodeVisitorAbstract; use function count; -class ClosureBindArgVisitor extends NodeVisitorAbstract +final class ClosureBindArgVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'closureBindArg'; diff --git a/src/Parser/ClosureBindToVarVisitor.php b/src/Parser/ClosureBindToVarVisitor.php index f3582ba617..7196d50093 100644 --- a/src/Parser/ClosureBindToVarVisitor.php +++ b/src/Parser/ClosureBindToVarVisitor.php @@ -6,7 +6,7 @@ use PhpParser\Node\Identifier; use PhpParser\NodeVisitorAbstract; -class ClosureBindToVarVisitor extends NodeVisitorAbstract +final class ClosureBindToVarVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'closureBindToVar'; diff --git a/src/Parser/CurlSetOptArgVisitor.php b/src/Parser/CurlSetOptArgVisitor.php index 13910ec5a1..f9be2fd5c3 100644 --- a/src/Parser/CurlSetOptArgVisitor.php +++ b/src/Parser/CurlSetOptArgVisitor.php @@ -5,7 +5,7 @@ use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -class CurlSetOptArgVisitor extends NodeVisitorAbstract +final class CurlSetOptArgVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'isCurlSetOptArg'; diff --git a/src/Parser/DeclarePositionVisitor.php b/src/Parser/DeclarePositionVisitor.php index 08818c1652..e0d523603f 100644 --- a/src/Parser/DeclarePositionVisitor.php +++ b/src/Parser/DeclarePositionVisitor.php @@ -6,7 +6,7 @@ use PhpParser\NodeVisitorAbstract; use function str_starts_with; -class DeclarePositionVisitor extends NodeVisitorAbstract +final class DeclarePositionVisitor extends NodeVisitorAbstract { private bool $isFirstStatement = true; diff --git a/src/Parser/FunctionCallStatementFinder.php b/src/Parser/FunctionCallStatementFinder.php index 4f1b190d35..9a4c1dd6bb 100644 --- a/src/Parser/FunctionCallStatementFinder.php +++ b/src/Parser/FunctionCallStatementFinder.php @@ -8,7 +8,7 @@ use function in_array; use function is_array; -class FunctionCallStatementFinder +final class FunctionCallStatementFinder { /** diff --git a/src/Parser/LastConditionVisitor.php b/src/Parser/LastConditionVisitor.php index 5edd559ed0..ce21f571fd 100644 --- a/src/Parser/LastConditionVisitor.php +++ b/src/Parser/LastConditionVisitor.php @@ -6,7 +6,7 @@ use PhpParser\NodeVisitorAbstract; use function count; -class LastConditionVisitor extends NodeVisitorAbstract +final class LastConditionVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'isLastCondition'; diff --git a/src/Parser/LexerFactory.php b/src/Parser/LexerFactory.php index 624eb251bf..5fa801ddec 100644 --- a/src/Parser/LexerFactory.php +++ b/src/Parser/LexerFactory.php @@ -6,7 +6,7 @@ use PHPStan\Php\PhpVersion; use const PHP_VERSION_ID; -class LexerFactory +final class LexerFactory { private const OPTIONS = ['usedAttributes' => ['comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos', 'startFilePos', 'endFilePos']]; diff --git a/src/Parser/MagicConstantParamDefaultVisitor.php b/src/Parser/MagicConstantParamDefaultVisitor.php index 5bc27ada08..455c341e4e 100644 --- a/src/Parser/MagicConstantParamDefaultVisitor.php +++ b/src/Parser/MagicConstantParamDefaultVisitor.php @@ -5,7 +5,7 @@ use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -class MagicConstantParamDefaultVisitor extends NodeVisitorAbstract +final class MagicConstantParamDefaultVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'isMagicConstantParamDefault'; diff --git a/src/Parser/NewAssignedToPropertyVisitor.php b/src/Parser/NewAssignedToPropertyVisitor.php index a38bab16fb..05df87b423 100644 --- a/src/Parser/NewAssignedToPropertyVisitor.php +++ b/src/Parser/NewAssignedToPropertyVisitor.php @@ -5,7 +5,7 @@ use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -class NewAssignedToPropertyVisitor extends NodeVisitorAbstract +final class NewAssignedToPropertyVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'assignedToProperty'; diff --git a/src/Parser/ParserErrorsException.php b/src/Parser/ParserErrorsException.php index 1013be73d4..d68d18220a 100644 --- a/src/Parser/ParserErrorsException.php +++ b/src/Parser/ParserErrorsException.php @@ -8,7 +8,7 @@ use function count; use function implode; -class ParserErrorsException extends Exception +final class ParserErrorsException extends Exception { /** @var mixed[] */ diff --git a/src/Parser/PathRoutingParser.php b/src/Parser/PathRoutingParser.php index def6786f5e..83fae0a891 100644 --- a/src/Parser/PathRoutingParser.php +++ b/src/Parser/PathRoutingParser.php @@ -13,7 +13,7 @@ use function str_contains; use const DIRECTORY_SEPARATOR; -class PathRoutingParser implements Parser +final class PathRoutingParser implements Parser { /** @var bool[] filePath(string) => bool(true) */ diff --git a/src/Parser/PhpParserDecorator.php b/src/Parser/PhpParserDecorator.php index 5626f20b1a..14c462c39f 100644 --- a/src/Parser/PhpParserDecorator.php +++ b/src/Parser/PhpParserDecorator.php @@ -8,7 +8,7 @@ use PhpParser\Parser; use function sprintf; -class PhpParserDecorator implements Parser +final class PhpParserDecorator implements Parser { public function __construct(private \PHPStan\Parser\Parser $wrappedParser) diff --git a/src/Parser/RemoveUnusedCodeByPhpVersionIdVisitor.php b/src/Parser/RemoveUnusedCodeByPhpVersionIdVisitor.php index eed9b93bf7..48722eeca5 100644 --- a/src/Parser/RemoveUnusedCodeByPhpVersionIdVisitor.php +++ b/src/Parser/RemoveUnusedCodeByPhpVersionIdVisitor.php @@ -8,14 +8,14 @@ use function count; use function version_compare; -class RemoveUnusedCodeByPhpVersionIdVisitor extends NodeVisitorAbstract +final class RemoveUnusedCodeByPhpVersionIdVisitor extends NodeVisitorAbstract { public function __construct(private string $phpVersionString) { } - public function enterNode(Node $node): Node|int|null + public function enterNode(Node $node): ?Node { if (!$node instanceof Node\Stmt\If_) { return null; diff --git a/src/Parser/RichParser.php b/src/Parser/RichParser.php index 11281ca7fd..b5863a4b80 100644 --- a/src/Parser/RichParser.php +++ b/src/Parser/RichParser.php @@ -31,7 +31,7 @@ use const T_DOC_COMMENT; use const T_WHITESPACE; -class RichParser implements Parser +final class RichParser implements Parser { public const VISITOR_SERVICE_TAG = 'phpstan.parser.richParserNodeVisitor'; diff --git a/src/Parser/SimpleParser.php b/src/Parser/SimpleParser.php index efcf47d786..713c1502ef 100644 --- a/src/Parser/SimpleParser.php +++ b/src/Parser/SimpleParser.php @@ -9,7 +9,7 @@ use PHPStan\File\FileReader; use PHPStan\ShouldNotHappenException; -class SimpleParser implements Parser +final class SimpleParser implements Parser { public function __construct( diff --git a/src/Parser/TypeTraverserInstanceofVisitor.php b/src/Parser/TypeTraverserInstanceofVisitor.php index a39226bbb2..e353d31af3 100644 --- a/src/Parser/TypeTraverserInstanceofVisitor.php +++ b/src/Parser/TypeTraverserInstanceofVisitor.php @@ -5,7 +5,7 @@ use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -class TypeTraverserInstanceofVisitor extends NodeVisitorAbstract +final class TypeTraverserInstanceofVisitor extends NodeVisitorAbstract { public const ATTRIBUTE_NAME = 'insideTypeTraverserMap'; diff --git a/src/Php/PhpVersion.php b/src/Php/PhpVersion.php index c5afa1e22f..3e3d1e112d 100644 --- a/src/Php/PhpVersion.php +++ b/src/Php/PhpVersion.php @@ -4,7 +4,10 @@ use function floor; -/** @api */ +/** + * @api + * @final + */ class PhpVersion { diff --git a/src/Php/PhpVersionFactory.php b/src/Php/PhpVersionFactory.php index 02c0c8b749..ef1e244ac4 100644 --- a/src/Php/PhpVersionFactory.php +++ b/src/Php/PhpVersionFactory.php @@ -7,7 +7,7 @@ use function min; use const PHP_VERSION_ID; -class PhpVersionFactory +final class PhpVersionFactory { public function __construct( diff --git a/src/Php/PhpVersionFactoryFactory.php b/src/Php/PhpVersionFactoryFactory.php index 870d1ff276..c578ef06fc 100644 --- a/src/Php/PhpVersionFactoryFactory.php +++ b/src/Php/PhpVersionFactoryFactory.php @@ -11,7 +11,7 @@ use function is_file; use function is_string; -class PhpVersionFactoryFactory +final class PhpVersionFactoryFactory { /** diff --git a/src/PhpDoc/ConstExprNodeResolver.php b/src/PhpDoc/ConstExprNodeResolver.php index 4719a4c8e7..9e3e86f187 100644 --- a/src/PhpDoc/ConstExprNodeResolver.php +++ b/src/PhpDoc/ConstExprNodeResolver.php @@ -19,7 +19,7 @@ use PHPStan\Type\NullType; use PHPStan\Type\Type; -class ConstExprNodeResolver +final class ConstExprNodeResolver { public function resolve(ConstExprNode $node): Type diff --git a/src/PhpDoc/ConstExprParserFactory.php b/src/PhpDoc/ConstExprParserFactory.php index aa2ca2657d..4af1282a78 100644 --- a/src/PhpDoc/ConstExprParserFactory.php +++ b/src/PhpDoc/ConstExprParserFactory.php @@ -4,7 +4,7 @@ use PHPStan\PhpDocParser\Parser\ConstExprParser; -class ConstExprParserFactory +final class ConstExprParserFactory { public function __construct(private bool $unescapeStrings) diff --git a/src/PhpDoc/CountableStubFilesExtension.php b/src/PhpDoc/CountableStubFilesExtension.php index af7761e625..3fc3a15666 100644 --- a/src/PhpDoc/CountableStubFilesExtension.php +++ b/src/PhpDoc/CountableStubFilesExtension.php @@ -2,7 +2,7 @@ namespace PHPStan\PhpDoc; -class CountableStubFilesExtension implements StubFilesExtension +final class CountableStubFilesExtension implements StubFilesExtension { public function __construct(private bool $bleedingEdge) diff --git a/src/PhpDoc/DefaultStubFilesProvider.php b/src/PhpDoc/DefaultStubFilesProvider.php index da52332a1f..48121ba3dc 100644 --- a/src/PhpDoc/DefaultStubFilesProvider.php +++ b/src/PhpDoc/DefaultStubFilesProvider.php @@ -9,7 +9,7 @@ use function str_contains; use function strtr; -class DefaultStubFilesProvider implements StubFilesProvider +final class DefaultStubFilesProvider implements StubFilesProvider { /** @var string[]|null */ diff --git a/src/PhpDoc/DirectTypeNodeResolverExtensionRegistryProvider.php b/src/PhpDoc/DirectTypeNodeResolverExtensionRegistryProvider.php index cd912d76bb..c1c038ca81 100644 --- a/src/PhpDoc/DirectTypeNodeResolverExtensionRegistryProvider.php +++ b/src/PhpDoc/DirectTypeNodeResolverExtensionRegistryProvider.php @@ -2,7 +2,7 @@ namespace PHPStan\PhpDoc; -class DirectTypeNodeResolverExtensionRegistryProvider implements TypeNodeResolverExtensionRegistryProvider +final class DirectTypeNodeResolverExtensionRegistryProvider implements TypeNodeResolverExtensionRegistryProvider { public function __construct(private TypeNodeResolverExtensionRegistry $registry) diff --git a/src/PhpDoc/JsonValidateStubFilesExtension.php b/src/PhpDoc/JsonValidateStubFilesExtension.php index 19c1f824d0..3bfcfe862c 100644 --- a/src/PhpDoc/JsonValidateStubFilesExtension.php +++ b/src/PhpDoc/JsonValidateStubFilesExtension.php @@ -4,7 +4,7 @@ use PHPStan\Php\PhpVersion; -class JsonValidateStubFilesExtension implements StubFilesExtension +final class JsonValidateStubFilesExtension implements StubFilesExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php b/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php index 4a041e369e..7c00dfe34d 100644 --- a/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php +++ b/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyTypeNodeResolverExtensionRegistryProvider implements TypeNodeResolverExtensionRegistryProvider +final class LazyTypeNodeResolverExtensionRegistryProvider implements TypeNodeResolverExtensionRegistryProvider { private ?TypeNodeResolverExtensionRegistry $registry = null; diff --git a/src/PhpDoc/PhpDocBlock.php b/src/PhpDoc/PhpDocBlock.php index c4a6f6ce43..fd75fa5306 100644 --- a/src/PhpDoc/PhpDocBlock.php +++ b/src/PhpDoc/PhpDocBlock.php @@ -19,7 +19,7 @@ use function strtolower; use function substr; -class PhpDocBlock +final class PhpDocBlock { /** diff --git a/src/PhpDoc/PhpDocInheritanceResolver.php b/src/PhpDoc/PhpDocInheritanceResolver.php index 0e909dd96a..98366e15ea 100644 --- a/src/PhpDoc/PhpDocInheritanceResolver.php +++ b/src/PhpDoc/PhpDocInheritanceResolver.php @@ -8,7 +8,7 @@ use function array_map; use function strtolower; -class PhpDocInheritanceResolver +final class PhpDocInheritanceResolver { public function __construct( diff --git a/src/PhpDoc/PhpDocNodeResolver.php b/src/PhpDoc/PhpDocNodeResolver.php index c11c26d7b0..6d52d72f95 100644 --- a/src/PhpDoc/PhpDocNodeResolver.php +++ b/src/PhpDoc/PhpDocNodeResolver.php @@ -48,7 +48,7 @@ use function str_starts_with; use function substr; -class PhpDocNodeResolver +final class PhpDocNodeResolver { public function __construct( diff --git a/src/PhpDoc/PhpDocStringResolver.php b/src/PhpDoc/PhpDocStringResolver.php index d9d6203e5b..7c8129a3cc 100644 --- a/src/PhpDoc/PhpDocStringResolver.php +++ b/src/PhpDoc/PhpDocStringResolver.php @@ -7,7 +7,7 @@ use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; -class PhpDocStringResolver +final class PhpDocStringResolver { public function __construct(private Lexer $phpDocLexer, private PhpDocParser $phpDocParser) diff --git a/src/PhpDoc/ReflectionEnumStubFilesExtension.php b/src/PhpDoc/ReflectionEnumStubFilesExtension.php index 0fe8fbb5b2..38ab53a124 100644 --- a/src/PhpDoc/ReflectionEnumStubFilesExtension.php +++ b/src/PhpDoc/ReflectionEnumStubFilesExtension.php @@ -4,7 +4,7 @@ use PHPStan\Php\PhpVersion; -class ReflectionEnumStubFilesExtension implements StubFilesExtension +final class ReflectionEnumStubFilesExtension implements StubFilesExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/PhpDoc/ResolvedPhpDocBlock.php b/src/PhpDoc/ResolvedPhpDocBlock.php index 4783a8f710..ed45d60e48 100644 --- a/src/PhpDoc/ResolvedPhpDocBlock.php +++ b/src/PhpDoc/ResolvedPhpDocBlock.php @@ -40,7 +40,10 @@ use function is_bool; use function substr; -/** @api */ +/** + * @api + * @final + */ class ResolvedPhpDocBlock { diff --git a/src/PhpDoc/SocketSelectStubFilesExtension.php b/src/PhpDoc/SocketSelectStubFilesExtension.php index 1113a10f89..c5d60ea909 100644 --- a/src/PhpDoc/SocketSelectStubFilesExtension.php +++ b/src/PhpDoc/SocketSelectStubFilesExtension.php @@ -4,7 +4,7 @@ use PHPStan\Php\PhpVersion; -class SocketSelectStubFilesExtension implements StubFilesExtension +final class SocketSelectStubFilesExtension implements StubFilesExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/PhpDoc/StubPhpDocProvider.php b/src/PhpDoc/StubPhpDocProvider.php index d00085e985..c314c9c53c 100644 --- a/src/PhpDoc/StubPhpDocProvider.php +++ b/src/PhpDoc/StubPhpDocProvider.php @@ -14,7 +14,7 @@ use function array_map; use function is_string; -class StubPhpDocProvider +final class StubPhpDocProvider { /** @var array */ diff --git a/src/PhpDoc/StubSourceLocatorFactory.php b/src/PhpDoc/StubSourceLocatorFactory.php index 27384f41b1..6eca6b0bab 100644 --- a/src/PhpDoc/StubSourceLocatorFactory.php +++ b/src/PhpDoc/StubSourceLocatorFactory.php @@ -14,7 +14,7 @@ use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocatorRepository; use function dirname; -class StubSourceLocatorFactory +final class StubSourceLocatorFactory { public function __construct( diff --git a/src/PhpDoc/StubValidator.php b/src/PhpDoc/StubValidator.php index d0628f435c..91ff9d9360 100644 --- a/src/PhpDoc/StubValidator.php +++ b/src/PhpDoc/StubValidator.php @@ -70,7 +70,7 @@ use function count; use function sprintf; -class StubValidator +final class StubValidator { public function __construct( diff --git a/src/PhpDoc/Tag/AssertTagParameter.php b/src/PhpDoc/Tag/AssertTagParameter.php index 18717b3494..a3c3250326 100644 --- a/src/PhpDoc/Tag/AssertTagParameter.php +++ b/src/PhpDoc/Tag/AssertTagParameter.php @@ -5,7 +5,7 @@ use PhpParser\Node\Expr; use function sprintf; -class AssertTagParameter +final class AssertTagParameter { public function __construct( diff --git a/src/PhpDoc/Tag/DeprecatedTag.php b/src/PhpDoc/Tag/DeprecatedTag.php index ea798c2aab..e7bf3c553f 100644 --- a/src/PhpDoc/Tag/DeprecatedTag.php +++ b/src/PhpDoc/Tag/DeprecatedTag.php @@ -2,7 +2,10 @@ namespace PHPStan\PhpDoc\Tag; -/** @api */ +/** + * @api + * @final + */ class DeprecatedTag { diff --git a/src/PhpDoc/Tag/ExtendsTag.php b/src/PhpDoc/Tag/ExtendsTag.php index 74ed32b7a2..e8a48922b4 100644 --- a/src/PhpDoc/Tag/ExtendsTag.php +++ b/src/PhpDoc/Tag/ExtendsTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ExtendsTag { diff --git a/src/PhpDoc/Tag/ImplementsTag.php b/src/PhpDoc/Tag/ImplementsTag.php index cc9376b47a..bc82888d3f 100644 --- a/src/PhpDoc/Tag/ImplementsTag.php +++ b/src/PhpDoc/Tag/ImplementsTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ImplementsTag { diff --git a/src/PhpDoc/Tag/MethodTag.php b/src/PhpDoc/Tag/MethodTag.php index 9f46c124d2..793fd3d6d2 100644 --- a/src/PhpDoc/Tag/MethodTag.php +++ b/src/PhpDoc/Tag/MethodTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class MethodTag { diff --git a/src/PhpDoc/Tag/MethodTagParameter.php b/src/PhpDoc/Tag/MethodTagParameter.php index 1326c4cbc9..21f4377ce6 100644 --- a/src/PhpDoc/Tag/MethodTagParameter.php +++ b/src/PhpDoc/Tag/MethodTagParameter.php @@ -5,7 +5,10 @@ use PHPStan\Reflection\PassedByReference; use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class MethodTagParameter { diff --git a/src/PhpDoc/Tag/MixinTag.php b/src/PhpDoc/Tag/MixinTag.php index 2a97b73264..5df36d74bd 100644 --- a/src/PhpDoc/Tag/MixinTag.php +++ b/src/PhpDoc/Tag/MixinTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class MixinTag { diff --git a/src/PhpDoc/Tag/ParamClosureThisTag.php b/src/PhpDoc/Tag/ParamClosureThisTag.php index 1dacb4c41d..ae601dabc2 100644 --- a/src/PhpDoc/Tag/ParamClosureThisTag.php +++ b/src/PhpDoc/Tag/ParamClosureThisTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ final class ParamClosureThisTag implements TypedTag { diff --git a/src/PhpDoc/Tag/ParamOutTag.php b/src/PhpDoc/Tag/ParamOutTag.php index c40018cb45..8bc982f292 100644 --- a/src/PhpDoc/Tag/ParamOutTag.php +++ b/src/PhpDoc/Tag/ParamOutTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ParamOutTag implements TypedTag { diff --git a/src/PhpDoc/Tag/ParamTag.php b/src/PhpDoc/Tag/ParamTag.php index 8515df30b9..f21038c4e1 100644 --- a/src/PhpDoc/Tag/ParamTag.php +++ b/src/PhpDoc/Tag/ParamTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ParamTag implements TypedTag { diff --git a/src/PhpDoc/Tag/PropertyTag.php b/src/PhpDoc/Tag/PropertyTag.php index f2e42c14b3..a46bb9cdbf 100644 --- a/src/PhpDoc/Tag/PropertyTag.php +++ b/src/PhpDoc/Tag/PropertyTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class PropertyTag { diff --git a/src/PhpDoc/Tag/RequireExtendsTag.php b/src/PhpDoc/Tag/RequireExtendsTag.php index a1e60d45a6..60861f7615 100644 --- a/src/PhpDoc/Tag/RequireExtendsTag.php +++ b/src/PhpDoc/Tag/RequireExtendsTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class RequireExtendsTag { diff --git a/src/PhpDoc/Tag/RequireImplementsTag.php b/src/PhpDoc/Tag/RequireImplementsTag.php index 2a0f42303f..12702bce71 100644 --- a/src/PhpDoc/Tag/RequireImplementsTag.php +++ b/src/PhpDoc/Tag/RequireImplementsTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class RequireImplementsTag { diff --git a/src/PhpDoc/Tag/ReturnTag.php b/src/PhpDoc/Tag/ReturnTag.php index 683b0cb259..ef5b130293 100644 --- a/src/PhpDoc/Tag/ReturnTag.php +++ b/src/PhpDoc/Tag/ReturnTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ReturnTag implements TypedTag { diff --git a/src/PhpDoc/Tag/SelfOutTypeTag.php b/src/PhpDoc/Tag/SelfOutTypeTag.php index bbd5a2ca09..1e1dacc2fa 100644 --- a/src/PhpDoc/Tag/SelfOutTypeTag.php +++ b/src/PhpDoc/Tag/SelfOutTypeTag.php @@ -4,6 +4,10 @@ use PHPStan\Type\Type; +/** + * @api + * @final + */ class SelfOutTypeTag implements TypedTag { diff --git a/src/PhpDoc/Tag/TemplateTag.php b/src/PhpDoc/Tag/TemplateTag.php index 78707555c8..a14fa2c6ab 100644 --- a/src/PhpDoc/Tag/TemplateTag.php +++ b/src/PhpDoc/Tag/TemplateTag.php @@ -5,7 +5,10 @@ use PHPStan\Type\Generic\TemplateTypeVariance; use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class TemplateTag { diff --git a/src/PhpDoc/Tag/ThrowsTag.php b/src/PhpDoc/Tag/ThrowsTag.php index 15c1ac94d9..220eefae95 100644 --- a/src/PhpDoc/Tag/ThrowsTag.php +++ b/src/PhpDoc/Tag/ThrowsTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ThrowsTag { diff --git a/src/PhpDoc/Tag/TypeAliasTag.php b/src/PhpDoc/Tag/TypeAliasTag.php index 35b613417a..5a360b8613 100644 --- a/src/PhpDoc/Tag/TypeAliasTag.php +++ b/src/PhpDoc/Tag/TypeAliasTag.php @@ -6,7 +6,10 @@ use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\TypeAlias; -/** @api */ +/** + * @api + * @final + */ class TypeAliasTag { diff --git a/src/PhpDoc/Tag/UsesTag.php b/src/PhpDoc/Tag/UsesTag.php index 453eb5b250..63ec60d0b4 100644 --- a/src/PhpDoc/Tag/UsesTag.php +++ b/src/PhpDoc/Tag/UsesTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class UsesTag { diff --git a/src/PhpDoc/Tag/VarTag.php b/src/PhpDoc/Tag/VarTag.php index 672cb81d43..0d93daeac8 100644 --- a/src/PhpDoc/Tag/VarTag.php +++ b/src/PhpDoc/Tag/VarTag.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class VarTag implements TypedTag { diff --git a/src/PhpDoc/TypeNodeResolver.php b/src/PhpDoc/TypeNodeResolver.php index 6a8a409e56..18db804030 100644 --- a/src/PhpDoc/TypeNodeResolver.php +++ b/src/PhpDoc/TypeNodeResolver.php @@ -119,7 +119,7 @@ use function strtolower; use function substr; -class TypeNodeResolver +final class TypeNodeResolver { /** @var array */ diff --git a/src/PhpDoc/TypeNodeResolverExtensionAwareRegistry.php b/src/PhpDoc/TypeNodeResolverExtensionAwareRegistry.php index a41b9c631c..a525078b2e 100644 --- a/src/PhpDoc/TypeNodeResolverExtensionAwareRegistry.php +++ b/src/PhpDoc/TypeNodeResolverExtensionAwareRegistry.php @@ -2,7 +2,7 @@ namespace PHPStan\PhpDoc; -class TypeNodeResolverExtensionAwareRegistry implements TypeNodeResolverExtensionRegistry +final class TypeNodeResolverExtensionAwareRegistry implements TypeNodeResolverExtensionRegistry { /** diff --git a/src/PhpDoc/TypeStringResolver.php b/src/PhpDoc/TypeStringResolver.php index 91333363ed..2bdb4ff94f 100644 --- a/src/PhpDoc/TypeStringResolver.php +++ b/src/PhpDoc/TypeStringResolver.php @@ -8,7 +8,7 @@ use PHPStan\PhpDocParser\Parser\TypeParser; use PHPStan\Type\Type; -class TypeStringResolver +final class TypeStringResolver { public function __construct(private Lexer $typeLexer, private TypeParser $typeParser, private TypeNodeResolver $typeNodeResolver) diff --git a/src/Process/CpuCoreCounter.php b/src/Process/CpuCoreCounter.php index cff6084b87..2fd49e7cfa 100644 --- a/src/Process/CpuCoreCounter.php +++ b/src/Process/CpuCoreCounter.php @@ -5,7 +5,7 @@ use Fidry\CpuCoreCounter\CpuCoreCounter as FidryCpuCoreCounter; use Fidry\CpuCoreCounter\NumberOfCpuCoreNotFound; -class CpuCoreCounter +final class CpuCoreCounter { private ?int $count = null; diff --git a/src/Process/ProcessCanceledException.php b/src/Process/ProcessCanceledException.php index 9d37c5b6ca..ae42c75d3b 100644 --- a/src/Process/ProcessCanceledException.php +++ b/src/Process/ProcessCanceledException.php @@ -4,7 +4,7 @@ use Exception; -class ProcessCanceledException extends Exception +final class ProcessCanceledException extends Exception { } diff --git a/src/Process/ProcessCrashedException.php b/src/Process/ProcessCrashedException.php index d6278a50e7..fb75a7d94d 100644 --- a/src/Process/ProcessCrashedException.php +++ b/src/Process/ProcessCrashedException.php @@ -4,7 +4,7 @@ use Exception; -class ProcessCrashedException extends Exception +final class ProcessCrashedException extends Exception { } diff --git a/src/Process/ProcessHelper.php b/src/Process/ProcessHelper.php index 2597e771a8..591e916fee 100644 --- a/src/Process/ProcessHelper.php +++ b/src/Process/ProcessHelper.php @@ -13,7 +13,7 @@ use function sprintf; use const PHP_BINARY; -class ProcessHelper +final class ProcessHelper { /** diff --git a/src/Process/ProcessPromise.php b/src/Process/ProcessPromise.php index 55e3cbcf2e..31f975460a 100644 --- a/src/Process/ProcessPromise.php +++ b/src/Process/ProcessPromise.php @@ -12,7 +12,7 @@ use function stream_get_contents; use function tmpfile; -class ProcessPromise +final class ProcessPromise { /** @var Deferred */ diff --git a/src/Reflection/Annotations/AnnotationMethodReflection.php b/src/Reflection/Annotations/AnnotationMethodReflection.php index cfd5b74e03..79445fdbe1 100644 --- a/src/Reflection/Annotations/AnnotationMethodReflection.php +++ b/src/Reflection/Annotations/AnnotationMethodReflection.php @@ -13,7 +13,7 @@ use PHPStan\Type\ThisType; use PHPStan\Type\Type; -class AnnotationMethodReflection implements ExtendedMethodReflection +final class AnnotationMethodReflection implements ExtendedMethodReflection { /** @var FunctionVariantWithPhpDocs[]|null */ diff --git a/src/Reflection/Annotations/AnnotationPropertyReflection.php b/src/Reflection/Annotations/AnnotationPropertyReflection.php index 6fe9b9d125..e6506a4a21 100644 --- a/src/Reflection/Annotations/AnnotationPropertyReflection.php +++ b/src/Reflection/Annotations/AnnotationPropertyReflection.php @@ -7,7 +7,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class AnnotationPropertyReflection implements PropertyReflection +final class AnnotationPropertyReflection implements PropertyReflection { public function __construct( diff --git a/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php b/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php index fac7e5a9bb..cb86e0fec4 100644 --- a/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php +++ b/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php @@ -8,7 +8,7 @@ use PHPStan\Type\MixedType; use PHPStan\Type\Type; -class AnnotationsMethodParameterReflection implements ParameterReflectionWithPhpDocs +final class AnnotationsMethodParameterReflection implements ParameterReflectionWithPhpDocs { public function __construct(private string $name, private Type $type, private PassedByReference $passedByReference, private bool $isOptional, private bool $isVariadic, private ?Type $defaultValue) diff --git a/src/Reflection/Annotations/AnnotationsMethodsClassReflectionExtension.php b/src/Reflection/Annotations/AnnotationsMethodsClassReflectionExtension.php index 2860988c91..76fac3fa37 100644 --- a/src/Reflection/Annotations/AnnotationsMethodsClassReflectionExtension.php +++ b/src/Reflection/Annotations/AnnotationsMethodsClassReflectionExtension.php @@ -16,7 +16,7 @@ use function array_map; use function count; -class AnnotationsMethodsClassReflectionExtension implements MethodsClassReflectionExtension +final class AnnotationsMethodsClassReflectionExtension implements MethodsClassReflectionExtension { /** @var ExtendedMethodReflection[][] */ diff --git a/src/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtension.php b/src/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtension.php index 3ef4959ab8..3a12dcdefb 100644 --- a/src/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtension.php +++ b/src/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtension.php @@ -9,7 +9,7 @@ use PHPStan\Type\Generic\TemplateTypeVariance; use PHPStan\Type\NeverType; -class AnnotationsPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension +final class AnnotationsPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension { /** @var PropertyReflection[][] */ diff --git a/src/Reflection/Assertions.php b/src/Reflection/Assertions.php index 6adb97136c..988652d0d4 100644 --- a/src/Reflection/Assertions.php +++ b/src/Reflection/Assertions.php @@ -12,6 +12,7 @@ /** * @api + * @final */ class Assertions { diff --git a/src/Reflection/BetterReflection/BetterReflectionProvider.php b/src/Reflection/BetterReflection/BetterReflectionProvider.php index 67166c39d1..8ec65fd9d2 100644 --- a/src/Reflection/BetterReflection/BetterReflectionProvider.php +++ b/src/Reflection/BetterReflection/BetterReflectionProvider.php @@ -55,7 +55,7 @@ use function strtolower; use const PHP_VERSION_ID; -class BetterReflectionProvider implements ReflectionProvider +final class BetterReflectionProvider implements ReflectionProvider { /** @var FunctionReflection[] */ diff --git a/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php b/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php index f9c3649cf9..8632d6b59c 100644 --- a/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php +++ b/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php @@ -30,7 +30,7 @@ use function is_dir; use function is_file; -class BetterReflectionSourceLocatorFactory +final class BetterReflectionSourceLocatorFactory { /** diff --git a/src/Reflection/BetterReflection/SourceLocator/AutoloadFunctionsSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/AutoloadFunctionsSourceLocator.php index 2acb010ad7..7070fc318b 100644 --- a/src/Reflection/BetterReflection/SourceLocator/AutoloadFunctionsSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/AutoloadFunctionsSourceLocator.php @@ -12,7 +12,7 @@ use function PHPStan\autoloadFunctions; use function trait_exists; -class AutoloadFunctionsSourceLocator implements SourceLocator +final class AutoloadFunctionsSourceLocator implements SourceLocator { public function __construct( diff --git a/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php index 969d978333..7506682426 100644 --- a/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php @@ -47,7 +47,7 @@ * * Modified code from Roave/BetterReflection, Copyright (c) 2017 Roave, LLC. */ -class AutoloadSourceLocator implements SourceLocator +final class AutoloadSourceLocator implements SourceLocator { /** @var array{classes: array, functions: array, constants: array} */ diff --git a/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php b/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php index 7e8367df3c..3a6d194395 100644 --- a/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php +++ b/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php @@ -12,7 +12,7 @@ use PHPStan\Reflection\ConstantNameHelper; use function strtolower; -class CachingVisitor extends NodeVisitorAbstract +final class CachingVisitor extends NodeVisitorAbstract { private string $fileName; diff --git a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php index 3d123ccfe2..9e687100f7 100644 --- a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php +++ b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php @@ -25,7 +25,7 @@ use function str_contains; use const GLOB_ONLYDIR; -class ComposerJsonAndInstalledJsonSourceLocatorMaker +final class ComposerJsonAndInstalledJsonSourceLocatorMaker { public function __construct( diff --git a/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php b/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php index 89e33adb3d..70eaadffbe 100644 --- a/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php +++ b/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php @@ -8,7 +8,7 @@ /** * @template-covariant T of Node */ -class FetchedNode +final class FetchedNode { /** diff --git a/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php b/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php index aa98107ae3..ac90178d49 100644 --- a/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php +++ b/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php @@ -4,7 +4,7 @@ use PhpParser\Node; -class FetchedNodesResult +final class FetchedNodesResult { /** diff --git a/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php b/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php index 0fa3440e29..bd6892cf88 100644 --- a/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php +++ b/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php @@ -7,7 +7,7 @@ use PHPStan\Parser\Parser; use PHPStan\Parser\ParserErrorsException; -class FileNodesFetcher +final class FileNodesFetcher { public function __construct( diff --git a/src/Reflection/BetterReflection/SourceLocator/NewOptimizedDirectorySourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/NewOptimizedDirectorySourceLocator.php index 557ac4848c..cc939049bc 100644 --- a/src/Reflection/BetterReflection/SourceLocator/NewOptimizedDirectorySourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/NewOptimizedDirectorySourceLocator.php @@ -16,7 +16,7 @@ use function current; use function strtolower; -class NewOptimizedDirectorySourceLocator implements SourceLocator +final class NewOptimizedDirectorySourceLocator implements SourceLocator { /** diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php index b6fc6e471c..32fabbc757 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php @@ -27,7 +27,7 @@ /** * @deprecated Use NewOptimizedDirectorySourceLocator */ -class OptimizedDirectorySourceLocator implements SourceLocator +final class OptimizedDirectorySourceLocator implements SourceLocator { private PhpFileCleaner $cleaner; diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php index a147d1872e..864f1fff21 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php @@ -17,7 +17,7 @@ use function sprintf; use function strtolower; -class OptimizedDirectorySourceLocatorFactory +final class OptimizedDirectorySourceLocatorFactory { private PhpFileCleaner $cleaner; diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php index c636424c2f..25f5bd3e84 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php @@ -4,7 +4,7 @@ use function array_key_exists; -class OptimizedDirectorySourceLocatorRepository +final class OptimizedDirectorySourceLocatorRepository { /** @var array */ diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php index 7abfec64da..78fb07f24d 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php @@ -10,7 +10,7 @@ use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; use function is_file; -class OptimizedPsrAutoloaderLocator implements SourceLocator +final class OptimizedPsrAutoloaderLocator implements SourceLocator { /** @var array */ diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php index 982a372d4a..4285d93bbd 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php @@ -18,7 +18,7 @@ use function array_keys; use function strtolower; -class OptimizedSingleFileSourceLocator implements SourceLocator +final class OptimizedSingleFileSourceLocator implements SourceLocator { /** @var array{classes: array, functions: array, constants: array}|null */ diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php index 59e26df126..bd857f7489 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php @@ -4,7 +4,7 @@ use function array_key_exists; -class OptimizedSingleFileSourceLocatorRepository +final class OptimizedSingleFileSourceLocatorRepository { /** @var array */ diff --git a/src/Reflection/BetterReflection/SourceLocator/PhpFileCleaner.php b/src/Reflection/BetterReflection/SourceLocator/PhpFileCleaner.php index 6e76066fee..84985abbce 100644 --- a/src/Reflection/BetterReflection/SourceLocator/PhpFileCleaner.php +++ b/src/Reflection/BetterReflection/SourceLocator/PhpFileCleaner.php @@ -14,7 +14,7 @@ * @author Jordi Boggiano * @see https://github.com/composer/composer/pull/10107 */ -class PhpFileCleaner +final class PhpFileCleaner { /** @var array */ diff --git a/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php index 0731d733b0..f2225f9b8f 100644 --- a/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php @@ -9,7 +9,7 @@ use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; -class PhpVersionBlacklistSourceLocator implements SourceLocator +final class PhpVersionBlacklistSourceLocator implements SourceLocator { public function __construct( diff --git a/src/Reflection/BetterReflection/SourceLocator/ReflectionClassSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/ReflectionClassSourceLocator.php index 1e20425451..604b1ad58d 100644 --- a/src/Reflection/BetterReflection/SourceLocator/ReflectionClassSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/ReflectionClassSourceLocator.php @@ -12,7 +12,7 @@ use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; use ReflectionClass; -class ReflectionClassSourceLocator implements SourceLocator +final class ReflectionClassSourceLocator implements SourceLocator { public function __construct( diff --git a/src/Reflection/BetterReflection/SourceLocator/RewriteClassAliasSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/RewriteClassAliasSourceLocator.php index 3993684ddd..564950462f 100644 --- a/src/Reflection/BetterReflection/SourceLocator/RewriteClassAliasSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/RewriteClassAliasSourceLocator.php @@ -12,7 +12,7 @@ use function interface_exists; use function trait_exists; -class RewriteClassAliasSourceLocator implements SourceLocator +final class RewriteClassAliasSourceLocator implements SourceLocator { public function __construct(private SourceLocator $originalSourceLocator) diff --git a/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php index fc8e931ffe..2b4f272646 100644 --- a/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php @@ -10,7 +10,7 @@ use ReflectionClass; use function class_exists; -class SkipClassAliasSourceLocator implements SourceLocator +final class SkipClassAliasSourceLocator implements SourceLocator { public function __construct(private SourceLocator $sourceLocator) diff --git a/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php b/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php index 3d5615b24f..9ea23cd6a9 100644 --- a/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php +++ b/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php @@ -7,7 +7,7 @@ use PHPStan\Node\Printer\Printer; use PHPStan\Php\PhpVersion; -class PhpStormStubsSourceStubberFactory +final class PhpStormStubsSourceStubberFactory { public function __construct(private Parser $phpParser, private Printer $printer, private PhpVersion $phpVersion) diff --git a/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php b/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php index 04da7cd605..8f7533ba5f 100644 --- a/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php +++ b/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php @@ -6,7 +6,7 @@ use PHPStan\Node\Printer\Printer; use PHPStan\Php\PhpVersion; -class ReflectionSourceStubberFactory +final class ReflectionSourceStubberFactory { public function __construct(private Printer $printer, private PhpVersion $phpVersion) diff --git a/src/Reflection/CallableFunctionVariantWithPhpDocs.php b/src/Reflection/CallableFunctionVariantWithPhpDocs.php index f9a8c002c6..8b8aa99567 100644 --- a/src/Reflection/CallableFunctionVariantWithPhpDocs.php +++ b/src/Reflection/CallableFunctionVariantWithPhpDocs.php @@ -11,7 +11,7 @@ use PHPStan\Type\Generic\TemplateTypeVarianceMap; use PHPStan\Type\Type; -class CallableFunctionVariantWithPhpDocs extends FunctionVariantWithPhpDocs implements CallableParametersAcceptor +final class CallableFunctionVariantWithPhpDocs extends FunctionVariantWithPhpDocs implements CallableParametersAcceptor { /** diff --git a/src/Reflection/Callables/FunctionCallableVariant.php b/src/Reflection/Callables/FunctionCallableVariant.php index f2a338946a..992d53d13a 100644 --- a/src/Reflection/Callables/FunctionCallableVariant.php +++ b/src/Reflection/Callables/FunctionCallableVariant.php @@ -16,7 +16,7 @@ use function array_map; use function count; -class FunctionCallableVariant implements CallableParametersAcceptor, ParametersAcceptorWithPhpDocs +final class FunctionCallableVariant implements CallableParametersAcceptor, ParametersAcceptorWithPhpDocs { /** @var SimpleThrowPoint[]|null */ diff --git a/src/Reflection/Callables/SimpleImpurePoint.php b/src/Reflection/Callables/SimpleImpurePoint.php index 91b807b3ad..79a3c96761 100644 --- a/src/Reflection/Callables/SimpleImpurePoint.php +++ b/src/Reflection/Callables/SimpleImpurePoint.php @@ -11,7 +11,7 @@ /** * @phpstan-import-type ImpurePointIdentifier from ImpurePoint */ -class SimpleImpurePoint +final class SimpleImpurePoint { /** diff --git a/src/Reflection/Callables/SimpleThrowPoint.php b/src/Reflection/Callables/SimpleThrowPoint.php index 6a32d4eacd..5cde43a155 100644 --- a/src/Reflection/Callables/SimpleThrowPoint.php +++ b/src/Reflection/Callables/SimpleThrowPoint.php @@ -6,7 +6,7 @@ use PHPStan\Type\Type; use Throwable; -class SimpleThrowPoint +final class SimpleThrowPoint { private function __construct( diff --git a/src/Reflection/ClassConstantReflection.php b/src/Reflection/ClassConstantReflection.php index fd69ce8129..f54fc37ba4 100644 --- a/src/Reflection/ClassConstantReflection.php +++ b/src/Reflection/ClassConstantReflection.php @@ -10,7 +10,10 @@ use PHPStan\Type\TypehintHelper; use const NAN; -/** @api */ +/** + * @api + * @final + */ class ClassConstantReflection implements ConstantReflection { diff --git a/src/Reflection/ClassNameHelper.php b/src/Reflection/ClassNameHelper.php index adf7905bfc..8fe817e91d 100644 --- a/src/Reflection/ClassNameHelper.php +++ b/src/Reflection/ClassNameHelper.php @@ -5,7 +5,7 @@ use Nette\Utils\Strings; use function ltrim; -class ClassNameHelper +final class ClassNameHelper { public static function isValidClassName(string $name): bool diff --git a/src/Reflection/ClassReflection.php b/src/Reflection/ClassReflection.php index 7c9a569dcc..4c7410e2f0 100644 --- a/src/Reflection/ClassReflection.php +++ b/src/Reflection/ClassReflection.php @@ -69,7 +69,10 @@ use function sprintf; use function strtolower; -/** @api */ +/** + * @api + * @final + */ class ClassReflection { diff --git a/src/Reflection/ClassReflectionExtensionRegistry.php b/src/Reflection/ClassReflectionExtensionRegistry.php index 6ba9c4d28a..2dd864952a 100644 --- a/src/Reflection/ClassReflectionExtensionRegistry.php +++ b/src/Reflection/ClassReflectionExtensionRegistry.php @@ -7,7 +7,7 @@ use PHPStan\Reflection\RequireExtension\RequireExtendsPropertiesClassReflectionExtension; use function array_merge; -class ClassReflectionExtensionRegistry +final class ClassReflectionExtensionRegistry { /** diff --git a/src/Reflection/Constant/RuntimeConstantReflection.php b/src/Reflection/Constant/RuntimeConstantReflection.php index 7bc10879f4..9940b28505 100644 --- a/src/Reflection/Constant/RuntimeConstantReflection.php +++ b/src/Reflection/Constant/RuntimeConstantReflection.php @@ -6,7 +6,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class RuntimeConstantReflection implements GlobalConstantReflection +final class RuntimeConstantReflection implements GlobalConstantReflection { public function __construct( diff --git a/src/Reflection/ConstantNameHelper.php b/src/Reflection/ConstantNameHelper.php index cd4b526a77..45b65f43a6 100644 --- a/src/Reflection/ConstantNameHelper.php +++ b/src/Reflection/ConstantNameHelper.php @@ -10,7 +10,7 @@ use function str_contains; use function strtolower; -class ConstantNameHelper +final class ConstantNameHelper { public static function normalize(string $name): string diff --git a/src/Reflection/Dummy/ChangedTypeMethodReflection.php b/src/Reflection/Dummy/ChangedTypeMethodReflection.php index 4fc7daca3d..351d90b467 100644 --- a/src/Reflection/Dummy/ChangedTypeMethodReflection.php +++ b/src/Reflection/Dummy/ChangedTypeMethodReflection.php @@ -11,7 +11,7 @@ use PHPStan\Type\Type; use function is_bool; -class ChangedTypeMethodReflection implements ExtendedMethodReflection +final class ChangedTypeMethodReflection implements ExtendedMethodReflection { /** diff --git a/src/Reflection/Dummy/ChangedTypePropertyReflection.php b/src/Reflection/Dummy/ChangedTypePropertyReflection.php index 018d8593fa..7391715313 100644 --- a/src/Reflection/Dummy/ChangedTypePropertyReflection.php +++ b/src/Reflection/Dummy/ChangedTypePropertyReflection.php @@ -8,7 +8,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class ChangedTypePropertyReflection implements WrapperPropertyReflection +final class ChangedTypePropertyReflection implements WrapperPropertyReflection { public function __construct(private ClassReflection $declaringClass, private PropertyReflection $reflection, private Type $readableType, private Type $writableType) diff --git a/src/Reflection/Dummy/DummyConstantReflection.php b/src/Reflection/Dummy/DummyConstantReflection.php index 2f2ef828ec..330c77562c 100644 --- a/src/Reflection/Dummy/DummyConstantReflection.php +++ b/src/Reflection/Dummy/DummyConstantReflection.php @@ -12,7 +12,7 @@ use PHPStan\Type\Type; use stdClass; -class DummyConstantReflection implements ConstantReflection +final class DummyConstantReflection implements ConstantReflection { public function __construct(private string $name) diff --git a/src/Reflection/Dummy/DummyConstructorReflection.php b/src/Reflection/Dummy/DummyConstructorReflection.php index b3cdde365f..4c98f8d596 100644 --- a/src/Reflection/Dummy/DummyConstructorReflection.php +++ b/src/Reflection/Dummy/DummyConstructorReflection.php @@ -13,7 +13,7 @@ use PHPStan\Type\Type; use PHPStan\Type\VoidType; -class DummyConstructorReflection implements ExtendedMethodReflection +final class DummyConstructorReflection implements ExtendedMethodReflection { public function __construct(private ClassReflection $declaringClass) diff --git a/src/Reflection/Dummy/DummyMethodReflection.php b/src/Reflection/Dummy/DummyMethodReflection.php index 806c24c815..d26ea0c4be 100644 --- a/src/Reflection/Dummy/DummyMethodReflection.php +++ b/src/Reflection/Dummy/DummyMethodReflection.php @@ -12,7 +12,7 @@ use PHPStan\Type\Type; use stdClass; -class DummyMethodReflection implements ExtendedMethodReflection +final class DummyMethodReflection implements ExtendedMethodReflection { public function __construct(private string $name) diff --git a/src/Reflection/Dummy/DummyPropertyReflection.php b/src/Reflection/Dummy/DummyPropertyReflection.php index b72a011960..90ef29825e 100644 --- a/src/Reflection/Dummy/DummyPropertyReflection.php +++ b/src/Reflection/Dummy/DummyPropertyReflection.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use stdClass; -class DummyPropertyReflection implements PropertyReflection +final class DummyPropertyReflection implements PropertyReflection { public function getDeclaringClass(): ClassReflection diff --git a/src/Reflection/EnumCaseReflection.php b/src/Reflection/EnumCaseReflection.php index b538f44b3f..234ccbf95b 100644 --- a/src/Reflection/EnumCaseReflection.php +++ b/src/Reflection/EnumCaseReflection.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class EnumCaseReflection { diff --git a/src/Reflection/FunctionVariant.php b/src/Reflection/FunctionVariant.php index 3c5947ac5c..b6023cae16 100644 --- a/src/Reflection/FunctionVariant.php +++ b/src/Reflection/FunctionVariant.php @@ -6,7 +6,9 @@ use PHPStan\Type\Generic\TemplateTypeVarianceMap; use PHPStan\Type\Type; -/** @api */ +/** + * @api + */ class FunctionVariant implements ParametersAcceptor { diff --git a/src/Reflection/FunctionVariantWithPhpDocs.php b/src/Reflection/FunctionVariantWithPhpDocs.php index 2efd1c1a97..0b047b08b5 100644 --- a/src/Reflection/FunctionVariantWithPhpDocs.php +++ b/src/Reflection/FunctionVariantWithPhpDocs.php @@ -6,7 +6,9 @@ use PHPStan\Type\Generic\TemplateTypeVarianceMap; use PHPStan\Type\Type; -/** @api */ +/** + * @api + */ class FunctionVariantWithPhpDocs extends FunctionVariant implements ParametersAcceptorWithPhpDocs { diff --git a/src/Reflection/GenericParametersAcceptorResolver.php b/src/Reflection/GenericParametersAcceptorResolver.php index edbb692931..09e9968a1a 100644 --- a/src/Reflection/GenericParametersAcceptorResolver.php +++ b/src/Reflection/GenericParametersAcceptorResolver.php @@ -18,7 +18,7 @@ use function count; use function is_int; -class GenericParametersAcceptorResolver +final class GenericParametersAcceptorResolver { /** diff --git a/src/Reflection/InaccessibleMethod.php b/src/Reflection/InaccessibleMethod.php index 5b8504a7d6..58b63fe1c5 100644 --- a/src/Reflection/InaccessibleMethod.php +++ b/src/Reflection/InaccessibleMethod.php @@ -10,7 +10,7 @@ use PHPStan\Type\MixedType; use PHPStan\Type\Type; -class InaccessibleMethod implements CallableParametersAcceptor +final class InaccessibleMethod implements CallableParametersAcceptor { public function __construct(private MethodReflection $methodReflection) diff --git a/src/Reflection/InitializerExprContext.php b/src/Reflection/InitializerExprContext.php index c6e2f890a8..4289056bcf 100644 --- a/src/Reflection/InitializerExprContext.php +++ b/src/Reflection/InitializerExprContext.php @@ -15,7 +15,10 @@ use function implode; use function sprintf; -/** @api */ +/** + * @api + * @final + */ class InitializerExprContext implements NamespaceAnswerer { diff --git a/src/Reflection/InitializerExprTypeResolver.php b/src/Reflection/InitializerExprTypeResolver.php index 3eee9061b6..9c510755ff 100644 --- a/src/Reflection/InitializerExprTypeResolver.php +++ b/src/Reflection/InitializerExprTypeResolver.php @@ -88,7 +88,7 @@ use function strtolower; use const INF; -class InitializerExprTypeResolver +final class InitializerExprTypeResolver { public const CALCULATE_SCALARS_LIMIT = 128; diff --git a/src/Reflection/MethodPrototypeReflection.php b/src/Reflection/MethodPrototypeReflection.php index cf1a6ff76b..c92c6c5b74 100644 --- a/src/Reflection/MethodPrototypeReflection.php +++ b/src/Reflection/MethodPrototypeReflection.php @@ -4,7 +4,7 @@ use PHPStan\Type\Type; -class MethodPrototypeReflection implements ClassMemberReflection +final class MethodPrototypeReflection implements ClassMemberReflection { /** diff --git a/src/Reflection/MissingConstantFromReflectionException.php b/src/Reflection/MissingConstantFromReflectionException.php index 230ba5902d..e57d3c3f4f 100644 --- a/src/Reflection/MissingConstantFromReflectionException.php +++ b/src/Reflection/MissingConstantFromReflectionException.php @@ -5,7 +5,7 @@ use Exception; use function sprintf; -class MissingConstantFromReflectionException extends Exception +final class MissingConstantFromReflectionException extends Exception { public function __construct( diff --git a/src/Reflection/MissingMethodFromReflectionException.php b/src/Reflection/MissingMethodFromReflectionException.php index 49c7778cd6..48051aafc1 100644 --- a/src/Reflection/MissingMethodFromReflectionException.php +++ b/src/Reflection/MissingMethodFromReflectionException.php @@ -5,7 +5,7 @@ use Exception; use function sprintf; -class MissingMethodFromReflectionException extends Exception +final class MissingMethodFromReflectionException extends Exception { public function __construct( diff --git a/src/Reflection/MissingPropertyFromReflectionException.php b/src/Reflection/MissingPropertyFromReflectionException.php index 4d62565c1f..2e64aee94c 100644 --- a/src/Reflection/MissingPropertyFromReflectionException.php +++ b/src/Reflection/MissingPropertyFromReflectionException.php @@ -5,7 +5,7 @@ use Exception; use function sprintf; -class MissingPropertyFromReflectionException extends Exception +final class MissingPropertyFromReflectionException extends Exception { public function __construct( diff --git a/src/Reflection/Mixin/MixinMethodReflection.php b/src/Reflection/Mixin/MixinMethodReflection.php index 745a8cae15..15fc4d8ad8 100644 --- a/src/Reflection/Mixin/MixinMethodReflection.php +++ b/src/Reflection/Mixin/MixinMethodReflection.php @@ -8,7 +8,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class MixinMethodReflection implements MethodReflection +final class MixinMethodReflection implements MethodReflection { public function __construct(private MethodReflection $reflection, private bool $static) diff --git a/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php b/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php index 484690a8b7..68ccf90ed9 100644 --- a/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php +++ b/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php @@ -11,7 +11,7 @@ use function array_intersect; use function count; -class MixinMethodsClassReflectionExtension implements MethodsClassReflectionExtension +final class MixinMethodsClassReflectionExtension implements MethodsClassReflectionExtension { /** @var array> */ diff --git a/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php b/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php index b891da3894..8e6d32054f 100644 --- a/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php +++ b/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php @@ -11,7 +11,7 @@ use function array_intersect; use function count; -class MixinPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension +final class MixinPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension { /** @var array> */ diff --git a/src/Reflection/Native/NativeFunctionReflection.php b/src/Reflection/Native/NativeFunctionReflection.php index ff52194908..870f0b7c66 100644 --- a/src/Reflection/Native/NativeFunctionReflection.php +++ b/src/Reflection/Native/NativeFunctionReflection.php @@ -8,7 +8,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class NativeFunctionReflection implements FunctionReflection +final class NativeFunctionReflection implements FunctionReflection { private Assertions $assertions; diff --git a/src/Reflection/Native/NativeMethodReflection.php b/src/Reflection/Native/NativeMethodReflection.php index 3112fefa48..7c60edd6cc 100644 --- a/src/Reflection/Native/NativeMethodReflection.php +++ b/src/Reflection/Native/NativeMethodReflection.php @@ -16,7 +16,7 @@ use ReflectionException; use function strtolower; -class NativeMethodReflection implements ExtendedMethodReflection +final class NativeMethodReflection implements ExtendedMethodReflection { /** diff --git a/src/Reflection/Native/NativeParameterReflection.php b/src/Reflection/Native/NativeParameterReflection.php index 7f92bfdb5e..bdfce9f04c 100644 --- a/src/Reflection/Native/NativeParameterReflection.php +++ b/src/Reflection/Native/NativeParameterReflection.php @@ -7,7 +7,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class NativeParameterReflection implements ParameterReflection +final class NativeParameterReflection implements ParameterReflection { public function __construct( diff --git a/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php b/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php index 3a81fbb4da..3e303b82b9 100644 --- a/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php +++ b/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php @@ -7,7 +7,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class NativeParameterWithPhpDocsReflection implements ParameterReflectionWithPhpDocs +final class NativeParameterWithPhpDocsReflection implements ParameterReflectionWithPhpDocs { public function __construct( diff --git a/src/Reflection/PHPStan/NativeReflectionEnumReturnDynamicReturnTypeExtension.php b/src/Reflection/PHPStan/NativeReflectionEnumReturnDynamicReturnTypeExtension.php index d0b71b91a7..683a341f2e 100644 --- a/src/Reflection/PHPStan/NativeReflectionEnumReturnDynamicReturnTypeExtension.php +++ b/src/Reflection/PHPStan/NativeReflectionEnumReturnDynamicReturnTypeExtension.php @@ -11,7 +11,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; -class NativeReflectionEnumReturnDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class NativeReflectionEnumReturnDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { public function __construct(private PhpVersion $phpVersion, private string $className, private string $methodName) diff --git a/src/Reflection/ParametersAcceptorSelector.php b/src/Reflection/ParametersAcceptorSelector.php index 33f536fe49..5cbdbd2907 100644 --- a/src/Reflection/ParametersAcceptorSelector.php +++ b/src/Reflection/ParametersAcceptorSelector.php @@ -53,7 +53,10 @@ use const ARRAY_FILTER_USE_KEY; use const CURLOPT_SSL_VERIFYHOST; -/** @api */ +/** + * @api + * @final + */ class ParametersAcceptorSelector { diff --git a/src/Reflection/PassedByReference.php b/src/Reflection/PassedByReference.php index d4741bc1b6..5a6bbd4a04 100644 --- a/src/Reflection/PassedByReference.php +++ b/src/Reflection/PassedByReference.php @@ -4,7 +4,10 @@ use function array_key_exists; -/** @api */ +/** + * @api + * @final + */ class PassedByReference { diff --git a/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php b/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php index bd3c9b54ed..abeb693630 100644 --- a/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php +++ b/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php @@ -7,7 +7,7 @@ use PHPStan\Type\ClosureType; use PHPStan\Type\Type; -class ClosureCallUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection +final class ClosureCallUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection { public function __construct(private UnresolvedMethodPrototypeReflection $prototype, private ClosureType $closure) diff --git a/src/Reflection/Php/DummyParameterWithPhpDocs.php b/src/Reflection/Php/DummyParameterWithPhpDocs.php index 262b601bea..c7d8cc141c 100644 --- a/src/Reflection/Php/DummyParameterWithPhpDocs.php +++ b/src/Reflection/Php/DummyParameterWithPhpDocs.php @@ -7,7 +7,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class DummyParameterWithPhpDocs extends DummyParameter implements ParameterReflectionWithPhpDocs +final class DummyParameterWithPhpDocs extends DummyParameter implements ParameterReflectionWithPhpDocs { public function __construct( diff --git a/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php b/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php index 3ba005da82..04f4fbe8e7 100644 --- a/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php +++ b/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php @@ -7,7 +7,7 @@ use PHPStan\Type\Enum\EnumCaseObjectType; use function array_keys; -class EnumAllowedSubTypesClassReflectionExtension implements AllowedSubTypesClassReflectionExtension +final class EnumAllowedSubTypesClassReflectionExtension implements AllowedSubTypesClassReflectionExtension { public function supports(ClassReflection $classReflection): bool diff --git a/src/Reflection/Php/EnumCasesMethodReflection.php b/src/Reflection/Php/EnumCasesMethodReflection.php index 0665eee656..b66c18b805 100644 --- a/src/Reflection/Php/EnumCasesMethodReflection.php +++ b/src/Reflection/Php/EnumCasesMethodReflection.php @@ -13,7 +13,7 @@ use PHPStan\Type\MixedType; use PHPStan\Type\Type; -class EnumCasesMethodReflection implements ExtendedMethodReflection +final class EnumCasesMethodReflection implements ExtendedMethodReflection { public function __construct(private ClassReflection $declaringClass, private Type $returnType) diff --git a/src/Reflection/Php/EnumPropertyReflection.php b/src/Reflection/Php/EnumPropertyReflection.php index e3f7927dec..96cdfca07d 100644 --- a/src/Reflection/Php/EnumPropertyReflection.php +++ b/src/Reflection/Php/EnumPropertyReflection.php @@ -7,7 +7,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class EnumPropertyReflection implements PropertyReflection +final class EnumPropertyReflection implements PropertyReflection { public function __construct(private ClassReflection $declaringClass, private Type $type) diff --git a/src/Reflection/Php/EnumUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Php/EnumUnresolvedPropertyPrototypeReflection.php index 5d76711ce4..a9ea2848c9 100644 --- a/src/Reflection/Php/EnumUnresolvedPropertyPrototypeReflection.php +++ b/src/Reflection/Php/EnumUnresolvedPropertyPrototypeReflection.php @@ -6,7 +6,7 @@ use PHPStan\Reflection\Type\UnresolvedPropertyPrototypeReflection; use PHPStan\Type\Type; -class EnumUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection +final class EnumUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection { public function __construct(private EnumPropertyReflection $property) diff --git a/src/Reflection/Php/NativeBuiltinMethodReflection.php b/src/Reflection/Php/NativeBuiltinMethodReflection.php index 2f10d431c5..ba559afac7 100644 --- a/src/Reflection/Php/NativeBuiltinMethodReflection.php +++ b/src/Reflection/Php/NativeBuiltinMethodReflection.php @@ -3,7 +3,6 @@ namespace PHPStan\Reflection\Php; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass; -use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionIntersectionType; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionMethod; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType; @@ -11,7 +10,7 @@ use PHPStan\BetterReflection\Reflection\Adapter\ReflectionUnionType; use PHPStan\TrinaryLogic; -class NativeBuiltinMethodReflection implements BuiltinMethodReflection +final class NativeBuiltinMethodReflection implements BuiltinMethodReflection { public function __construct(private ReflectionMethod $reflection) @@ -23,7 +22,7 @@ public function getName(): string return $this->reflection->getName(); } - public function getReflection(): ?ReflectionMethod + public function getReflection(): ReflectionMethod { return $this->reflection; } @@ -38,7 +37,7 @@ public function getFileName(): ?string return $fileName; } - public function getDeclaringClass(): ReflectionClass|ReflectionEnum + public function getDeclaringClass(): ReflectionClass { return $this->reflection->getDeclaringClass(); } diff --git a/src/Reflection/Php/PhpClassReflectionExtension.php b/src/Reflection/Php/PhpClassReflectionExtension.php index f3ff0aa2ab..d99bbf8955 100644 --- a/src/Reflection/Php/PhpClassReflectionExtension.php +++ b/src/Reflection/Php/PhpClassReflectionExtension.php @@ -60,7 +60,7 @@ use function sprintf; use function strtolower; -class PhpClassReflectionExtension +final class PhpClassReflectionExtension implements PropertiesClassReflectionExtension, MethodsClassReflectionExtension { diff --git a/src/Reflection/Php/PhpFunctionReflection.php b/src/Reflection/Php/PhpFunctionReflection.php index d437c86f5e..ed04458668 100644 --- a/src/Reflection/Php/PhpFunctionReflection.php +++ b/src/Reflection/Php/PhpFunctionReflection.php @@ -31,7 +31,7 @@ use function sprintf; use function time; -class PhpFunctionReflection implements FunctionReflection +final class PhpFunctionReflection implements FunctionReflection { /** @var FunctionVariantWithPhpDocs[]|null */ diff --git a/src/Reflection/Php/PhpMethodFromParserNodeReflection.php b/src/Reflection/Php/PhpMethodFromParserNodeReflection.php index 7e858b714e..a05f550105 100644 --- a/src/Reflection/Php/PhpMethodFromParserNodeReflection.php +++ b/src/Reflection/Php/PhpMethodFromParserNodeReflection.php @@ -25,6 +25,7 @@ /** * @api + * @final */ class PhpMethodFromParserNodeReflection extends PhpFunctionFromParserNodeReflection implements ExtendedMethodReflection { diff --git a/src/Reflection/Php/PhpMethodReflection.php b/src/Reflection/Php/PhpMethodReflection.php index 0fba6c34ce..ce6306bada 100644 --- a/src/Reflection/Php/PhpMethodReflection.php +++ b/src/Reflection/Php/PhpMethodReflection.php @@ -45,7 +45,10 @@ use function time; use const PHP_VERSION_ID; -/** @api */ +/** + * @api + * @final + */ class PhpMethodReflection implements ExtendedMethodReflection { diff --git a/src/Reflection/Php/PhpParameterFromParserNodeReflection.php b/src/Reflection/Php/PhpParameterFromParserNodeReflection.php index 9dd5a25958..61d1852c7d 100644 --- a/src/Reflection/Php/PhpParameterFromParserNodeReflection.php +++ b/src/Reflection/Php/PhpParameterFromParserNodeReflection.php @@ -10,7 +10,7 @@ use PHPStan\Type\TypeCombinator; use PHPStan\Type\TypehintHelper; -class PhpParameterFromParserNodeReflection implements ParameterReflectionWithPhpDocs +final class PhpParameterFromParserNodeReflection implements ParameterReflectionWithPhpDocs { private ?Type $type = null; diff --git a/src/Reflection/Php/PhpParameterReflection.php b/src/Reflection/Php/PhpParameterReflection.php index 0e6ce5ae77..26cb1be007 100644 --- a/src/Reflection/Php/PhpParameterReflection.php +++ b/src/Reflection/Php/PhpParameterReflection.php @@ -13,7 +13,7 @@ use PHPStan\Type\TypeCombinator; use PHPStan\Type\TypehintHelper; -class PhpParameterReflection implements ParameterReflectionWithPhpDocs +final class PhpParameterReflection implements ParameterReflectionWithPhpDocs { private ?Type $type = null; diff --git a/src/Reflection/Php/PhpPropertyReflection.php b/src/Reflection/Php/PhpPropertyReflection.php index 00fc7e3e8e..63d7eff0d8 100644 --- a/src/Reflection/Php/PhpPropertyReflection.php +++ b/src/Reflection/Php/PhpPropertyReflection.php @@ -13,7 +13,10 @@ use PHPStan\Type\Type; use PHPStan\Type\TypehintHelper; -/** @api */ +/** + * @api + * @final + */ class PhpPropertyReflection implements PropertyReflection { diff --git a/src/Reflection/Php/SimpleXMLElementProperty.php b/src/Reflection/Php/SimpleXMLElementProperty.php index 9668d523be..dbb69f8e9f 100644 --- a/src/Reflection/Php/SimpleXMLElementProperty.php +++ b/src/Reflection/Php/SimpleXMLElementProperty.php @@ -12,7 +12,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class SimpleXMLElementProperty implements PropertyReflection +final class SimpleXMLElementProperty implements PropertyReflection { public function __construct( diff --git a/src/Reflection/Php/Soap/SoapClientMethodReflection.php b/src/Reflection/Php/Soap/SoapClientMethodReflection.php index 15a814b20a..1017888c59 100644 --- a/src/Reflection/Php/Soap/SoapClientMethodReflection.php +++ b/src/Reflection/Php/Soap/SoapClientMethodReflection.php @@ -12,7 +12,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; -class SoapClientMethodReflection implements MethodReflection +final class SoapClientMethodReflection implements MethodReflection { public function __construct(private ClassReflection $declaringClass, private string $name) @@ -87,7 +87,7 @@ public function isInternal(): TrinaryLogic return TrinaryLogic::createNo(); } - public function getThrowType(): ?Type + public function getThrowType(): Type { return new ObjectType('SoapFault'); } diff --git a/src/Reflection/Php/Soap/SoapClientMethodsClassReflectionExtension.php b/src/Reflection/Php/Soap/SoapClientMethodsClassReflectionExtension.php index 73924b6081..3db627179e 100644 --- a/src/Reflection/Php/Soap/SoapClientMethodsClassReflectionExtension.php +++ b/src/Reflection/Php/Soap/SoapClientMethodsClassReflectionExtension.php @@ -6,7 +6,7 @@ use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\MethodsClassReflectionExtension; -class SoapClientMethodsClassReflectionExtension implements MethodsClassReflectionExtension +final class SoapClientMethodsClassReflectionExtension implements MethodsClassReflectionExtension { public function hasMethod(ClassReflection $classReflection, string $methodName): bool diff --git a/src/Reflection/Php/UniversalObjectCrateProperty.php b/src/Reflection/Php/UniversalObjectCrateProperty.php index 3d766f5fee..ad10221352 100644 --- a/src/Reflection/Php/UniversalObjectCrateProperty.php +++ b/src/Reflection/Php/UniversalObjectCrateProperty.php @@ -7,7 +7,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class UniversalObjectCrateProperty implements PropertyReflection +final class UniversalObjectCrateProperty implements PropertyReflection { public function __construct( diff --git a/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php b/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php index a5aaa8443f..be769e05a0 100644 --- a/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php +++ b/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php @@ -10,7 +10,7 @@ use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\MixedType; -class UniversalObjectCratesClassReflectionExtension +final class UniversalObjectCratesClassReflectionExtension implements PropertiesClassReflectionExtension { diff --git a/src/Reflection/PhpVersionStaticAccessor.php b/src/Reflection/PhpVersionStaticAccessor.php index 909c357874..363109b7c0 100644 --- a/src/Reflection/PhpVersionStaticAccessor.php +++ b/src/Reflection/PhpVersionStaticAccessor.php @@ -5,7 +5,7 @@ use PHPStan\Php\PhpVersion; use PHPStan\ShouldNotHappenException; -class PhpVersionStaticAccessor +final class PhpVersionStaticAccessor { private static ?PhpVersion $instance = null; diff --git a/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php b/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php index e1c7e31e1f..2fccc5b3c4 100644 --- a/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php +++ b/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php @@ -4,7 +4,7 @@ use PHPStan\Reflection\ReflectionProvider; -class DirectReflectionProviderProvider implements ReflectionProviderProvider +final class DirectReflectionProviderProvider implements ReflectionProviderProvider { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Reflection/ReflectionProvider/DummyReflectionProvider.php b/src/Reflection/ReflectionProvider/DummyReflectionProvider.php index ff3e666cff..7ee5729483 100644 --- a/src/Reflection/ReflectionProvider/DummyReflectionProvider.php +++ b/src/Reflection/ReflectionProvider/DummyReflectionProvider.php @@ -11,7 +11,7 @@ use PHPStan\Reflection\ReflectionProvider; use PHPStan\ShouldNotHappenException; -class DummyReflectionProvider implements ReflectionProvider +final class DummyReflectionProvider implements ReflectionProvider { public function hasClass(string $className): bool diff --git a/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php b/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php index 9e4b1957a0..240d3d3bc5 100644 --- a/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php +++ b/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php @@ -5,7 +5,7 @@ use PHPStan\DependencyInjection\Container; use PHPStan\Reflection\ReflectionProvider; -class LazyReflectionProviderProvider implements ReflectionProviderProvider +final class LazyReflectionProviderProvider implements ReflectionProviderProvider { public function __construct(private Container $container) diff --git a/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php b/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php index b4059b7623..9d6cacd951 100644 --- a/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php +++ b/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php @@ -11,7 +11,7 @@ use PHPStan\Reflection\ReflectionProvider; use function strtolower; -class MemoizingReflectionProvider implements ReflectionProvider +final class MemoizingReflectionProvider implements ReflectionProvider { /** @var array */ diff --git a/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php b/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php index 7c9501cbdd..06441ef778 100644 --- a/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php +++ b/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php @@ -4,7 +4,7 @@ use PHPStan\Reflection\ReflectionProvider; -class ReflectionProviderFactory +final class ReflectionProviderFactory { public function __construct( diff --git a/src/Reflection/ReflectionProvider/SetterReflectionProviderProvider.php b/src/Reflection/ReflectionProvider/SetterReflectionProviderProvider.php index 9e897084cb..2ae0d7c9ff 100644 --- a/src/Reflection/ReflectionProvider/SetterReflectionProviderProvider.php +++ b/src/Reflection/ReflectionProvider/SetterReflectionProviderProvider.php @@ -4,7 +4,7 @@ use PHPStan\Reflection\ReflectionProvider; -class SetterReflectionProviderProvider implements ReflectionProviderProvider +final class SetterReflectionProviderProvider implements ReflectionProviderProvider { private ReflectionProvider $reflectionProvider; diff --git a/src/Reflection/ReflectionProviderStaticAccessor.php b/src/Reflection/ReflectionProviderStaticAccessor.php index bb772064c7..90ad0dd185 100644 --- a/src/Reflection/ReflectionProviderStaticAccessor.php +++ b/src/Reflection/ReflectionProviderStaticAccessor.php @@ -4,7 +4,7 @@ use PHPStan\ShouldNotHappenException; -class ReflectionProviderStaticAccessor +final class ReflectionProviderStaticAccessor { private static ?ReflectionProvider $instance = null; diff --git a/src/Reflection/RequireExtension/RequireExtendsMethodsClassReflectionExtension.php b/src/Reflection/RequireExtension/RequireExtendsMethodsClassReflectionExtension.php index 920c84e7d4..f439f811e9 100644 --- a/src/Reflection/RequireExtension/RequireExtendsMethodsClassReflectionExtension.php +++ b/src/Reflection/RequireExtension/RequireExtendsMethodsClassReflectionExtension.php @@ -9,7 +9,7 @@ use PHPStan\Reflection\MethodsClassReflectionExtension; use PHPStan\ShouldNotHappenException; -class RequireExtendsMethodsClassReflectionExtension implements MethodsClassReflectionExtension +final class RequireExtendsMethodsClassReflectionExtension implements MethodsClassReflectionExtension { public function hasMethod(ClassReflection $classReflection, string $methodName): bool diff --git a/src/Reflection/RequireExtension/RequireExtendsPropertiesClassReflectionExtension.php b/src/Reflection/RequireExtension/RequireExtendsPropertiesClassReflectionExtension.php index ecaa6d3109..600405d363 100644 --- a/src/Reflection/RequireExtension/RequireExtendsPropertiesClassReflectionExtension.php +++ b/src/Reflection/RequireExtension/RequireExtendsPropertiesClassReflectionExtension.php @@ -8,7 +8,7 @@ use PHPStan\Reflection\PropertyReflection; use PHPStan\ShouldNotHappenException; -class RequireExtendsPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension +final class RequireExtendsPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension { public function hasProperty(ClassReflection $classReflection, string $propertyName): bool diff --git a/src/Reflection/ResolvedFunctionVariantWithCallable.php b/src/Reflection/ResolvedFunctionVariantWithCallable.php index 4714738167..c84670be53 100644 --- a/src/Reflection/ResolvedFunctionVariantWithCallable.php +++ b/src/Reflection/ResolvedFunctionVariantWithCallable.php @@ -11,7 +11,7 @@ use PHPStan\Type\Generic\TemplateTypeVarianceMap; use PHPStan\Type\Type; -class ResolvedFunctionVariantWithCallable implements ResolvedFunctionVariant, CallableParametersAcceptor +final class ResolvedFunctionVariantWithCallable implements ResolvedFunctionVariant, CallableParametersAcceptor { /** diff --git a/src/Reflection/ResolvedFunctionVariantWithOriginal.php b/src/Reflection/ResolvedFunctionVariantWithOriginal.php index 6d72ef75bc..c9f0d94ac6 100644 --- a/src/Reflection/ResolvedFunctionVariantWithOriginal.php +++ b/src/Reflection/ResolvedFunctionVariantWithOriginal.php @@ -19,7 +19,7 @@ use function array_key_exists; use function array_map; -class ResolvedFunctionVariantWithOriginal implements ResolvedFunctionVariant +final class ResolvedFunctionVariantWithOriginal implements ResolvedFunctionVariant { /** @var ParameterReflectionWithPhpDocs[]|null */ diff --git a/src/Reflection/ResolvedMethodReflection.php b/src/Reflection/ResolvedMethodReflection.php index 31433330b8..0f4cd81a03 100644 --- a/src/Reflection/ResolvedMethodReflection.php +++ b/src/Reflection/ResolvedMethodReflection.php @@ -11,7 +11,7 @@ use PHPStan\Type\Type; use function is_bool; -class ResolvedMethodReflection implements ExtendedMethodReflection +final class ResolvedMethodReflection implements ExtendedMethodReflection { /** @var ParametersAcceptorWithPhpDocs[]|null */ diff --git a/src/Reflection/ResolvedPropertyReflection.php b/src/Reflection/ResolvedPropertyReflection.php index 7888b26abd..3e111949cb 100644 --- a/src/Reflection/ResolvedPropertyReflection.php +++ b/src/Reflection/ResolvedPropertyReflection.php @@ -10,7 +10,7 @@ use PHPStan\Type\Generic\TemplateTypeVarianceMap; use PHPStan\Type\Type; -class ResolvedPropertyReflection implements WrapperPropertyReflection +final class ResolvedPropertyReflection implements WrapperPropertyReflection { private ?Type $readableType = null; diff --git a/src/Reflection/SignatureMap/FunctionSignature.php b/src/Reflection/SignatureMap/FunctionSignature.php index 8473684acc..07886541f8 100644 --- a/src/Reflection/SignatureMap/FunctionSignature.php +++ b/src/Reflection/SignatureMap/FunctionSignature.php @@ -4,7 +4,7 @@ use PHPStan\Type\Type; -class FunctionSignature +final class FunctionSignature { /** diff --git a/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php b/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php index 66ca12c487..7f58e257fe 100644 --- a/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php +++ b/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php @@ -19,7 +19,7 @@ use function strtolower; use const CASE_LOWER; -class FunctionSignatureMapProvider implements SignatureMapProvider +final class FunctionSignatureMapProvider implements SignatureMapProvider { /** @var array */ diff --git a/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php b/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php index 7c850a582e..4b980e21d7 100644 --- a/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php +++ b/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php @@ -22,7 +22,7 @@ use function array_map; use function strtolower; -class NativeFunctionReflectionProvider +final class NativeFunctionReflectionProvider { /** @var NativeFunctionReflection[] */ diff --git a/src/Reflection/SignatureMap/ParameterSignature.php b/src/Reflection/SignatureMap/ParameterSignature.php index fc9316c300..7649825119 100644 --- a/src/Reflection/SignatureMap/ParameterSignature.php +++ b/src/Reflection/SignatureMap/ParameterSignature.php @@ -5,7 +5,7 @@ use PHPStan\Reflection\PassedByReference; use PHPStan\Type\Type; -class ParameterSignature +final class ParameterSignature { public function __construct( diff --git a/src/Reflection/SignatureMap/Php8SignatureMapProvider.php b/src/Reflection/SignatureMap/Php8SignatureMapProvider.php index d114609b35..7bfdf37f9b 100644 --- a/src/Reflection/SignatureMap/Php8SignatureMapProvider.php +++ b/src/Reflection/SignatureMap/Php8SignatureMapProvider.php @@ -31,7 +31,7 @@ use function sprintf; use function strtolower; -class Php8SignatureMapProvider implements SignatureMapProvider +final class Php8SignatureMapProvider implements SignatureMapProvider { private const DIRECTORY = __DIR__ . '/../../../vendor/phpstan/php-8-stubs'; diff --git a/src/Reflection/SignatureMap/SignatureMapParser.php b/src/Reflection/SignatureMap/SignatureMapParser.php index b74f447ffa..0652b11383 100644 --- a/src/Reflection/SignatureMap/SignatureMapParser.php +++ b/src/Reflection/SignatureMap/SignatureMapParser.php @@ -13,7 +13,7 @@ use function str_starts_with; use function substr; -class SignatureMapParser +final class SignatureMapParser { private TypeStringResolver $typeStringResolver; diff --git a/src/Reflection/SignatureMap/SignatureMapProviderFactory.php b/src/Reflection/SignatureMap/SignatureMapProviderFactory.php index 2e318eefeb..4aa6d510da 100644 --- a/src/Reflection/SignatureMap/SignatureMapProviderFactory.php +++ b/src/Reflection/SignatureMap/SignatureMapProviderFactory.php @@ -4,7 +4,7 @@ use PHPStan\Php\PhpVersion; -class SignatureMapProviderFactory +final class SignatureMapProviderFactory { public function __construct( diff --git a/src/Reflection/TrivialParametersAcceptor.php b/src/Reflection/TrivialParametersAcceptor.php index 3f663f7909..51a89fc329 100644 --- a/src/Reflection/TrivialParametersAcceptor.php +++ b/src/Reflection/TrivialParametersAcceptor.php @@ -11,7 +11,10 @@ use PHPStan\Type\Type; use function sprintf; -/** @api */ +/** + * @api + * @final + */ class TrivialParametersAcceptor implements ParametersAcceptorWithPhpDocs, CallableParametersAcceptor { diff --git a/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php index a6f23841f3..5fd19b3105 100644 --- a/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php +++ b/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php @@ -13,7 +13,7 @@ use PHPStan\Type\Type; use function array_map; -class CallbackUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection +final class CallbackUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection { /** @var callable(Type): Type */ diff --git a/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php index 5140d7296b..38b4bae4e9 100644 --- a/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php +++ b/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php @@ -8,7 +8,7 @@ use PHPStan\Reflection\ResolvedPropertyReflection; use PHPStan\Type\Type; -class CallbackUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection +final class CallbackUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection { /** @var callable(Type): Type */ diff --git a/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php index bf4421d1f7..607a08a37f 100644 --- a/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php +++ b/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php @@ -15,7 +15,7 @@ use PHPStan\Type\TypeTraverser; use function array_map; -class CalledOnTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection +final class CalledOnTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection { private ?ExtendedMethodReflection $transformedMethod = null; diff --git a/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php index e9a8b8a161..6582c358b7 100644 --- a/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php +++ b/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeTraverser; -class CalledOnTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection +final class CalledOnTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection { private ?PropertyReflection $transformedProperty = null; diff --git a/src/Reflection/Type/IntersectionTypeMethodReflection.php b/src/Reflection/Type/IntersectionTypeMethodReflection.php index fb9a8ecdd3..8698e6196c 100644 --- a/src/Reflection/Type/IntersectionTypeMethodReflection.php +++ b/src/Reflection/Type/IntersectionTypeMethodReflection.php @@ -18,7 +18,7 @@ use function implode; use function is_bool; -class IntersectionTypeMethodReflection implements ExtendedMethodReflection +final class IntersectionTypeMethodReflection implements ExtendedMethodReflection { /** diff --git a/src/Reflection/Type/IntersectionTypePropertyReflection.php b/src/Reflection/Type/IntersectionTypePropertyReflection.php index e93cc59e67..e81c0b22dd 100644 --- a/src/Reflection/Type/IntersectionTypePropertyReflection.php +++ b/src/Reflection/Type/IntersectionTypePropertyReflection.php @@ -11,7 +11,7 @@ use function count; use function implode; -class IntersectionTypePropertyReflection implements PropertyReflection +final class IntersectionTypePropertyReflection implements PropertyReflection { /** diff --git a/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php index 5cda2321f1..fe3e09bd4e 100644 --- a/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php +++ b/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php @@ -7,7 +7,7 @@ use PHPStan\Type\Type; use function array_map; -class IntersectionTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection +final class IntersectionTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection { private ?ExtendedMethodReflection $transformedMethod = null; diff --git a/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php index fdfea4ebf9..ac2f0b9bcd 100644 --- a/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php +++ b/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php @@ -6,7 +6,7 @@ use PHPStan\Type\Type; use function array_map; -class IntersectionTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection +final class IntersectionTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection { private ?PropertyReflection $transformedProperty = null; diff --git a/src/Reflection/Type/UnionTypeMethodReflection.php b/src/Reflection/Type/UnionTypeMethodReflection.php index 65ca5bd674..2982f71a62 100644 --- a/src/Reflection/Type/UnionTypeMethodReflection.php +++ b/src/Reflection/Type/UnionTypeMethodReflection.php @@ -17,7 +17,7 @@ use function implode; use function is_bool; -class UnionTypeMethodReflection implements ExtendedMethodReflection +final class UnionTypeMethodReflection implements ExtendedMethodReflection { /** diff --git a/src/Reflection/Type/UnionTypePropertyReflection.php b/src/Reflection/Type/UnionTypePropertyReflection.php index d2587839c3..f23f2f1234 100644 --- a/src/Reflection/Type/UnionTypePropertyReflection.php +++ b/src/Reflection/Type/UnionTypePropertyReflection.php @@ -11,7 +11,7 @@ use function count; use function implode; -class UnionTypePropertyReflection implements PropertyReflection +final class UnionTypePropertyReflection implements PropertyReflection { /** diff --git a/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php index 9f0e62bc0c..627a1e5b80 100644 --- a/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php +++ b/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php @@ -7,7 +7,7 @@ use PHPStan\Type\Type; use function array_map; -class UnionTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection +final class UnionTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection { private ?ExtendedMethodReflection $transformedMethod = null; diff --git a/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php index fe47fa1452..f3f2d38965 100644 --- a/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php +++ b/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php @@ -6,7 +6,7 @@ use PHPStan\Type\Type; use function array_map; -class UnionTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection +final class UnionTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection { private ?PropertyReflection $transformedProperty = null; diff --git a/src/Reflection/WrappedExtendedMethodReflection.php b/src/Reflection/WrappedExtendedMethodReflection.php index c565601261..2a953cf36b 100644 --- a/src/Reflection/WrappedExtendedMethodReflection.php +++ b/src/Reflection/WrappedExtendedMethodReflection.php @@ -9,7 +9,7 @@ use PHPStan\Type\Type; use function array_map; -class WrappedExtendedMethodReflection implements ExtendedMethodReflection +final class WrappedExtendedMethodReflection implements ExtendedMethodReflection { public function __construct(private MethodReflection $method) diff --git a/src/Rules/Api/ApiClassConstFetchRule.php b/src/Rules/Api/ApiClassConstFetchRule.php index 528d2daf8b..1503fe6f07 100644 --- a/src/Rules/Api/ApiClassConstFetchRule.php +++ b/src/Rules/Api/ApiClassConstFetchRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class ApiClassConstFetchRule implements Rule +final class ApiClassConstFetchRule implements Rule { public function __construct( diff --git a/src/Rules/Api/ApiClassExtendsRule.php b/src/Rules/Api/ApiClassExtendsRule.php index 72aad19740..cf908f004b 100644 --- a/src/Rules/Api/ApiClassExtendsRule.php +++ b/src/Rules/Api/ApiClassExtendsRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ApiClassExtendsRule implements Rule +final class ApiClassExtendsRule implements Rule { public function __construct( diff --git a/src/Rules/Api/ApiClassImplementsRule.php b/src/Rules/Api/ApiClassImplementsRule.php index 521279beca..d1615303b5 100644 --- a/src/Rules/Api/ApiClassImplementsRule.php +++ b/src/Rules/Api/ApiClassImplementsRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class ApiClassImplementsRule implements Rule +final class ApiClassImplementsRule implements Rule { public function __construct( diff --git a/src/Rules/Api/ApiInstanceofRule.php b/src/Rules/Api/ApiInstanceofRule.php index 5f2c4d531a..7882c3473e 100644 --- a/src/Rules/Api/ApiInstanceofRule.php +++ b/src/Rules/Api/ApiInstanceofRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class ApiInstanceofRule implements Rule +final class ApiInstanceofRule implements Rule { public function __construct( diff --git a/src/Rules/Api/ApiInstanceofTypeRule.php b/src/Rules/Api/ApiInstanceofTypeRule.php index fd4a3c6e20..1ae24aa0ca 100644 --- a/src/Rules/Api/ApiInstanceofTypeRule.php +++ b/src/Rules/Api/ApiInstanceofTypeRule.php @@ -50,7 +50,7 @@ /** * @implements Rule */ -class ApiInstanceofTypeRule implements Rule +final class ApiInstanceofTypeRule implements Rule { private const MAP = [ diff --git a/src/Rules/Api/ApiInstantiationRule.php b/src/Rules/Api/ApiInstantiationRule.php index bea7e29b68..80079c5495 100644 --- a/src/Rules/Api/ApiInstantiationRule.php +++ b/src/Rules/Api/ApiInstantiationRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class ApiInstantiationRule implements Rule +final class ApiInstantiationRule implements Rule { public function __construct( diff --git a/src/Rules/Api/ApiInterfaceExtendsRule.php b/src/Rules/Api/ApiInterfaceExtendsRule.php index fc5d8ca505..048aa82a1b 100644 --- a/src/Rules/Api/ApiInterfaceExtendsRule.php +++ b/src/Rules/Api/ApiInterfaceExtendsRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class ApiInterfaceExtendsRule implements Rule +final class ApiInterfaceExtendsRule implements Rule { public function __construct( diff --git a/src/Rules/Api/ApiMethodCallRule.php b/src/Rules/Api/ApiMethodCallRule.php index 52472fb47e..8c733903c4 100644 --- a/src/Rules/Api/ApiMethodCallRule.php +++ b/src/Rules/Api/ApiMethodCallRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class ApiMethodCallRule implements Rule +final class ApiMethodCallRule implements Rule { public function __construct(private ApiRuleHelper $apiRuleHelper) diff --git a/src/Rules/Api/ApiRuleHelper.php b/src/Rules/Api/ApiRuleHelper.php index 021353bbd0..8fe066e60b 100644 --- a/src/Rules/Api/ApiRuleHelper.php +++ b/src/Rules/Api/ApiRuleHelper.php @@ -11,7 +11,7 @@ use function strtolower; use const PATHINFO_BASENAME; -class ApiRuleHelper +final class ApiRuleHelper { public function isPhpStanCode(Scope $scope, string $namespace, ?string $declaringFile): bool diff --git a/src/Rules/Api/ApiStaticCallRule.php b/src/Rules/Api/ApiStaticCallRule.php index 6d48c393c0..8c1b53457a 100644 --- a/src/Rules/Api/ApiStaticCallRule.php +++ b/src/Rules/Api/ApiStaticCallRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ApiStaticCallRule implements Rule +final class ApiStaticCallRule implements Rule { public function __construct( diff --git a/src/Rules/Api/ApiTraitUseRule.php b/src/Rules/Api/ApiTraitUseRule.php index 33da77eb36..a0074cbd4a 100644 --- a/src/Rules/Api/ApiTraitUseRule.php +++ b/src/Rules/Api/ApiTraitUseRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class ApiTraitUseRule implements Rule +final class ApiTraitUseRule implements Rule { public function __construct( diff --git a/src/Rules/Api/GetTemplateTypeRule.php b/src/Rules/Api/GetTemplateTypeRule.php index 05c48497d0..ad5e08981a 100644 --- a/src/Rules/Api/GetTemplateTypeRule.php +++ b/src/Rules/Api/GetTemplateTypeRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class GetTemplateTypeRule implements Rule +final class GetTemplateTypeRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/Api/NodeConnectingVisitorAttributesRule.php b/src/Rules/Api/NodeConnectingVisitorAttributesRule.php index 0907413ca7..a1f27a33e2 100644 --- a/src/Rules/Api/NodeConnectingVisitorAttributesRule.php +++ b/src/Rules/Api/NodeConnectingVisitorAttributesRule.php @@ -21,7 +21,7 @@ /** * @implements Rule */ -class NodeConnectingVisitorAttributesRule implements Rule +final class NodeConnectingVisitorAttributesRule implements Rule { public function __construct(private Container $container) diff --git a/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php b/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php index cc449b8f30..8547f7b2ed 100644 --- a/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php +++ b/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class PhpStanNamespaceIn3rdPartyPackageRule implements Rule +final class PhpStanNamespaceIn3rdPartyPackageRule implements Rule { public function __construct(private ApiRuleHelper $apiRuleHelper) diff --git a/src/Rules/Api/RuntimeReflectionFunctionRule.php b/src/Rules/Api/RuntimeReflectionFunctionRule.php index 8b8fbf6722..229b681818 100644 --- a/src/Rules/Api/RuntimeReflectionFunctionRule.php +++ b/src/Rules/Api/RuntimeReflectionFunctionRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class RuntimeReflectionFunctionRule implements Rule +final class RuntimeReflectionFunctionRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/Api/RuntimeReflectionInstantiationRule.php b/src/Rules/Api/RuntimeReflectionInstantiationRule.php index 3e5dc7524c..f358c5070a 100644 --- a/src/Rules/Api/RuntimeReflectionInstantiationRule.php +++ b/src/Rules/Api/RuntimeReflectionInstantiationRule.php @@ -25,7 +25,7 @@ /** * @implements Rule */ -class RuntimeReflectionInstantiationRule implements Rule +final class RuntimeReflectionInstantiationRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/Arrays/AllowedArrayKeysTypes.php b/src/Rules/Arrays/AllowedArrayKeysTypes.php index 6a2cc62542..0bc7c1f4c4 100644 --- a/src/Rules/Arrays/AllowedArrayKeysTypes.php +++ b/src/Rules/Arrays/AllowedArrayKeysTypes.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\UnionType; -class AllowedArrayKeysTypes +final class AllowedArrayKeysTypes { public static function getType(): Type diff --git a/src/Rules/Arrays/AppendedArrayItemTypeRule.php b/src/Rules/Arrays/AppendedArrayItemTypeRule.php index 96409f9aa1..dee1dc6c30 100644 --- a/src/Rules/Arrays/AppendedArrayItemTypeRule.php +++ b/src/Rules/Arrays/AppendedArrayItemTypeRule.php @@ -19,7 +19,7 @@ * @deprecated Replaced by PHPStan\Rules\Properties\TypesAssignedToPropertiesRule * @implements Rule */ -class AppendedArrayItemTypeRule implements Rule +final class AppendedArrayItemTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Arrays/AppendedArrayKeyTypeRule.php b/src/Rules/Arrays/AppendedArrayKeyTypeRule.php index cf35062faf..3e91fe8dbe 100644 --- a/src/Rules/Arrays/AppendedArrayKeyTypeRule.php +++ b/src/Rules/Arrays/AppendedArrayKeyTypeRule.php @@ -18,7 +18,7 @@ * @deprecated Replaced by PHPStan\Rules\Properties\TypesAssignedToPropertiesRule * @implements Rule */ -class AppendedArrayKeyTypeRule implements Rule +final class AppendedArrayKeyTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Arrays/ArrayDestructuringRule.php b/src/Rules/Arrays/ArrayDestructuringRule.php index 332d192698..ab83f1d019 100644 --- a/src/Rules/Arrays/ArrayDestructuringRule.php +++ b/src/Rules/Arrays/ArrayDestructuringRule.php @@ -23,7 +23,7 @@ /** * @implements Rule */ -class ArrayDestructuringRule implements Rule +final class ArrayDestructuringRule implements Rule { public function __construct( diff --git a/src/Rules/Arrays/ArrayUnpackingRule.php b/src/Rules/Arrays/ArrayUnpackingRule.php index 21092c2100..4be69c0ac0 100644 --- a/src/Rules/Arrays/ArrayUnpackingRule.php +++ b/src/Rules/Arrays/ArrayUnpackingRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ArrayUnpackingRule implements Rule +final class ArrayUnpackingRule implements Rule { public function __construct(private PhpVersion $phpVersion, private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Arrays/DeadForeachRule.php b/src/Rules/Arrays/DeadForeachRule.php index a9b64b441f..61d2085fec 100644 --- a/src/Rules/Arrays/DeadForeachRule.php +++ b/src/Rules/Arrays/DeadForeachRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class DeadForeachRule implements Rule +final class DeadForeachRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php b/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php index a1eaf7e131..46b5e712e1 100644 --- a/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php +++ b/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class DuplicateKeysInLiteralArraysRule implements Rule +final class DuplicateKeysInLiteralArraysRule implements Rule { public function __construct( diff --git a/src/Rules/Arrays/EmptyArrayItemRule.php b/src/Rules/Arrays/EmptyArrayItemRule.php index 94cb7e49b0..0bfcebf956 100644 --- a/src/Rules/Arrays/EmptyArrayItemRule.php +++ b/src/Rules/Arrays/EmptyArrayItemRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class EmptyArrayItemRule implements Rule +final class EmptyArrayItemRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php b/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php index 1242f85cfd..e74b192a67 100644 --- a/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php +++ b/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class InvalidKeyInArrayDimFetchRule implements Rule +final class InvalidKeyInArrayDimFetchRule implements Rule { public function __construct( diff --git a/src/Rules/Arrays/InvalidKeyInArrayItemRule.php b/src/Rules/Arrays/InvalidKeyInArrayItemRule.php index 61c4fd342c..5b5f3545a9 100644 --- a/src/Rules/Arrays/InvalidKeyInArrayItemRule.php +++ b/src/Rules/Arrays/InvalidKeyInArrayItemRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class InvalidKeyInArrayItemRule implements Rule +final class InvalidKeyInArrayItemRule implements Rule { public function __construct(private bool $reportMaybes) diff --git a/src/Rules/Arrays/IterableInForeachRule.php b/src/Rules/Arrays/IterableInForeachRule.php index c455cd8d21..fd6351a003 100644 --- a/src/Rules/Arrays/IterableInForeachRule.php +++ b/src/Rules/Arrays/IterableInForeachRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class IterableInForeachRule implements Rule +final class IterableInForeachRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php index 6ef401c577..7b329d01a4 100644 --- a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php +++ b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php @@ -16,7 +16,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; -class NonexistentOffsetInArrayDimFetchCheck +final class NonexistentOffsetInArrayDimFetchCheck { public function __construct( diff --git a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php index 547e2f4fe4..3cb1b93328 100644 --- a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php +++ b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class NonexistentOffsetInArrayDimFetchRule implements Rule +final class NonexistentOffsetInArrayDimFetchRule implements Rule { public function __construct( diff --git a/src/Rules/Arrays/OffsetAccessAssignOpRule.php b/src/Rules/Arrays/OffsetAccessAssignOpRule.php index ff66d9bb9f..5ab745647b 100644 --- a/src/Rules/Arrays/OffsetAccessAssignOpRule.php +++ b/src/Rules/Arrays/OffsetAccessAssignOpRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class OffsetAccessAssignOpRule implements Rule +final class OffsetAccessAssignOpRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Arrays/OffsetAccessAssignmentRule.php b/src/Rules/Arrays/OffsetAccessAssignmentRule.php index 0bafe975d0..c6c0f92b14 100644 --- a/src/Rules/Arrays/OffsetAccessAssignmentRule.php +++ b/src/Rules/Arrays/OffsetAccessAssignmentRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class OffsetAccessAssignmentRule implements Rule +final class OffsetAccessAssignmentRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php b/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php index 0368895760..45f7b490b1 100644 --- a/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php +++ b/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class OffsetAccessValueAssignmentRule implements Rule +final class OffsetAccessValueAssignmentRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Arrays/OffsetAccessWithoutDimForReadingRule.php b/src/Rules/Arrays/OffsetAccessWithoutDimForReadingRule.php index ce70e82425..8d83452357 100644 --- a/src/Rules/Arrays/OffsetAccessWithoutDimForReadingRule.php +++ b/src/Rules/Arrays/OffsetAccessWithoutDimForReadingRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class OffsetAccessWithoutDimForReadingRule implements Rule +final class OffsetAccessWithoutDimForReadingRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Arrays/UnpackIterableInArrayRule.php b/src/Rules/Arrays/UnpackIterableInArrayRule.php index 10a3a67758..bc515b9d04 100644 --- a/src/Rules/Arrays/UnpackIterableInArrayRule.php +++ b/src/Rules/Arrays/UnpackIterableInArrayRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class UnpackIterableInArrayRule implements Rule +final class UnpackIterableInArrayRule implements Rule { public function __construct( diff --git a/src/Rules/AttributesCheck.php b/src/Rules/AttributesCheck.php index 916c6e1c7d..cd549f67e3 100644 --- a/src/Rules/AttributesCheck.php +++ b/src/Rules/AttributesCheck.php @@ -14,7 +14,7 @@ use function sprintf; use function strtolower; -class AttributesCheck +final class AttributesCheck { public function __construct( diff --git a/src/Rules/Cast/EchoRule.php b/src/Rules/Cast/EchoRule.php index d8033f5394..697822b55f 100644 --- a/src/Rules/Cast/EchoRule.php +++ b/src/Rules/Cast/EchoRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class EchoRule implements Rule +final class EchoRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Cast/InvalidCastRule.php b/src/Rules/Cast/InvalidCastRule.php index ceb074e36c..4e3bddad6e 100644 --- a/src/Rules/Cast/InvalidCastRule.php +++ b/src/Rules/Cast/InvalidCastRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class InvalidCastRule implements Rule +final class InvalidCastRule implements Rule { public function __construct( diff --git a/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php b/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php index 773aabe5d5..5cf96d8ad2 100644 --- a/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php +++ b/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class InvalidPartOfEncapsedStringRule implements Rule +final class InvalidPartOfEncapsedStringRule implements Rule { public function __construct( diff --git a/src/Rules/Cast/PrintRule.php b/src/Rules/Cast/PrintRule.php index 3b8ad5f97d..a8f525c91e 100644 --- a/src/Rules/Cast/PrintRule.php +++ b/src/Rules/Cast/PrintRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class PrintRule implements Rule +final class PrintRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Cast/UnsetCastRule.php b/src/Rules/Cast/UnsetCastRule.php index be527ffad0..9d0bdbf724 100644 --- a/src/Rules/Cast/UnsetCastRule.php +++ b/src/Rules/Cast/UnsetCastRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class UnsetCastRule implements Rule +final class UnsetCastRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/ClassCaseSensitivityCheck.php b/src/Rules/ClassCaseSensitivityCheck.php index f7cdfdaab3..b58a589074 100644 --- a/src/Rules/ClassCaseSensitivityCheck.php +++ b/src/Rules/ClassCaseSensitivityCheck.php @@ -6,7 +6,7 @@ use function sprintf; use function strtolower; -class ClassCaseSensitivityCheck +final class ClassCaseSensitivityCheck { public function __construct(private ReflectionProvider $reflectionProvider, private bool $checkInternalClassCaseSensitivity) diff --git a/src/Rules/ClassForbiddenNameCheck.php b/src/Rules/ClassForbiddenNameCheck.php index c86fede587..c7658440ab 100644 --- a/src/Rules/ClassForbiddenNameCheck.php +++ b/src/Rules/ClassForbiddenNameCheck.php @@ -12,7 +12,7 @@ use function strpos; use function substr; -class ClassForbiddenNameCheck +final class ClassForbiddenNameCheck { private const INTERNAL_CLASS_PREFIXES = [ diff --git a/src/Rules/ClassNameCheck.php b/src/Rules/ClassNameCheck.php index c168b74ce7..80d3af0f77 100644 --- a/src/Rules/ClassNameCheck.php +++ b/src/Rules/ClassNameCheck.php @@ -2,7 +2,7 @@ namespace PHPStan\Rules; -class ClassNameCheck +final class ClassNameCheck { public function __construct( diff --git a/src/Rules/ClassNameNodePair.php b/src/Rules/ClassNameNodePair.php index 355fa61e01..cf39baa35c 100644 --- a/src/Rules/ClassNameNodePair.php +++ b/src/Rules/ClassNameNodePair.php @@ -4,7 +4,7 @@ use PhpParser\Node; -class ClassNameNodePair +final class ClassNameNodePair { public function __construct(private string $className, private Node $node) diff --git a/src/Rules/Classes/AccessPrivateConstantThroughStaticRule.php b/src/Rules/Classes/AccessPrivateConstantThroughStaticRule.php index 438398a4f9..551f56c464 100644 --- a/src/Rules/Classes/AccessPrivateConstantThroughStaticRule.php +++ b/src/Rules/Classes/AccessPrivateConstantThroughStaticRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class AccessPrivateConstantThroughStaticRule implements Rule +final class AccessPrivateConstantThroughStaticRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/AllowedSubTypesRule.php b/src/Rules/Classes/AllowedSubTypesRule.php index 164e63d9d7..5e58d49b3a 100644 --- a/src/Rules/Classes/AllowedSubTypesRule.php +++ b/src/Rules/Classes/AllowedSubTypesRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class AllowedSubTypesRule implements Rule +final class AllowedSubTypesRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/ClassAttributesRule.php b/src/Rules/Classes/ClassAttributesRule.php index 21d6bda749..319379ab2a 100644 --- a/src/Rules/Classes/ClassAttributesRule.php +++ b/src/Rules/Classes/ClassAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ClassAttributesRule implements Rule +final class ClassAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Classes/ClassConstantAttributesRule.php b/src/Rules/Classes/ClassConstantAttributesRule.php index d8256191a0..71597d271a 100644 --- a/src/Rules/Classes/ClassConstantAttributesRule.php +++ b/src/Rules/Classes/ClassConstantAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ClassConstantAttributesRule implements Rule +final class ClassConstantAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Classes/ClassConstantRule.php b/src/Rules/Classes/ClassConstantRule.php index f8425ff295..71636b8ca0 100644 --- a/src/Rules/Classes/ClassConstantRule.php +++ b/src/Rules/Classes/ClassConstantRule.php @@ -28,7 +28,7 @@ /** * @implements Rule */ -class ClassConstantRule implements Rule +final class ClassConstantRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/DuplicateClassDeclarationRule.php b/src/Rules/Classes/DuplicateClassDeclarationRule.php index ae2658de79..bf8ac7f05d 100644 --- a/src/Rules/Classes/DuplicateClassDeclarationRule.php +++ b/src/Rules/Classes/DuplicateClassDeclarationRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class DuplicateClassDeclarationRule implements Rule +final class DuplicateClassDeclarationRule implements Rule { public function __construct(private Reflector $reflector, private RelativePathHelper $relativePathHelper) diff --git a/src/Rules/Classes/DuplicateDeclarationRule.php b/src/Rules/Classes/DuplicateDeclarationRule.php index b5e122eb0e..047ce4cee9 100644 --- a/src/Rules/Classes/DuplicateDeclarationRule.php +++ b/src/Rules/Classes/DuplicateDeclarationRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class DuplicateDeclarationRule implements Rule +final class DuplicateDeclarationRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/EnumSanityRule.php b/src/Rules/Classes/EnumSanityRule.php index 742dbd1842..e9aebc1c26 100644 --- a/src/Rules/Classes/EnumSanityRule.php +++ b/src/Rules/Classes/EnumSanityRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class EnumSanityRule implements Rule +final class EnumSanityRule implements Rule { private const ALLOWED_MAGIC_METHODS = [ diff --git a/src/Rules/Classes/ExistingClassInClassExtendsRule.php b/src/Rules/Classes/ExistingClassInClassExtendsRule.php index b0a6aae26d..d1863e1945 100644 --- a/src/Rules/Classes/ExistingClassInClassExtendsRule.php +++ b/src/Rules/Classes/ExistingClassInClassExtendsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class ExistingClassInClassExtendsRule implements Rule +final class ExistingClassInClassExtendsRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/ExistingClassInInstanceOfRule.php b/src/Rules/Classes/ExistingClassInInstanceOfRule.php index 7eef8ba523..5e40800631 100644 --- a/src/Rules/Classes/ExistingClassInInstanceOfRule.php +++ b/src/Rules/Classes/ExistingClassInInstanceOfRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class ExistingClassInInstanceOfRule implements Rule +final class ExistingClassInInstanceOfRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/ExistingClassInTraitUseRule.php b/src/Rules/Classes/ExistingClassInTraitUseRule.php index e47d9cf5d6..69ecc87fb5 100644 --- a/src/Rules/Classes/ExistingClassInTraitUseRule.php +++ b/src/Rules/Classes/ExistingClassInTraitUseRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class ExistingClassInTraitUseRule implements Rule +final class ExistingClassInTraitUseRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/ExistingClassesInClassImplementsRule.php b/src/Rules/Classes/ExistingClassesInClassImplementsRule.php index 5aeb3fde46..e0ff7c27ba 100644 --- a/src/Rules/Classes/ExistingClassesInClassImplementsRule.php +++ b/src/Rules/Classes/ExistingClassesInClassImplementsRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ExistingClassesInClassImplementsRule implements Rule +final class ExistingClassesInClassImplementsRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php b/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php index 413f32fcd8..aff2164a91 100644 --- a/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php +++ b/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ExistingClassesInEnumImplementsRule implements Rule +final class ExistingClassesInEnumImplementsRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php b/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php index e25a2ac974..5fc694a46b 100644 --- a/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php +++ b/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ExistingClassesInInterfaceExtendsRule implements Rule +final class ExistingClassesInInterfaceExtendsRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/ImpossibleInstanceOfRule.php b/src/Rules/Classes/ImpossibleInstanceOfRule.php index c84092f810..cf4df676e9 100644 --- a/src/Rules/Classes/ImpossibleInstanceOfRule.php +++ b/src/Rules/Classes/ImpossibleInstanceOfRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ImpossibleInstanceOfRule implements Rule +final class ImpossibleInstanceOfRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/InstantiationCallableRule.php b/src/Rules/Classes/InstantiationCallableRule.php index d36c15a33a..019d6a2979 100644 --- a/src/Rules/Classes/InstantiationCallableRule.php +++ b/src/Rules/Classes/InstantiationCallableRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class InstantiationCallableRule implements Rule +final class InstantiationCallableRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/InstantiationRule.php b/src/Rules/Classes/InstantiationRule.php index 7e31e5adcd..e90aee6b80 100644 --- a/src/Rules/Classes/InstantiationRule.php +++ b/src/Rules/Classes/InstantiationRule.php @@ -26,7 +26,7 @@ /** * @implements Rule */ -class InstantiationRule implements Rule +final class InstantiationRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/InvalidPromotedPropertiesRule.php b/src/Rules/Classes/InvalidPromotedPropertiesRule.php index 5376f6b17e..22434786a8 100644 --- a/src/Rules/Classes/InvalidPromotedPropertiesRule.php +++ b/src/Rules/Classes/InvalidPromotedPropertiesRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class InvalidPromotedPropertiesRule implements Rule +final class InvalidPromotedPropertiesRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Classes/LocalTypeAliasesCheck.php b/src/Rules/Classes/LocalTypeAliasesCheck.php index 78940cac12..a8d1b1e476 100644 --- a/src/Rules/Classes/LocalTypeAliasesCheck.php +++ b/src/Rules/Classes/LocalTypeAliasesCheck.php @@ -18,7 +18,7 @@ use function in_array; use function sprintf; -class LocalTypeAliasesCheck +final class LocalTypeAliasesCheck { /** diff --git a/src/Rules/Classes/LocalTypeAliasesRule.php b/src/Rules/Classes/LocalTypeAliasesRule.php index 86697971b8..7fb999403c 100644 --- a/src/Rules/Classes/LocalTypeAliasesRule.php +++ b/src/Rules/Classes/LocalTypeAliasesRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class LocalTypeAliasesRule implements Rule +final class LocalTypeAliasesRule implements Rule { public function __construct(private LocalTypeAliasesCheck $check) diff --git a/src/Rules/Classes/LocalTypeTraitAliasesRule.php b/src/Rules/Classes/LocalTypeTraitAliasesRule.php index 406108db1b..241cef7c6c 100644 --- a/src/Rules/Classes/LocalTypeTraitAliasesRule.php +++ b/src/Rules/Classes/LocalTypeTraitAliasesRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class LocalTypeTraitAliasesRule implements Rule +final class LocalTypeTraitAliasesRule implements Rule { public function __construct(private LocalTypeAliasesCheck $check, private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/Classes/MixinRule.php b/src/Rules/Classes/MixinRule.php index ce397c3e21..07e39383c7 100644 --- a/src/Rules/Classes/MixinRule.php +++ b/src/Rules/Classes/MixinRule.php @@ -21,7 +21,7 @@ /** * @implements Rule */ -class MixinRule implements Rule +final class MixinRule implements Rule { public function __construct( diff --git a/src/Rules/Classes/NewStaticRule.php b/src/Rules/Classes/NewStaticRule.php index b675469bac..5540646616 100644 --- a/src/Rules/Classes/NewStaticRule.php +++ b/src/Rules/Classes/NewStaticRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class NewStaticRule implements Rule +final class NewStaticRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/NonClassAttributeClassRule.php b/src/Rules/Classes/NonClassAttributeClassRule.php index c6318d07a4..24f6850492 100644 --- a/src/Rules/Classes/NonClassAttributeClassRule.php +++ b/src/Rules/Classes/NonClassAttributeClassRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class NonClassAttributeClassRule implements Rule +final class NonClassAttributeClassRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/ReadOnlyClassRule.php b/src/Rules/Classes/ReadOnlyClassRule.php index 21755c623c..816e67e7b4 100644 --- a/src/Rules/Classes/ReadOnlyClassRule.php +++ b/src/Rules/Classes/ReadOnlyClassRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class ReadOnlyClassRule implements Rule +final class ReadOnlyClassRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Classes/RequireExtendsRule.php b/src/Rules/Classes/RequireExtendsRule.php index 34a35ab11f..036cf3aa85 100644 --- a/src/Rules/Classes/RequireExtendsRule.php +++ b/src/Rules/Classes/RequireExtendsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class RequireExtendsRule implements Rule +final class RequireExtendsRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/RequireImplementsRule.php b/src/Rules/Classes/RequireImplementsRule.php index 32c9361d65..3b1fdca948 100644 --- a/src/Rules/Classes/RequireImplementsRule.php +++ b/src/Rules/Classes/RequireImplementsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class RequireImplementsRule implements Rule +final class RequireImplementsRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/TraitAttributeClassRule.php b/src/Rules/Classes/TraitAttributeClassRule.php index 4d69f3a7ba..c73a1f8340 100644 --- a/src/Rules/Classes/TraitAttributeClassRule.php +++ b/src/Rules/Classes/TraitAttributeClassRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class TraitAttributeClassRule implements Rule +final class TraitAttributeClassRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Classes/UnusedConstructorParametersRule.php b/src/Rules/Classes/UnusedConstructorParametersRule.php index 2850e2bafe..e42a60d5f7 100644 --- a/src/Rules/Classes/UnusedConstructorParametersRule.php +++ b/src/Rules/Classes/UnusedConstructorParametersRule.php @@ -22,7 +22,7 @@ /** * @implements Rule */ -class UnusedConstructorParametersRule implements Rule +final class UnusedConstructorParametersRule implements Rule { public function __construct(private UnusedFunctionParametersCheck $check) diff --git a/src/Rules/Comparison/BooleanAndConstantConditionRule.php b/src/Rules/Comparison/BooleanAndConstantConditionRule.php index 44c574fb68..8d680e9306 100644 --- a/src/Rules/Comparison/BooleanAndConstantConditionRule.php +++ b/src/Rules/Comparison/BooleanAndConstantConditionRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class BooleanAndConstantConditionRule implements Rule +final class BooleanAndConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/BooleanNotConstantConditionRule.php b/src/Rules/Comparison/BooleanNotConstantConditionRule.php index d41cb743ca..f107804843 100644 --- a/src/Rules/Comparison/BooleanNotConstantConditionRule.php +++ b/src/Rules/Comparison/BooleanNotConstantConditionRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class BooleanNotConstantConditionRule implements Rule +final class BooleanNotConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/BooleanOrConstantConditionRule.php b/src/Rules/Comparison/BooleanOrConstantConditionRule.php index 831829355c..02f3db6590 100644 --- a/src/Rules/Comparison/BooleanOrConstantConditionRule.php +++ b/src/Rules/Comparison/BooleanOrConstantConditionRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class BooleanOrConstantConditionRule implements Rule +final class BooleanOrConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/ConstantConditionRuleHelper.php b/src/Rules/Comparison/ConstantConditionRuleHelper.php index 60da2b56ff..9271ef2782 100644 --- a/src/Rules/Comparison/ConstantConditionRuleHelper.php +++ b/src/Rules/Comparison/ConstantConditionRuleHelper.php @@ -8,7 +8,7 @@ use PHPStan\Analyser\Scope; use PHPStan\Type\BooleanType; -class ConstantConditionRuleHelper +final class ConstantConditionRuleHelper { public function __construct( diff --git a/src/Rules/Comparison/ConstantLooseComparisonRule.php b/src/Rules/Comparison/ConstantLooseComparisonRule.php index 5222647d17..477210064a 100644 --- a/src/Rules/Comparison/ConstantLooseComparisonRule.php +++ b/src/Rules/Comparison/ConstantLooseComparisonRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class ConstantLooseComparisonRule implements Rule +final class ConstantLooseComparisonRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php b/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php index 6074f8d20c..3777b5d6e5 100644 --- a/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php +++ b/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class DoWhileLoopConstantConditionRule implements Rule +final class DoWhileLoopConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/ElseIfConstantConditionRule.php b/src/Rules/Comparison/ElseIfConstantConditionRule.php index d1bf93a6db..80444eb335 100644 --- a/src/Rules/Comparison/ElseIfConstantConditionRule.php +++ b/src/Rules/Comparison/ElseIfConstantConditionRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class ElseIfConstantConditionRule implements Rule +final class ElseIfConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/IfConstantConditionRule.php b/src/Rules/Comparison/IfConstantConditionRule.php index 8bf57ebcd4..f0eb0e338c 100644 --- a/src/Rules/Comparison/IfConstantConditionRule.php +++ b/src/Rules/Comparison/IfConstantConditionRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class IfConstantConditionRule implements Rule +final class IfConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php b/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php index 55423dbf50..a52cc8d718 100644 --- a/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php +++ b/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class ImpossibleCheckTypeFunctionCallRule implements Rule +final class ImpossibleCheckTypeFunctionCallRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/ImpossibleCheckTypeHelper.php b/src/Rules/Comparison/ImpossibleCheckTypeHelper.php index 828cfa1b82..39a4da06bd 100644 --- a/src/Rules/Comparison/ImpossibleCheckTypeHelper.php +++ b/src/Rules/Comparison/ImpossibleCheckTypeHelper.php @@ -37,7 +37,7 @@ use function sprintf; use function strtolower; -class ImpossibleCheckTypeHelper +final class ImpossibleCheckTypeHelper { /** diff --git a/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php b/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php index 9fc4e4067d..5387a18bfc 100644 --- a/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php +++ b/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ImpossibleCheckTypeMethodCallRule implements Rule +final class ImpossibleCheckTypeMethodCallRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php b/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php index 5d35d1be1a..9ac004779d 100644 --- a/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php +++ b/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ImpossibleCheckTypeStaticMethodCallRule implements Rule +final class ImpossibleCheckTypeStaticMethodCallRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/LogicalXorConstantConditionRule.php b/src/Rules/Comparison/LogicalXorConstantConditionRule.php index 250b55bd6e..971868f1c4 100644 --- a/src/Rules/Comparison/LogicalXorConstantConditionRule.php +++ b/src/Rules/Comparison/LogicalXorConstantConditionRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class LogicalXorConstantConditionRule implements Rule +final class LogicalXorConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/MatchExpressionRule.php b/src/Rules/Comparison/MatchExpressionRule.php index d7d318322e..81cfb1f471 100644 --- a/src/Rules/Comparison/MatchExpressionRule.php +++ b/src/Rules/Comparison/MatchExpressionRule.php @@ -22,7 +22,7 @@ /** * @implements Rule */ -class MatchExpressionRule implements Rule +final class MatchExpressionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/NumberComparisonOperatorsConstantConditionRule.php b/src/Rules/Comparison/NumberComparisonOperatorsConstantConditionRule.php index 081cdef1e0..b208766609 100644 --- a/src/Rules/Comparison/NumberComparisonOperatorsConstantConditionRule.php +++ b/src/Rules/Comparison/NumberComparisonOperatorsConstantConditionRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class NumberComparisonOperatorsConstantConditionRule implements Rule +final class NumberComparisonOperatorsConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php b/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php index 66f447db3b..6780fb91d3 100644 --- a/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php +++ b/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class StrictComparisonOfDifferentTypesRule implements Rule +final class StrictComparisonOfDifferentTypesRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php b/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php index 9513924e6b..adbe33ac83 100644 --- a/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php +++ b/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class TernaryOperatorConstantConditionRule implements Rule +final class TernaryOperatorConstantConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/UnreachableIfBranchesRule.php b/src/Rules/Comparison/UnreachableIfBranchesRule.php index 4918a320d6..7b3682f213 100644 --- a/src/Rules/Comparison/UnreachableIfBranchesRule.php +++ b/src/Rules/Comparison/UnreachableIfBranchesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class UnreachableIfBranchesRule implements Rule +final class UnreachableIfBranchesRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php b/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php index 32ef874c5f..0ce221250b 100644 --- a/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php +++ b/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class UnreachableTernaryElseBranchRule implements Rule +final class UnreachableTernaryElseBranchRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/UsageOfVoidMatchExpressionRule.php b/src/Rules/Comparison/UsageOfVoidMatchExpressionRule.php index 80a473b713..ac87e2b8a1 100644 --- a/src/Rules/Comparison/UsageOfVoidMatchExpressionRule.php +++ b/src/Rules/Comparison/UsageOfVoidMatchExpressionRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class UsageOfVoidMatchExpressionRule implements Rule +final class UsageOfVoidMatchExpressionRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php b/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php index 01ae378030..b6eaa9d790 100644 --- a/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php +++ b/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class WhileLoopAlwaysFalseConditionRule implements Rule +final class WhileLoopAlwaysFalseConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php b/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php index 42a885b6ad..68ac27fbf2 100644 --- a/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php +++ b/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class WhileLoopAlwaysTrueConditionRule implements Rule +final class WhileLoopAlwaysTrueConditionRule implements Rule { public function __construct( diff --git a/src/Rules/Constants/ConstantRule.php b/src/Rules/Constants/ConstantRule.php index 27003ecade..d0e52ead39 100644 --- a/src/Rules/Constants/ConstantRule.php +++ b/src/Rules/Constants/ConstantRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ConstantRule implements Rule +final class ConstantRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Constants/DynamicClassConstantFetchRule.php b/src/Rules/Constants/DynamicClassConstantFetchRule.php index ce1295ffc4..40588a1f56 100644 --- a/src/Rules/Constants/DynamicClassConstantFetchRule.php +++ b/src/Rules/Constants/DynamicClassConstantFetchRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class DynamicClassConstantFetchRule implements Rule +final class DynamicClassConstantFetchRule implements Rule { public function __construct(private PhpVersion $phpVersion, private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Constants/FinalConstantRule.php b/src/Rules/Constants/FinalConstantRule.php index d6b891f465..58b13d04e3 100644 --- a/src/Rules/Constants/FinalConstantRule.php +++ b/src/Rules/Constants/FinalConstantRule.php @@ -10,7 +10,7 @@ use PHPStan\Rules\RuleErrorBuilder; /** @implements Rule */ -class FinalConstantRule implements Rule +final class FinalConstantRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php b/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php index 895fb96360..e91391e8bb 100644 --- a/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php +++ b/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyAlwaysUsedClassConstantsExtensionProvider implements AlwaysUsedClassConstantsExtensionProvider +final class LazyAlwaysUsedClassConstantsExtensionProvider implements AlwaysUsedClassConstantsExtensionProvider { /** @var AlwaysUsedClassConstantsExtension[]|null */ diff --git a/src/Rules/Constants/MagicConstantContextRule.php b/src/Rules/Constants/MagicConstantContextRule.php index 5cfb38f074..2de89b7f65 100644 --- a/src/Rules/Constants/MagicConstantContextRule.php +++ b/src/Rules/Constants/MagicConstantContextRule.php @@ -11,7 +11,7 @@ use function sprintf; /** @implements Rule */ -class MagicConstantContextRule implements Rule +final class MagicConstantContextRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Constants/NativeTypedClassConstantRule.php b/src/Rules/Constants/NativeTypedClassConstantRule.php index ce2ea802d8..ad16fe919b 100644 --- a/src/Rules/Constants/NativeTypedClassConstantRule.php +++ b/src/Rules/Constants/NativeTypedClassConstantRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class NativeTypedClassConstantRule implements Rule +final class NativeTypedClassConstantRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Constants/OverridingConstantRule.php b/src/Rules/Constants/OverridingConstantRule.php index 555cbfc0dd..ca1a822f99 100644 --- a/src/Rules/Constants/OverridingConstantRule.php +++ b/src/Rules/Constants/OverridingConstantRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class OverridingConstantRule implements Rule +final class OverridingConstantRule implements Rule { public function __construct( diff --git a/src/Rules/Constants/ValueAssignedToClassConstantRule.php b/src/Rules/Constants/ValueAssignedToClassConstantRule.php index 37b72e1c72..afdbf2c5e7 100644 --- a/src/Rules/Constants/ValueAssignedToClassConstantRule.php +++ b/src/Rules/Constants/ValueAssignedToClassConstantRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ValueAssignedToClassConstantRule implements Rule +final class ValueAssignedToClassConstantRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/DateTimeInstantiationRule.php b/src/Rules/DateTimeInstantiationRule.php index b8cd1684dd..3e62e4b68b 100644 --- a/src/Rules/DateTimeInstantiationRule.php +++ b/src/Rules/DateTimeInstantiationRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class DateTimeInstantiationRule implements Rule +final class DateTimeInstantiationRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/DeadCode/BetterNoopRule.php b/src/Rules/DeadCode/BetterNoopRule.php index 22ce47032f..2e246941b7 100644 --- a/src/Rules/DeadCode/BetterNoopRule.php +++ b/src/Rules/DeadCode/BetterNoopRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class BetterNoopRule implements Rule +final class BetterNoopRule implements Rule { public function __construct(private ExprPrinter $exprPrinter) diff --git a/src/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRule.php b/src/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRule.php index ab14e74d36..aa0bf2ec0b 100644 --- a/src/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRule.php +++ b/src/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CallToConstructorStatementWithoutImpurePointsRule implements Rule +final class CallToConstructorStatementWithoutImpurePointsRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRule.php b/src/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRule.php index 1635b12050..3b123b3e4d 100644 --- a/src/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRule.php +++ b/src/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CallToFunctionStatementWithoutImpurePointsRule implements Rule +final class CallToFunctionStatementWithoutImpurePointsRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php b/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php index 5c4d597cd9..443b7dcc10 100644 --- a/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php +++ b/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CallToMethodStatementWithoutImpurePointsRule implements Rule +final class CallToMethodStatementWithoutImpurePointsRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/DeadCode/CallToStaticMethodStatementWithoutImpurePointsRule.php b/src/Rules/DeadCode/CallToStaticMethodStatementWithoutImpurePointsRule.php index c64b29f8bf..83d7842813 100644 --- a/src/Rules/DeadCode/CallToStaticMethodStatementWithoutImpurePointsRule.php +++ b/src/Rules/DeadCode/CallToStaticMethodStatementWithoutImpurePointsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CallToStaticMethodStatementWithoutImpurePointsRule implements Rule +final class CallToStaticMethodStatementWithoutImpurePointsRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/DeadCode/ConstructorWithoutImpurePointsCollector.php b/src/Rules/DeadCode/ConstructorWithoutImpurePointsCollector.php index dae162500a..40839309e5 100644 --- a/src/Rules/DeadCode/ConstructorWithoutImpurePointsCollector.php +++ b/src/Rules/DeadCode/ConstructorWithoutImpurePointsCollector.php @@ -13,7 +13,7 @@ /** * @implements Collector */ -class ConstructorWithoutImpurePointsCollector implements Collector +final class ConstructorWithoutImpurePointsCollector implements Collector { public function getNodeType(): string diff --git a/src/Rules/DeadCode/FunctionWithoutImpurePointsCollector.php b/src/Rules/DeadCode/FunctionWithoutImpurePointsCollector.php index 528e5c76e6..6dafe5d35b 100644 --- a/src/Rules/DeadCode/FunctionWithoutImpurePointsCollector.php +++ b/src/Rules/DeadCode/FunctionWithoutImpurePointsCollector.php @@ -12,7 +12,7 @@ /** * @implements Collector */ -class FunctionWithoutImpurePointsCollector implements Collector +final class FunctionWithoutImpurePointsCollector implements Collector { public function getNodeType(): string diff --git a/src/Rules/DeadCode/MethodWithoutImpurePointsCollector.php b/src/Rules/DeadCode/MethodWithoutImpurePointsCollector.php index b6bdb3ca34..f07b2aac37 100644 --- a/src/Rules/DeadCode/MethodWithoutImpurePointsCollector.php +++ b/src/Rules/DeadCode/MethodWithoutImpurePointsCollector.php @@ -12,7 +12,7 @@ /** * @implements Collector */ -class MethodWithoutImpurePointsCollector implements Collector +final class MethodWithoutImpurePointsCollector implements Collector { public function getNodeType(): string diff --git a/src/Rules/DeadCode/NoopRule.php b/src/Rules/DeadCode/NoopRule.php index 34855261ef..ff0d6eb8e7 100644 --- a/src/Rules/DeadCode/NoopRule.php +++ b/src/Rules/DeadCode/NoopRule.php @@ -13,7 +13,7 @@ * @deprecated Replaced by PHPStan\Rules\DeadCode\BetterNoopRule * @implements Rule */ -class NoopRule implements Rule +final class NoopRule implements Rule { public function __construct(private ExprPrinter $exprPrinter, private bool $better) diff --git a/src/Rules/DeadCode/PossiblyPureFuncCallCollector.php b/src/Rules/DeadCode/PossiblyPureFuncCallCollector.php index 952da73ba2..85c126a00b 100644 --- a/src/Rules/DeadCode/PossiblyPureFuncCallCollector.php +++ b/src/Rules/DeadCode/PossiblyPureFuncCallCollector.php @@ -11,7 +11,7 @@ /** * @implements Collector */ -class PossiblyPureFuncCallCollector implements Collector +final class PossiblyPureFuncCallCollector implements Collector { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/DeadCode/PossiblyPureMethodCallCollector.php b/src/Rules/DeadCode/PossiblyPureMethodCallCollector.php index 256d2bf781..5869714cf8 100644 --- a/src/Rules/DeadCode/PossiblyPureMethodCallCollector.php +++ b/src/Rules/DeadCode/PossiblyPureMethodCallCollector.php @@ -10,7 +10,7 @@ /** * @implements Collector, string, int}> */ -class PossiblyPureMethodCallCollector implements Collector +final class PossiblyPureMethodCallCollector implements Collector { public function __construct() diff --git a/src/Rules/DeadCode/PossiblyPureNewCollector.php b/src/Rules/DeadCode/PossiblyPureNewCollector.php index e2fabe49ca..f76f39c616 100644 --- a/src/Rules/DeadCode/PossiblyPureNewCollector.php +++ b/src/Rules/DeadCode/PossiblyPureNewCollector.php @@ -12,7 +12,7 @@ /** * @implements Collector */ -class PossiblyPureNewCollector implements Collector +final class PossiblyPureNewCollector implements Collector { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/DeadCode/PossiblyPureStaticCallCollector.php b/src/Rules/DeadCode/PossiblyPureStaticCallCollector.php index d934b57a6d..495cdf0248 100644 --- a/src/Rules/DeadCode/PossiblyPureStaticCallCollector.php +++ b/src/Rules/DeadCode/PossiblyPureStaticCallCollector.php @@ -10,7 +10,7 @@ /** * @implements Collector */ -class PossiblyPureStaticCallCollector implements Collector +final class PossiblyPureStaticCallCollector implements Collector { public function __construct() diff --git a/src/Rules/DeadCode/UnreachableStatementRule.php b/src/Rules/DeadCode/UnreachableStatementRule.php index f1b226ad57..17f166b788 100644 --- a/src/Rules/DeadCode/UnreachableStatementRule.php +++ b/src/Rules/DeadCode/UnreachableStatementRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class UnreachableStatementRule implements Rule +final class UnreachableStatementRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/DeadCode/UnusedPrivateConstantRule.php b/src/Rules/DeadCode/UnusedPrivateConstantRule.php index ccb160f60f..2e860a391f 100644 --- a/src/Rules/DeadCode/UnusedPrivateConstantRule.php +++ b/src/Rules/DeadCode/UnusedPrivateConstantRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class UnusedPrivateConstantRule implements Rule +final class UnusedPrivateConstantRule implements Rule { public function __construct(private AlwaysUsedClassConstantsExtensionProvider $extensionProvider) diff --git a/src/Rules/DeadCode/UnusedPrivateMethodRule.php b/src/Rules/DeadCode/UnusedPrivateMethodRule.php index aa868808d4..52ec29d01a 100644 --- a/src/Rules/DeadCode/UnusedPrivateMethodRule.php +++ b/src/Rules/DeadCode/UnusedPrivateMethodRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class UnusedPrivateMethodRule implements Rule +final class UnusedPrivateMethodRule implements Rule { public function __construct(private AlwaysUsedMethodExtensionProvider $extensionProvider) diff --git a/src/Rules/DeadCode/UnusedPrivatePropertyRule.php b/src/Rules/DeadCode/UnusedPrivatePropertyRule.php index 6af054659d..f3373d4c10 100644 --- a/src/Rules/DeadCode/UnusedPrivatePropertyRule.php +++ b/src/Rules/DeadCode/UnusedPrivatePropertyRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class UnusedPrivatePropertyRule implements Rule +final class UnusedPrivatePropertyRule implements Rule { /** diff --git a/src/Rules/Debug/DumpTypeRule.php b/src/Rules/Debug/DumpTypeRule.php index db1020b18a..f7d2a6dcb4 100644 --- a/src/Rules/Debug/DumpTypeRule.php +++ b/src/Rules/Debug/DumpTypeRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class DumpTypeRule implements Rule +final class DumpTypeRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/Debug/FileAssertRule.php b/src/Rules/Debug/FileAssertRule.php index e0899850c3..3f8e6a62ee 100644 --- a/src/Rules/Debug/FileAssertRule.php +++ b/src/Rules/Debug/FileAssertRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class FileAssertRule implements Rule +final class FileAssertRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/DirectRegistry.php b/src/Rules/DirectRegistry.php index 7ee53824ee..0dfb5d71ec 100644 --- a/src/Rules/DirectRegistry.php +++ b/src/Rules/DirectRegistry.php @@ -6,6 +6,9 @@ use function class_implements; use function class_parents; +/** + * @final + */ class DirectRegistry implements Registry { diff --git a/src/Rules/EnumCases/EnumCaseAttributesRule.php b/src/Rules/EnumCases/EnumCaseAttributesRule.php index 8d584b72f6..c7e0113764 100644 --- a/src/Rules/EnumCases/EnumCaseAttributesRule.php +++ b/src/Rules/EnumCases/EnumCaseAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class EnumCaseAttributesRule implements Rule +final class EnumCaseAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Exceptions/CatchWithUnthrownExceptionRule.php b/src/Rules/Exceptions/CatchWithUnthrownExceptionRule.php index 267d8c8200..d7d3b5bc71 100644 --- a/src/Rules/Exceptions/CatchWithUnthrownExceptionRule.php +++ b/src/Rules/Exceptions/CatchWithUnthrownExceptionRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CatchWithUnthrownExceptionRule implements Rule +final class CatchWithUnthrownExceptionRule implements Rule { public function __construct( diff --git a/src/Rules/Exceptions/CaughtExceptionExistenceRule.php b/src/Rules/Exceptions/CaughtExceptionExistenceRule.php index 1231a0d5e2..1c826e424c 100644 --- a/src/Rules/Exceptions/CaughtExceptionExistenceRule.php +++ b/src/Rules/Exceptions/CaughtExceptionExistenceRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class CaughtExceptionExistenceRule implements Rule +final class CaughtExceptionExistenceRule implements Rule { public function __construct( diff --git a/src/Rules/Exceptions/DefaultExceptionTypeResolver.php b/src/Rules/Exceptions/DefaultExceptionTypeResolver.php index cdb62d2597..fd6866bc72 100644 --- a/src/Rules/Exceptions/DefaultExceptionTypeResolver.php +++ b/src/Rules/Exceptions/DefaultExceptionTypeResolver.php @@ -7,7 +7,10 @@ use PHPStan\Reflection\ReflectionProvider; use function count; -/** @api */ +/** + * @api + * @final + */ class DefaultExceptionTypeResolver implements ExceptionTypeResolver { diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php b/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php index e2ee44c466..f3ed6e08f8 100644 --- a/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php +++ b/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class MissingCheckedExceptionInFunctionThrowsRule implements Rule +final class MissingCheckedExceptionInFunctionThrowsRule implements Rule { public function __construct(private MissingCheckedExceptionInThrowsCheck $check) diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php b/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php index 2aae5d488c..c564711b2f 100644 --- a/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php +++ b/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class MissingCheckedExceptionInMethodThrowsRule implements Rule +final class MissingCheckedExceptionInMethodThrowsRule implements Rule { public function __construct(private MissingCheckedExceptionInThrowsCheck $check) diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php b/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php index 508214f275..0756fcac6b 100644 --- a/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php +++ b/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php @@ -12,7 +12,7 @@ use PHPStan\Type\VerbosityLevel; use Throwable; -class MissingCheckedExceptionInThrowsCheck +final class MissingCheckedExceptionInThrowsCheck { public function __construct(private ExceptionTypeResolver $exceptionTypeResolver) diff --git a/src/Rules/Exceptions/NoncapturingCatchRule.php b/src/Rules/Exceptions/NoncapturingCatchRule.php index d91bf2fc14..499b62e154 100644 --- a/src/Rules/Exceptions/NoncapturingCatchRule.php +++ b/src/Rules/Exceptions/NoncapturingCatchRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class NoncapturingCatchRule implements Rule +final class NoncapturingCatchRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Exceptions/OverwrittenExitPointByFinallyRule.php b/src/Rules/Exceptions/OverwrittenExitPointByFinallyRule.php index bcf73954a9..f4a6e17499 100644 --- a/src/Rules/Exceptions/OverwrittenExitPointByFinallyRule.php +++ b/src/Rules/Exceptions/OverwrittenExitPointByFinallyRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class OverwrittenExitPointByFinallyRule implements Rule +final class OverwrittenExitPointByFinallyRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Exceptions/ThrowExprTypeRule.php b/src/Rules/Exceptions/ThrowExprTypeRule.php index 85f648ab97..71087449d7 100644 --- a/src/Rules/Exceptions/ThrowExprTypeRule.php +++ b/src/Rules/Exceptions/ThrowExprTypeRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class ThrowExprTypeRule implements Rule +final class ThrowExprTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Exceptions/ThrowExpressionRule.php b/src/Rules/Exceptions/ThrowExpressionRule.php index d9b5655ff6..5d3c7c2576 100644 --- a/src/Rules/Exceptions/ThrowExpressionRule.php +++ b/src/Rules/Exceptions/ThrowExpressionRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ThrowExpressionRule implements Rule +final class ThrowExpressionRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php b/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php index f07d6dc5c0..a2ead680c7 100644 --- a/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php +++ b/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ThrowsVoidFunctionWithExplicitThrowPointRule implements Rule +final class ThrowsVoidFunctionWithExplicitThrowPointRule implements Rule { public function __construct( diff --git a/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php b/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php index 59c0bd8448..327b55c202 100644 --- a/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php +++ b/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ThrowsVoidMethodWithExplicitThrowPointRule implements Rule +final class ThrowsVoidMethodWithExplicitThrowPointRule implements Rule { public function __construct( diff --git a/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php b/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php index e7f7f9849e..6688dec466 100644 --- a/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php +++ b/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class TooWideFunctionThrowTypeRule implements Rule +final class TooWideFunctionThrowTypeRule implements Rule { public function __construct(private TooWideThrowTypeCheck $check) diff --git a/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php b/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php index c9a5f231b6..55c69ee3a5 100644 --- a/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php +++ b/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class TooWideMethodThrowTypeRule implements Rule +final class TooWideMethodThrowTypeRule implements Rule { public function __construct(private FileTypeMapper $fileTypeMapper, private TooWideThrowTypeCheck $check) diff --git a/src/Rules/Exceptions/TooWideThrowTypeCheck.php b/src/Rules/Exceptions/TooWideThrowTypeCheck.php index 2a15d3139f..830d0f9a62 100644 --- a/src/Rules/Exceptions/TooWideThrowTypeCheck.php +++ b/src/Rules/Exceptions/TooWideThrowTypeCheck.php @@ -10,7 +10,7 @@ use PHPStan\Type\VerbosityLevel; use function array_map; -class TooWideThrowTypeCheck +final class TooWideThrowTypeCheck { /** diff --git a/src/Rules/FoundTypeResult.php b/src/Rules/FoundTypeResult.php index be17a4c76c..4e89ed8ec5 100644 --- a/src/Rules/FoundTypeResult.php +++ b/src/Rules/FoundTypeResult.php @@ -4,7 +4,10 @@ use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class FoundTypeResult { diff --git a/src/Rules/FunctionCallParametersCheck.php b/src/Rules/FunctionCallParametersCheck.php index 4c34fb4f43..1925232132 100644 --- a/src/Rules/FunctionCallParametersCheck.php +++ b/src/Rules/FunctionCallParametersCheck.php @@ -33,7 +33,7 @@ use function max; use function sprintf; -class FunctionCallParametersCheck +final class FunctionCallParametersCheck { public function __construct( diff --git a/src/Rules/FunctionDefinitionCheck.php b/src/Rules/FunctionDefinitionCheck.php index d2bdef50ba..fbedaffbd7 100644 --- a/src/Rules/FunctionDefinitionCheck.php +++ b/src/Rules/FunctionDefinitionCheck.php @@ -42,7 +42,7 @@ use function is_string; use function sprintf; -class FunctionDefinitionCheck +final class FunctionDefinitionCheck { public function __construct( diff --git a/src/Rules/FunctionReturnTypeCheck.php b/src/Rules/FunctionReturnTypeCheck.php index 82bb5d529b..be2eb86b1a 100644 --- a/src/Rules/FunctionReturnTypeCheck.php +++ b/src/Rules/FunctionReturnTypeCheck.php @@ -13,7 +13,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; -class FunctionReturnTypeCheck +final class FunctionReturnTypeCheck { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Functions/ArrayFilterRule.php b/src/Rules/Functions/ArrayFilterRule.php index 177d1d218d..7eeb304c3d 100644 --- a/src/Rules/Functions/ArrayFilterRule.php +++ b/src/Rules/Functions/ArrayFilterRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ArrayFilterRule implements Rule +final class ArrayFilterRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/ArrayValuesRule.php b/src/Rules/Functions/ArrayValuesRule.php index bb62442ec8..cf058b54a8 100644 --- a/src/Rules/Functions/ArrayValuesRule.php +++ b/src/Rules/Functions/ArrayValuesRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ArrayValuesRule implements Rule +final class ArrayValuesRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/ArrowFunctionAttributesRule.php b/src/Rules/Functions/ArrowFunctionAttributesRule.php index 1b4e1ddf03..b849f968aa 100644 --- a/src/Rules/Functions/ArrowFunctionAttributesRule.php +++ b/src/Rules/Functions/ArrowFunctionAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ArrowFunctionAttributesRule implements Rule +final class ArrowFunctionAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php b/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php index 371f2fa61a..cc7d673620 100644 --- a/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php +++ b/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ArrowFunctionReturnNullsafeByRefRule implements Rule +final class ArrowFunctionReturnNullsafeByRefRule implements Rule { public function __construct(private NullsafeCheck $nullsafeCheck) diff --git a/src/Rules/Functions/ArrowFunctionReturnTypeRule.php b/src/Rules/Functions/ArrowFunctionReturnTypeRule.php index aa0a9436de..b9b489c12a 100644 --- a/src/Rules/Functions/ArrowFunctionReturnTypeRule.php +++ b/src/Rules/Functions/ArrowFunctionReturnTypeRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class ArrowFunctionReturnTypeRule implements Rule +final class ArrowFunctionReturnTypeRule implements Rule { public function __construct(private FunctionReturnTypeCheck $returnTypeCheck) diff --git a/src/Rules/Functions/CallCallablesRule.php b/src/Rules/Functions/CallCallablesRule.php index e5c0d7dc8c..c21790b738 100644 --- a/src/Rules/Functions/CallCallablesRule.php +++ b/src/Rules/Functions/CallCallablesRule.php @@ -24,7 +24,7 @@ /** * @implements Rule */ -class CallCallablesRule implements Rule +final class CallCallablesRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/CallToFunctionParametersRule.php b/src/Rules/Functions/CallToFunctionParametersRule.php index 01b80d7f68..24dc76e186 100644 --- a/src/Rules/Functions/CallToFunctionParametersRule.php +++ b/src/Rules/Functions/CallToFunctionParametersRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CallToFunctionParametersRule implements Rule +final class CallToFunctionParametersRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider, private FunctionCallParametersCheck $check) diff --git a/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php b/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php index 685fa41de0..2df15b78f0 100644 --- a/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php +++ b/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class CallToFunctionStatementWithoutSideEffectsRule implements Rule +final class CallToFunctionStatementWithoutSideEffectsRule implements Rule { private const SIDE_EFFECT_FLIP_PARAMETERS = [ diff --git a/src/Rules/Functions/CallToNonExistentFunctionRule.php b/src/Rules/Functions/CallToNonExistentFunctionRule.php index 72fca5073c..a97e2caddb 100644 --- a/src/Rules/Functions/CallToNonExistentFunctionRule.php +++ b/src/Rules/Functions/CallToNonExistentFunctionRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CallToNonExistentFunctionRule implements Rule +final class CallToNonExistentFunctionRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/CallUserFuncRule.php b/src/Rules/Functions/CallUserFuncRule.php index 040a5aecce..415e04b748 100644 --- a/src/Rules/Functions/CallUserFuncRule.php +++ b/src/Rules/Functions/CallUserFuncRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class CallUserFuncRule implements Rule +final class CallUserFuncRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/ClosureAttributesRule.php b/src/Rules/Functions/ClosureAttributesRule.php index 170d9ad05e..841ae2f46c 100644 --- a/src/Rules/Functions/ClosureAttributesRule.php +++ b/src/Rules/Functions/ClosureAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ClosureAttributesRule implements Rule +final class ClosureAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Functions/ClosureReturnTypeRule.php b/src/Rules/Functions/ClosureReturnTypeRule.php index 98f72deb73..218edf5734 100644 --- a/src/Rules/Functions/ClosureReturnTypeRule.php +++ b/src/Rules/Functions/ClosureReturnTypeRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class ClosureReturnTypeRule implements Rule +final class ClosureReturnTypeRule implements Rule { public function __construct(private FunctionReturnTypeCheck $returnTypeCheck) diff --git a/src/Rules/Functions/DefineParametersRule.php b/src/Rules/Functions/DefineParametersRule.php index 5aac3ee5c2..83886f1ea2 100644 --- a/src/Rules/Functions/DefineParametersRule.php +++ b/src/Rules/Functions/DefineParametersRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class DefineParametersRule implements Rule +final class DefineParametersRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Functions/DuplicateFunctionDeclarationRule.php b/src/Rules/Functions/DuplicateFunctionDeclarationRule.php index 06d92643ae..6cf2b6c5c1 100644 --- a/src/Rules/Functions/DuplicateFunctionDeclarationRule.php +++ b/src/Rules/Functions/DuplicateFunctionDeclarationRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class DuplicateFunctionDeclarationRule implements Rule +final class DuplicateFunctionDeclarationRule implements Rule { public function __construct(private Reflector $reflector, private RelativePathHelper $relativePathHelper) diff --git a/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php b/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php index a2107c73a0..0b29af004c 100644 --- a/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php +++ b/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ExistingClassesInArrowFunctionTypehintsRule implements Rule +final class ExistingClassesInArrowFunctionTypehintsRule implements Rule { public function __construct(private FunctionDefinitionCheck $check, private PhpVersion $phpVersion) diff --git a/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php b/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php index 2c6dbd3ad0..0c5acfbd07 100644 --- a/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php +++ b/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ExistingClassesInClosureTypehintsRule implements Rule +final class ExistingClassesInClosureTypehintsRule implements Rule { public function __construct(private FunctionDefinitionCheck $check) diff --git a/src/Rules/Functions/ExistingClassesInTypehintsRule.php b/src/Rules/Functions/ExistingClassesInTypehintsRule.php index 6a9586a820..5df0e84af3 100644 --- a/src/Rules/Functions/ExistingClassesInTypehintsRule.php +++ b/src/Rules/Functions/ExistingClassesInTypehintsRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class ExistingClassesInTypehintsRule implements Rule +final class ExistingClassesInTypehintsRule implements Rule { public function __construct(private FunctionDefinitionCheck $check) diff --git a/src/Rules/Functions/FunctionAttributesRule.php b/src/Rules/Functions/FunctionAttributesRule.php index 2ccf122ac2..153c222091 100644 --- a/src/Rules/Functions/FunctionAttributesRule.php +++ b/src/Rules/Functions/FunctionAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class FunctionAttributesRule implements Rule +final class FunctionAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Functions/FunctionCallableRule.php b/src/Rules/Functions/FunctionCallableRule.php index fdecd2073f..827cf6e876 100644 --- a/src/Rules/Functions/FunctionCallableRule.php +++ b/src/Rules/Functions/FunctionCallableRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class FunctionCallableRule implements Rule +final class FunctionCallableRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider, private RuleLevelHelper $ruleLevelHelper, private PhpVersion $phpVersion, private bool $checkFunctionNameCase, private bool $reportMaybes) diff --git a/src/Rules/Functions/ImplodeFunctionRule.php b/src/Rules/Functions/ImplodeFunctionRule.php index b890a8ff66..93ade0dafc 100644 --- a/src/Rules/Functions/ImplodeFunctionRule.php +++ b/src/Rules/Functions/ImplodeFunctionRule.php @@ -20,7 +20,7 @@ * @deprecated Replaced by PHPStan\Rules\Functions\ImplodeParameterCastableToStringRuleTest * @implements Rule */ -class ImplodeFunctionRule implements Rule +final class ImplodeFunctionRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/ImplodeParameterCastableToStringRule.php b/src/Rules/Functions/ImplodeParameterCastableToStringRule.php index df5136a808..724a9ab079 100644 --- a/src/Rules/Functions/ImplodeParameterCastableToStringRule.php +++ b/src/Rules/Functions/ImplodeParameterCastableToStringRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class ImplodeParameterCastableToStringRule implements Rule +final class ImplodeParameterCastableToStringRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/IncompatibleArrowFunctionDefaultParameterTypeRule.php b/src/Rules/Functions/IncompatibleArrowFunctionDefaultParameterTypeRule.php index 585b00137a..7d5967fb2b 100644 --- a/src/Rules/Functions/IncompatibleArrowFunctionDefaultParameterTypeRule.php +++ b/src/Rules/Functions/IncompatibleArrowFunctionDefaultParameterTypeRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class IncompatibleArrowFunctionDefaultParameterTypeRule implements Rule +final class IncompatibleArrowFunctionDefaultParameterTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Functions/IncompatibleClosureDefaultParameterTypeRule.php b/src/Rules/Functions/IncompatibleClosureDefaultParameterTypeRule.php index 3cd1c51390..ab3565a612 100644 --- a/src/Rules/Functions/IncompatibleClosureDefaultParameterTypeRule.php +++ b/src/Rules/Functions/IncompatibleClosureDefaultParameterTypeRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class IncompatibleClosureDefaultParameterTypeRule implements Rule +final class IncompatibleClosureDefaultParameterTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php b/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php index a142269a68..7a64f9e7eb 100644 --- a/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php +++ b/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class IncompatibleDefaultParameterTypeRule implements Rule +final class IncompatibleDefaultParameterTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Functions/InnerFunctionRule.php b/src/Rules/Functions/InnerFunctionRule.php index 24118f5fbb..04694b4447 100644 --- a/src/Rules/Functions/InnerFunctionRule.php +++ b/src/Rules/Functions/InnerFunctionRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class InnerFunctionRule implements Rule +final class InnerFunctionRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Functions/InvalidLexicalVariablesInClosureUseRule.php b/src/Rules/Functions/InvalidLexicalVariablesInClosureUseRule.php index d722abffe1..1a823e18fe 100644 --- a/src/Rules/Functions/InvalidLexicalVariablesInClosureUseRule.php +++ b/src/Rules/Functions/InvalidLexicalVariablesInClosureUseRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class InvalidLexicalVariablesInClosureUseRule implements Rule +final class InvalidLexicalVariablesInClosureUseRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Functions/ParamAttributesRule.php b/src/Rules/Functions/ParamAttributesRule.php index ee9e8f257c..02006c1619 100644 --- a/src/Rules/Functions/ParamAttributesRule.php +++ b/src/Rules/Functions/ParamAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ParamAttributesRule implements Rule +final class ParamAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Functions/ParameterCastableToStringRule.php b/src/Rules/Functions/ParameterCastableToStringRule.php index b6b26da76e..d76428ff5d 100644 --- a/src/Rules/Functions/ParameterCastableToStringRule.php +++ b/src/Rules/Functions/ParameterCastableToStringRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class ParameterCastableToStringRule implements Rule +final class ParameterCastableToStringRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/PrintfArrayParametersRule.php b/src/Rules/Functions/PrintfArrayParametersRule.php index d06cdc8f4a..07adcf6b36 100644 --- a/src/Rules/Functions/PrintfArrayParametersRule.php +++ b/src/Rules/Functions/PrintfArrayParametersRule.php @@ -22,7 +22,7 @@ /** * @implements Rule */ -class PrintfArrayParametersRule implements Rule +final class PrintfArrayParametersRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/PrintfParametersRule.php b/src/Rules/Functions/PrintfParametersRule.php index a1d8e52f35..a80b44b995 100644 --- a/src/Rules/Functions/PrintfParametersRule.php +++ b/src/Rules/Functions/PrintfParametersRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class PrintfParametersRule implements Rule +final class PrintfParametersRule implements Rule { private const FORMAT_ARGUMENT_POSITIONS = [ diff --git a/src/Rules/Functions/RandomIntParametersRule.php b/src/Rules/Functions/RandomIntParametersRule.php index cc9da2c3ed..ecca6e7d09 100644 --- a/src/Rules/Functions/RandomIntParametersRule.php +++ b/src/Rules/Functions/RandomIntParametersRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class RandomIntParametersRule implements Rule +final class RandomIntParametersRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider, private bool $reportMaybes) diff --git a/src/Rules/Functions/RedefinedParametersRule.php b/src/Rules/Functions/RedefinedParametersRule.php index f364c82b9d..6e056c6df3 100644 --- a/src/Rules/Functions/RedefinedParametersRule.php +++ b/src/Rules/Functions/RedefinedParametersRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class RedefinedParametersRule implements Rule +final class RedefinedParametersRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Functions/ReturnNullsafeByRefRule.php b/src/Rules/Functions/ReturnNullsafeByRefRule.php index 84f2c81f3c..f90bdca70f 100644 --- a/src/Rules/Functions/ReturnNullsafeByRefRule.php +++ b/src/Rules/Functions/ReturnNullsafeByRefRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class ReturnNullsafeByRefRule implements Rule +final class ReturnNullsafeByRefRule implements Rule { public function __construct(private NullsafeCheck $nullsafeCheck) diff --git a/src/Rules/Functions/ReturnTypeRule.php b/src/Rules/Functions/ReturnTypeRule.php index ab9897713b..4a02e64989 100644 --- a/src/Rules/Functions/ReturnTypeRule.php +++ b/src/Rules/Functions/ReturnTypeRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class ReturnTypeRule implements Rule +final class ReturnTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/SortParameterCastableToStringRule.php b/src/Rules/Functions/SortParameterCastableToStringRule.php index dc1d4b63cf..02cb886886 100644 --- a/src/Rules/Functions/SortParameterCastableToStringRule.php +++ b/src/Rules/Functions/SortParameterCastableToStringRule.php @@ -26,7 +26,7 @@ /** * @implements Rule */ -class SortParameterCastableToStringRule implements Rule +final class SortParameterCastableToStringRule implements Rule { public function __construct( diff --git a/src/Rules/Functions/UnusedClosureUsesRule.php b/src/Rules/Functions/UnusedClosureUsesRule.php index 0caa2c2ae9..1494208b5b 100644 --- a/src/Rules/Functions/UnusedClosureUsesRule.php +++ b/src/Rules/Functions/UnusedClosureUsesRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class UnusedClosureUsesRule implements Rule +final class UnusedClosureUsesRule implements Rule { public function __construct(private UnusedFunctionParametersCheck $check) diff --git a/src/Rules/Functions/UselessFunctionReturnValueRule.php b/src/Rules/Functions/UselessFunctionReturnValueRule.php index b5af3ebd1c..d453fdca38 100644 --- a/src/Rules/Functions/UselessFunctionReturnValueRule.php +++ b/src/Rules/Functions/UselessFunctionReturnValueRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class UselessFunctionReturnValueRule implements Rule +final class UselessFunctionReturnValueRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/Functions/VariadicParametersDeclarationRule.php b/src/Rules/Functions/VariadicParametersDeclarationRule.php index 2d7c048d80..f346ec8e72 100644 --- a/src/Rules/Functions/VariadicParametersDeclarationRule.php +++ b/src/Rules/Functions/VariadicParametersDeclarationRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class VariadicParametersDeclarationRule implements Rule +final class VariadicParametersDeclarationRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Generators/YieldFromTypeRule.php b/src/Rules/Generators/YieldFromTypeRule.php index deb3f8212e..89a5d1fff1 100644 --- a/src/Rules/Generators/YieldFromTypeRule.php +++ b/src/Rules/Generators/YieldFromTypeRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class YieldFromTypeRule implements Rule +final class YieldFromTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generators/YieldInGeneratorRule.php b/src/Rules/Generators/YieldInGeneratorRule.php index 9be06b937d..25ddeef8bd 100644 --- a/src/Rules/Generators/YieldInGeneratorRule.php +++ b/src/Rules/Generators/YieldInGeneratorRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class YieldInGeneratorRule implements Rule +final class YieldInGeneratorRule implements Rule { public function __construct(private bool $reportMaybes) diff --git a/src/Rules/Generators/YieldTypeRule.php b/src/Rules/Generators/YieldTypeRule.php index 3de12e41a3..d97c3eb76b 100644 --- a/src/Rules/Generators/YieldTypeRule.php +++ b/src/Rules/Generators/YieldTypeRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class YieldTypeRule implements Rule +final class YieldTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/ClassAncestorsRule.php b/src/Rules/Generics/ClassAncestorsRule.php index 0359073c44..9c1efe6c4a 100644 --- a/src/Rules/Generics/ClassAncestorsRule.php +++ b/src/Rules/Generics/ClassAncestorsRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class ClassAncestorsRule implements Rule +final class ClassAncestorsRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/ClassTemplateTypeRule.php b/src/Rules/Generics/ClassTemplateTypeRule.php index a21d0561e5..6c21c3a33d 100644 --- a/src/Rules/Generics/ClassTemplateTypeRule.php +++ b/src/Rules/Generics/ClassTemplateTypeRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class ClassTemplateTypeRule implements Rule +final class ClassTemplateTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/CrossCheckInterfacesHelper.php b/src/Rules/Generics/CrossCheckInterfacesHelper.php index e35854b5ec..3e9c477cb3 100644 --- a/src/Rules/Generics/CrossCheckInterfacesHelper.php +++ b/src/Rules/Generics/CrossCheckInterfacesHelper.php @@ -9,7 +9,7 @@ use function array_key_exists; use function sprintf; -class CrossCheckInterfacesHelper +final class CrossCheckInterfacesHelper { /** diff --git a/src/Rules/Generics/EnumAncestorsRule.php b/src/Rules/Generics/EnumAncestorsRule.php index 8c786d7359..2cb7788d59 100644 --- a/src/Rules/Generics/EnumAncestorsRule.php +++ b/src/Rules/Generics/EnumAncestorsRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class EnumAncestorsRule implements Rule +final class EnumAncestorsRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/EnumTemplateTypeRule.php b/src/Rules/Generics/EnumTemplateTypeRule.php index 9c149811bf..6f5b049c7b 100644 --- a/src/Rules/Generics/EnumTemplateTypeRule.php +++ b/src/Rules/Generics/EnumTemplateTypeRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class EnumTemplateTypeRule implements Rule +final class EnumTemplateTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Generics/FunctionSignatureVarianceRule.php b/src/Rules/Generics/FunctionSignatureVarianceRule.php index e95b2e7712..e73c28da76 100644 --- a/src/Rules/Generics/FunctionSignatureVarianceRule.php +++ b/src/Rules/Generics/FunctionSignatureVarianceRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class FunctionSignatureVarianceRule implements Rule +final class FunctionSignatureVarianceRule implements Rule { public function __construct(private VarianceCheck $varianceCheck) diff --git a/src/Rules/Generics/FunctionTemplateTypeRule.php b/src/Rules/Generics/FunctionTemplateTypeRule.php index 3700dd3b73..2fe0ab6bfb 100644 --- a/src/Rules/Generics/FunctionTemplateTypeRule.php +++ b/src/Rules/Generics/FunctionTemplateTypeRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class FunctionTemplateTypeRule implements Rule +final class FunctionTemplateTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/GenericAncestorsCheck.php b/src/Rules/Generics/GenericAncestorsCheck.php index f78cbaf01c..fd60ba01a4 100644 --- a/src/Rules/Generics/GenericAncestorsCheck.php +++ b/src/Rules/Generics/GenericAncestorsCheck.php @@ -21,7 +21,7 @@ use function in_array; use function sprintf; -class GenericAncestorsCheck +final class GenericAncestorsCheck { /** diff --git a/src/Rules/Generics/GenericObjectTypeCheck.php b/src/Rules/Generics/GenericObjectTypeCheck.php index 9df0d06b44..46901218ef 100644 --- a/src/Rules/Generics/GenericObjectTypeCheck.php +++ b/src/Rules/Generics/GenericObjectTypeCheck.php @@ -21,7 +21,7 @@ use function sprintf; use function strtolower; -class GenericObjectTypeCheck +final class GenericObjectTypeCheck { /** diff --git a/src/Rules/Generics/InterfaceAncestorsRule.php b/src/Rules/Generics/InterfaceAncestorsRule.php index 465c2b9f36..c26dd6f290 100644 --- a/src/Rules/Generics/InterfaceAncestorsRule.php +++ b/src/Rules/Generics/InterfaceAncestorsRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class InterfaceAncestorsRule implements Rule +final class InterfaceAncestorsRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/InterfaceTemplateTypeRule.php b/src/Rules/Generics/InterfaceTemplateTypeRule.php index e808174a9f..30be451eae 100644 --- a/src/Rules/Generics/InterfaceTemplateTypeRule.php +++ b/src/Rules/Generics/InterfaceTemplateTypeRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class InterfaceTemplateTypeRule implements Rule +final class InterfaceTemplateTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/MethodSignatureVarianceRule.php b/src/Rules/Generics/MethodSignatureVarianceRule.php index 4f99378be0..4590950baa 100644 --- a/src/Rules/Generics/MethodSignatureVarianceRule.php +++ b/src/Rules/Generics/MethodSignatureVarianceRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class MethodSignatureVarianceRule implements Rule +final class MethodSignatureVarianceRule implements Rule { public function __construct(private VarianceCheck $varianceCheck) diff --git a/src/Rules/Generics/MethodTagTemplateTypeRule.php b/src/Rules/Generics/MethodTagTemplateTypeRule.php index 6b60d6557a..eafb0e946d 100644 --- a/src/Rules/Generics/MethodTagTemplateTypeRule.php +++ b/src/Rules/Generics/MethodTagTemplateTypeRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class MethodTagTemplateTypeRule implements Rule +final class MethodTagTemplateTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/MethodTemplateTypeRule.php b/src/Rules/Generics/MethodTemplateTypeRule.php index 80f21c3de7..fa9a6ecb06 100644 --- a/src/Rules/Generics/MethodTemplateTypeRule.php +++ b/src/Rules/Generics/MethodTemplateTypeRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class MethodTemplateTypeRule implements Rule +final class MethodTemplateTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/PropertyVarianceRule.php b/src/Rules/Generics/PropertyVarianceRule.php index b62c494ba5..4ddff55f11 100644 --- a/src/Rules/Generics/PropertyVarianceRule.php +++ b/src/Rules/Generics/PropertyVarianceRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class PropertyVarianceRule implements Rule +final class PropertyVarianceRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/TemplateTypeCheck.php b/src/Rules/Generics/TemplateTypeCheck.php index 234c4e8a71..5eb8d8bdf4 100644 --- a/src/Rules/Generics/TemplateTypeCheck.php +++ b/src/Rules/Generics/TemplateTypeCheck.php @@ -36,7 +36,7 @@ use function get_class; use function sprintf; -class TemplateTypeCheck +final class TemplateTypeCheck { public function __construct( diff --git a/src/Rules/Generics/TraitTemplateTypeRule.php b/src/Rules/Generics/TraitTemplateTypeRule.php index c90b398fcf..b08f12f32d 100644 --- a/src/Rules/Generics/TraitTemplateTypeRule.php +++ b/src/Rules/Generics/TraitTemplateTypeRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class TraitTemplateTypeRule implements Rule +final class TraitTemplateTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/UsedTraitsRule.php b/src/Rules/Generics/UsedTraitsRule.php index 5ad6141c06..72914da2e7 100644 --- a/src/Rules/Generics/UsedTraitsRule.php +++ b/src/Rules/Generics/UsedTraitsRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class UsedTraitsRule implements Rule +final class UsedTraitsRule implements Rule { public function __construct( diff --git a/src/Rules/Generics/VarianceCheck.php b/src/Rules/Generics/VarianceCheck.php index 7447c13cce..ca13ca07a6 100644 --- a/src/Rules/Generics/VarianceCheck.php +++ b/src/Rules/Generics/VarianceCheck.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use function sprintf; -class VarianceCheck +final class VarianceCheck { public function __construct( diff --git a/src/Rules/Ignore/IgnoreParseErrorRule.php b/src/Rules/Ignore/IgnoreParseErrorRule.php index 330ac5a8d1..e44f5de4c9 100644 --- a/src/Rules/Ignore/IgnoreParseErrorRule.php +++ b/src/Rules/Ignore/IgnoreParseErrorRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class IgnoreParseErrorRule implements Rule +final class IgnoreParseErrorRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/IssetCheck.php b/src/Rules/IssetCheck.php index a660be4e61..1a07cb30c7 100644 --- a/src/Rules/IssetCheck.php +++ b/src/Rules/IssetCheck.php @@ -17,7 +17,7 @@ /** * @phpstan-type ErrorIdentifier = 'empty'|'isset'|'nullCoalesce' */ -class IssetCheck +final class IssetCheck { public function __construct( diff --git a/src/Rules/Keywords/ContinueBreakInLoopRule.php b/src/Rules/Keywords/ContinueBreakInLoopRule.php index d97e3fd119..d8e8b00fcb 100644 --- a/src/Rules/Keywords/ContinueBreakInLoopRule.php +++ b/src/Rules/Keywords/ContinueBreakInLoopRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class ContinueBreakInLoopRule implements Rule +final class ContinueBreakInLoopRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Keywords/DeclareStrictTypesRule.php b/src/Rules/Keywords/DeclareStrictTypesRule.php index 3878c1c77c..b0b364030a 100644 --- a/src/Rules/Keywords/DeclareStrictTypesRule.php +++ b/src/Rules/Keywords/DeclareStrictTypesRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class DeclareStrictTypesRule implements Rule +final class DeclareStrictTypesRule implements Rule { public function __construct( diff --git a/src/Rules/LazyRegistry.php b/src/Rules/LazyRegistry.php index a9a1a728ec..f1b9181923 100644 --- a/src/Rules/LazyRegistry.php +++ b/src/Rules/LazyRegistry.php @@ -7,7 +7,7 @@ use function class_implements; use function class_parents; -class LazyRegistry implements Registry +final class LazyRegistry implements Registry { public const RULE_TAG = 'phpstan.rules.rule'; diff --git a/src/Rules/Methods/AbstractMethodInNonAbstractClassRule.php b/src/Rules/Methods/AbstractMethodInNonAbstractClassRule.php index d6d7b603c8..04ca707933 100644 --- a/src/Rules/Methods/AbstractMethodInNonAbstractClassRule.php +++ b/src/Rules/Methods/AbstractMethodInNonAbstractClassRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class AbstractMethodInNonAbstractClassRule implements Rule +final class AbstractMethodInNonAbstractClassRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/AbstractPrivateMethodRule.php b/src/Rules/Methods/AbstractPrivateMethodRule.php index 060bb2a27a..d087a19ce1 100644 --- a/src/Rules/Methods/AbstractPrivateMethodRule.php +++ b/src/Rules/Methods/AbstractPrivateMethodRule.php @@ -10,7 +10,7 @@ use function sprintf; /** @implements Rule */ -class AbstractPrivateMethodRule implements Rule +final class AbstractPrivateMethodRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/CallMethodsRule.php b/src/Rules/Methods/CallMethodsRule.php index 388dcb3208..67eee30157 100644 --- a/src/Rules/Methods/CallMethodsRule.php +++ b/src/Rules/Methods/CallMethodsRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class CallMethodsRule implements Rule +final class CallMethodsRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/CallPrivateMethodThroughStaticRule.php b/src/Rules/Methods/CallPrivateMethodThroughStaticRule.php index 0a37e48657..d381cdc659 100644 --- a/src/Rules/Methods/CallPrivateMethodThroughStaticRule.php +++ b/src/Rules/Methods/CallPrivateMethodThroughStaticRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class CallPrivateMethodThroughStaticRule implements Rule +final class CallPrivateMethodThroughStaticRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/CallStaticMethodsRule.php b/src/Rules/Methods/CallStaticMethodsRule.php index b1f2f013c2..1706bdb76e 100644 --- a/src/Rules/Methods/CallStaticMethodsRule.php +++ b/src/Rules/Methods/CallStaticMethodsRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class CallStaticMethodsRule implements Rule +final class CallStaticMethodsRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php b/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php index da361f018a..00a2352c99 100644 --- a/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php +++ b/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class CallToConstructorStatementWithoutSideEffectsRule implements Rule +final class CallToConstructorStatementWithoutSideEffectsRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php b/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php index abeaff4110..ed78c46f17 100644 --- a/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php +++ b/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class CallToMethodStatementWithoutSideEffectsRule implements Rule +final class CallToMethodStatementWithoutSideEffectsRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php b/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php index 9db2493f65..8f1828cbe4 100644 --- a/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php +++ b/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class CallToStaticMethodStatementWithoutSideEffectsRule implements Rule +final class CallToStaticMethodStatementWithoutSideEffectsRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/ConsistentConstructorRule.php b/src/Rules/Methods/ConsistentConstructorRule.php index e32d6fa551..ab8553b5cc 100644 --- a/src/Rules/Methods/ConsistentConstructorRule.php +++ b/src/Rules/Methods/ConsistentConstructorRule.php @@ -10,7 +10,7 @@ use function strtolower; /** @implements Rule */ -class ConsistentConstructorRule implements Rule +final class ConsistentConstructorRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/ConstructorReturnTypeRule.php b/src/Rules/Methods/ConstructorReturnTypeRule.php index c93634b94e..0f1388314d 100644 --- a/src/Rules/Methods/ConstructorReturnTypeRule.php +++ b/src/Rules/Methods/ConstructorReturnTypeRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class ConstructorReturnTypeRule implements Rule +final class ConstructorReturnTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/DirectAlwaysUsedMethodExtensionProvider.php b/src/Rules/Methods/DirectAlwaysUsedMethodExtensionProvider.php index b51cf7763a..3012ef21f2 100644 --- a/src/Rules/Methods/DirectAlwaysUsedMethodExtensionProvider.php +++ b/src/Rules/Methods/DirectAlwaysUsedMethodExtensionProvider.php @@ -2,7 +2,7 @@ namespace PHPStan\Rules\Methods; -class DirectAlwaysUsedMethodExtensionProvider implements AlwaysUsedMethodExtensionProvider +final class DirectAlwaysUsedMethodExtensionProvider implements AlwaysUsedMethodExtensionProvider { /** diff --git a/src/Rules/Methods/ExistingClassesInTypehintsRule.php b/src/Rules/Methods/ExistingClassesInTypehintsRule.php index 524f509395..702fc0f299 100644 --- a/src/Rules/Methods/ExistingClassesInTypehintsRule.php +++ b/src/Rules/Methods/ExistingClassesInTypehintsRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class ExistingClassesInTypehintsRule implements Rule +final class ExistingClassesInTypehintsRule implements Rule { public function __construct(private FunctionDefinitionCheck $check) diff --git a/src/Rules/Methods/FinalPrivateMethodRule.php b/src/Rules/Methods/FinalPrivateMethodRule.php index b0934bb0c4..b205234dc2 100644 --- a/src/Rules/Methods/FinalPrivateMethodRule.php +++ b/src/Rules/Methods/FinalPrivateMethodRule.php @@ -11,7 +11,7 @@ use function sprintf; /** @implements Rule */ -class FinalPrivateMethodRule implements Rule +final class FinalPrivateMethodRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/IllegalConstructorMethodCallRule.php b/src/Rules/Methods/IllegalConstructorMethodCallRule.php index 3305529134..1dba6ed6d2 100644 --- a/src/Rules/Methods/IllegalConstructorMethodCallRule.php +++ b/src/Rules/Methods/IllegalConstructorMethodCallRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class IllegalConstructorMethodCallRule implements Rule +final class IllegalConstructorMethodCallRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/IllegalConstructorStaticCallRule.php b/src/Rules/Methods/IllegalConstructorStaticCallRule.php index 6e839f54ca..fa747d6a2b 100644 --- a/src/Rules/Methods/IllegalConstructorStaticCallRule.php +++ b/src/Rules/Methods/IllegalConstructorStaticCallRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class IllegalConstructorStaticCallRule implements Rule +final class IllegalConstructorStaticCallRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/IncompatibleDefaultParameterTypeRule.php b/src/Rules/Methods/IncompatibleDefaultParameterTypeRule.php index 92aa955a0e..409b32d65f 100644 --- a/src/Rules/Methods/IncompatibleDefaultParameterTypeRule.php +++ b/src/Rules/Methods/IncompatibleDefaultParameterTypeRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class IncompatibleDefaultParameterTypeRule implements Rule +final class IncompatibleDefaultParameterTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php b/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php index cbd397ee94..6fca3226a5 100644 --- a/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php +++ b/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyAlwaysUsedMethodExtensionProvider implements AlwaysUsedMethodExtensionProvider +final class LazyAlwaysUsedMethodExtensionProvider implements AlwaysUsedMethodExtensionProvider { /** @var AlwaysUsedMethodExtension[]|null */ diff --git a/src/Rules/Methods/MethodAttributesRule.php b/src/Rules/Methods/MethodAttributesRule.php index ae220df96e..fefc7bac89 100644 --- a/src/Rules/Methods/MethodAttributesRule.php +++ b/src/Rules/Methods/MethodAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class MethodAttributesRule implements Rule +final class MethodAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Methods/MethodCallCheck.php b/src/Rules/Methods/MethodCallCheck.php index 57d0c165e6..165f41741c 100644 --- a/src/Rules/Methods/MethodCallCheck.php +++ b/src/Rules/Methods/MethodCallCheck.php @@ -19,7 +19,7 @@ use function sprintf; use function strtolower; -class MethodCallCheck +final class MethodCallCheck { public function __construct( diff --git a/src/Rules/Methods/MethodCallableRule.php b/src/Rules/Methods/MethodCallableRule.php index 15027c8c2c..2d18943608 100644 --- a/src/Rules/Methods/MethodCallableRule.php +++ b/src/Rules/Methods/MethodCallableRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class MethodCallableRule implements Rule +final class MethodCallableRule implements Rule { public function __construct(private MethodCallCheck $methodCallCheck, private PhpVersion $phpVersion) diff --git a/src/Rules/Methods/MethodParameterComparisonHelper.php b/src/Rules/Methods/MethodParameterComparisonHelper.php index 357d3cf9b3..2f21d52123 100644 --- a/src/Rules/Methods/MethodParameterComparisonHelper.php +++ b/src/Rules/Methods/MethodParameterComparisonHelper.php @@ -21,7 +21,7 @@ use function count; use function sprintf; -class MethodParameterComparisonHelper +final class MethodParameterComparisonHelper { public function __construct(private PhpVersion $phpVersion, private bool $genericPrototypeMessage) diff --git a/src/Rules/Methods/MethodSignatureRule.php b/src/Rules/Methods/MethodSignatureRule.php index f7a1a8120b..1e9d6b1ba2 100644 --- a/src/Rules/Methods/MethodSignatureRule.php +++ b/src/Rules/Methods/MethodSignatureRule.php @@ -37,7 +37,7 @@ /** * @implements Rule */ -class MethodSignatureRule implements Rule +final class MethodSignatureRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/MethodVisibilityInInterfaceRule.php b/src/Rules/Methods/MethodVisibilityInInterfaceRule.php index 2bb1fb915d..28dbd1e368 100644 --- a/src/Rules/Methods/MethodVisibilityInInterfaceRule.php +++ b/src/Rules/Methods/MethodVisibilityInInterfaceRule.php @@ -10,7 +10,7 @@ use function sprintf; /** @implements Rule */ -class MethodVisibilityInInterfaceRule implements Rule +final class MethodVisibilityInInterfaceRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/MissingMagicSerializationMethodsRule.php b/src/Rules/Methods/MissingMagicSerializationMethodsRule.php index a169d86794..4f7df1a538 100644 --- a/src/Rules/Methods/MissingMagicSerializationMethodsRule.php +++ b/src/Rules/Methods/MissingMagicSerializationMethodsRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class MissingMagicSerializationMethodsRule implements Rule +final class MissingMagicSerializationMethodsRule implements Rule { public function __construct(private PhpVersion $phpversion) diff --git a/src/Rules/Methods/MissingMethodImplementationRule.php b/src/Rules/Methods/MissingMethodImplementationRule.php index e7b6d2c3bb..ec6d40f0a3 100644 --- a/src/Rules/Methods/MissingMethodImplementationRule.php +++ b/src/Rules/Methods/MissingMethodImplementationRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class MissingMethodImplementationRule implements Rule +final class MissingMethodImplementationRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/NullsafeMethodCallRule.php b/src/Rules/Methods/NullsafeMethodCallRule.php index 008f4e7d08..e950e4cb9a 100644 --- a/src/Rules/Methods/NullsafeMethodCallRule.php +++ b/src/Rules/Methods/NullsafeMethodCallRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class NullsafeMethodCallRule implements Rule +final class NullsafeMethodCallRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Methods/OverridingMethodRule.php b/src/Rules/Methods/OverridingMethodRule.php index 17c4f09990..9d414f6f2b 100644 --- a/src/Rules/Methods/OverridingMethodRule.php +++ b/src/Rules/Methods/OverridingMethodRule.php @@ -29,7 +29,7 @@ /** * @implements Rule */ -class OverridingMethodRule implements Rule +final class OverridingMethodRule implements Rule { public function __construct( diff --git a/src/Rules/Methods/ReturnTypeRule.php b/src/Rules/Methods/ReturnTypeRule.php index d1140961a5..00753a620c 100644 --- a/src/Rules/Methods/ReturnTypeRule.php +++ b/src/Rules/Methods/ReturnTypeRule.php @@ -26,7 +26,7 @@ /** * @implements Rule */ -class ReturnTypeRule implements Rule +final class ReturnTypeRule implements Rule { public function __construct(private FunctionReturnTypeCheck $returnTypeCheck) diff --git a/src/Rules/Methods/StaticMethodCallCheck.php b/src/Rules/Methods/StaticMethodCallCheck.php index d50f8dfd32..6eca4510d9 100644 --- a/src/Rules/Methods/StaticMethodCallCheck.php +++ b/src/Rules/Methods/StaticMethodCallCheck.php @@ -32,7 +32,7 @@ use function sprintf; use function strtolower; -class StaticMethodCallCheck +final class StaticMethodCallCheck { public function __construct( diff --git a/src/Rules/Methods/StaticMethodCallableRule.php b/src/Rules/Methods/StaticMethodCallableRule.php index a9bae8d9d5..815fdce793 100644 --- a/src/Rules/Methods/StaticMethodCallableRule.php +++ b/src/Rules/Methods/StaticMethodCallableRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class StaticMethodCallableRule implements Rule +final class StaticMethodCallableRule implements Rule { public function __construct(private StaticMethodCallCheck $methodCallCheck, private PhpVersion $phpVersion) diff --git a/src/Rules/Missing/MissingReturnRule.php b/src/Rules/Missing/MissingReturnRule.php index 71102e4f23..a1f16bbd07 100644 --- a/src/Rules/Missing/MissingReturnRule.php +++ b/src/Rules/Missing/MissingReturnRule.php @@ -24,7 +24,7 @@ /** * @implements Rule */ -class MissingReturnRule implements Rule +final class MissingReturnRule implements Rule { public function __construct( diff --git a/src/Rules/MissingTypehintCheck.php b/src/Rules/MissingTypehintCheck.php index ae407a2a30..d6c55e62ec 100644 --- a/src/Rules/MissingTypehintCheck.php +++ b/src/Rules/MissingTypehintCheck.php @@ -27,7 +27,7 @@ use function sprintf; use function strtolower; -class MissingTypehintCheck +final class MissingTypehintCheck { public const MISSING_ITERABLE_VALUE_TYPE_TIP = 'See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type'; diff --git a/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php b/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php index b961e235fc..68d8a95465 100644 --- a/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php +++ b/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class ExistingNamesInGroupUseRule implements Rule +final class ExistingNamesInGroupUseRule implements Rule { public function __construct( diff --git a/src/Rules/Namespaces/ExistingNamesInUseRule.php b/src/Rules/Namespaces/ExistingNamesInUseRule.php index 92415f012c..381a2e1de6 100644 --- a/src/Rules/Namespaces/ExistingNamesInUseRule.php +++ b/src/Rules/Namespaces/ExistingNamesInUseRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ExistingNamesInUseRule implements Rule +final class ExistingNamesInUseRule implements Rule { public function __construct( diff --git a/src/Rules/NullsafeCheck.php b/src/Rules/NullsafeCheck.php index fd17b1f850..b8ff7713bf 100644 --- a/src/Rules/NullsafeCheck.php +++ b/src/Rules/NullsafeCheck.php @@ -4,7 +4,7 @@ use PhpParser\Node\Expr; -class NullsafeCheck +final class NullsafeCheck { public function containsNullSafe(Expr $expr): bool diff --git a/src/Rules/Operators/InvalidAssignVarRule.php b/src/Rules/Operators/InvalidAssignVarRule.php index 4f6e564849..7b24c91c52 100644 --- a/src/Rules/Operators/InvalidAssignVarRule.php +++ b/src/Rules/Operators/InvalidAssignVarRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class InvalidAssignVarRule implements Rule +final class InvalidAssignVarRule implements Rule { public function __construct(private NullsafeCheck $nullsafeCheck) diff --git a/src/Rules/Operators/InvalidBinaryOperationRule.php b/src/Rules/Operators/InvalidBinaryOperationRule.php index 2c42f7be1e..517c41b909 100644 --- a/src/Rules/Operators/InvalidBinaryOperationRule.php +++ b/src/Rules/Operators/InvalidBinaryOperationRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class InvalidBinaryOperationRule implements Rule +final class InvalidBinaryOperationRule implements Rule { public function __construct( diff --git a/src/Rules/Operators/InvalidComparisonOperationRule.php b/src/Rules/Operators/InvalidComparisonOperationRule.php index 43b8760503..8dc06429e5 100644 --- a/src/Rules/Operators/InvalidComparisonOperationRule.php +++ b/src/Rules/Operators/InvalidComparisonOperationRule.php @@ -23,7 +23,7 @@ /** * @implements Rule */ -class InvalidComparisonOperationRule implements Rule +final class InvalidComparisonOperationRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Operators/InvalidIncDecOperationRule.php b/src/Rules/Operators/InvalidIncDecOperationRule.php index 9cd551cbf3..6f3382d829 100644 --- a/src/Rules/Operators/InvalidIncDecOperationRule.php +++ b/src/Rules/Operators/InvalidIncDecOperationRule.php @@ -24,7 +24,7 @@ /** * @implements Rule */ -class InvalidIncDecOperationRule implements Rule +final class InvalidIncDecOperationRule implements Rule { public function __construct( diff --git a/src/Rules/Operators/InvalidUnaryOperationRule.php b/src/Rules/Operators/InvalidUnaryOperationRule.php index 099c1d6507..9ea9c07342 100644 --- a/src/Rules/Operators/InvalidUnaryOperationRule.php +++ b/src/Rules/Operators/InvalidUnaryOperationRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class InvalidUnaryOperationRule implements Rule +final class InvalidUnaryOperationRule implements Rule { public function __construct( diff --git a/src/Rules/ParameterCastableToStringCheck.php b/src/Rules/ParameterCastableToStringCheck.php index e34f6fba22..2d4dea0dbd 100644 --- a/src/Rules/ParameterCastableToStringCheck.php +++ b/src/Rules/ParameterCastableToStringCheck.php @@ -11,7 +11,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; -class ParameterCastableToStringCheck +final class ParameterCastableToStringCheck { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/PhpDoc/AssertRuleHelper.php b/src/Rules/PhpDoc/AssertRuleHelper.php index e7d3f8e73b..40551504fa 100644 --- a/src/Rules/PhpDoc/AssertRuleHelper.php +++ b/src/Rules/PhpDoc/AssertRuleHelper.php @@ -17,7 +17,7 @@ use function sprintf; use function substr; -class AssertRuleHelper +final class AssertRuleHelper { public function __construct(private InitializerExprTypeResolver $initializerExprTypeResolver) diff --git a/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php b/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php index 7ad14e65b6..eee8ad3281 100644 --- a/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php +++ b/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php @@ -17,7 +17,7 @@ use function sprintf; use function substr; -class ConditionalReturnTypeRuleHelper +final class ConditionalReturnTypeRuleHelper { /** diff --git a/src/Rules/PhpDoc/FunctionAssertRule.php b/src/Rules/PhpDoc/FunctionAssertRule.php index 0995b7574a..481d99f165 100644 --- a/src/Rules/PhpDoc/FunctionAssertRule.php +++ b/src/Rules/PhpDoc/FunctionAssertRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class FunctionAssertRule implements Rule +final class FunctionAssertRule implements Rule { public function __construct(private AssertRuleHelper $helper) diff --git a/src/Rules/PhpDoc/FunctionConditionalReturnTypeRule.php b/src/Rules/PhpDoc/FunctionConditionalReturnTypeRule.php index 5610c04925..56ed3c3cf7 100644 --- a/src/Rules/PhpDoc/FunctionConditionalReturnTypeRule.php +++ b/src/Rules/PhpDoc/FunctionConditionalReturnTypeRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class FunctionConditionalReturnTypeRule implements Rule +final class FunctionConditionalReturnTypeRule implements Rule { public function __construct(private ConditionalReturnTypeRuleHelper $helper) diff --git a/src/Rules/PhpDoc/GenericCallableRuleHelper.php b/src/Rules/PhpDoc/GenericCallableRuleHelper.php index 1fdb7a17c0..3e849cd1dc 100644 --- a/src/Rules/PhpDoc/GenericCallableRuleHelper.php +++ b/src/Rules/PhpDoc/GenericCallableRuleHelper.php @@ -18,7 +18,7 @@ use function array_keys; use function sprintf; -class GenericCallableRuleHelper +final class GenericCallableRuleHelper { public function __construct( diff --git a/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php b/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php index 3b89aea5c3..0008644c1a 100644 --- a/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php +++ b/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class IncompatibleClassConstantPhpDocTypeRule implements Rule +final class IncompatibleClassConstantPhpDocTypeRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php b/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php index e37db8ae89..131ee1ec91 100644 --- a/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php +++ b/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php @@ -24,7 +24,7 @@ /** * @implements Rule */ -class IncompatiblePhpDocTypeRule implements Rule +final class IncompatiblePhpDocTypeRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php b/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php index 4713a0cd08..184821b5a3 100644 --- a/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php +++ b/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class IncompatiblePropertyPhpDocTypeRule implements Rule +final class IncompatiblePropertyPhpDocTypeRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/IncompatibleSelfOutTypeRule.php b/src/Rules/PhpDoc/IncompatibleSelfOutTypeRule.php index 22be14246c..46164fff02 100644 --- a/src/Rules/PhpDoc/IncompatibleSelfOutTypeRule.php +++ b/src/Rules/PhpDoc/IncompatibleSelfOutTypeRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class IncompatibleSelfOutTypeRule implements Rule +final class IncompatibleSelfOutTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php b/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php index 5d4f65420c..923d65e143 100644 --- a/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php +++ b/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class InvalidPHPStanDocTagRule implements Rule +final class InvalidPHPStanDocTagRule implements Rule { private const POSSIBLE_PHPSTAN_TAGS = [ diff --git a/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php b/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php index 6734c54e4c..fe40a1bd61 100644 --- a/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php +++ b/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class InvalidPhpDocTagValueRule implements Rule +final class InvalidPhpDocTagValueRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php b/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php index 029f558bb8..4a227ffd07 100644 --- a/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php +++ b/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php @@ -23,7 +23,7 @@ /** * @implements Rule */ -class InvalidPhpDocVarTagTypeRule implements Rule +final class InvalidPhpDocVarTagTypeRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php b/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php index 1efb15ffaa..087c89b6ed 100644 --- a/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php +++ b/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class InvalidThrowsPhpDocValueRule implements Rule +final class InvalidThrowsPhpDocValueRule implements Rule { public function __construct(private FileTypeMapper $fileTypeMapper) diff --git a/src/Rules/PhpDoc/MethodAssertRule.php b/src/Rules/PhpDoc/MethodAssertRule.php index 5c24f9bca8..d8be08408f 100644 --- a/src/Rules/PhpDoc/MethodAssertRule.php +++ b/src/Rules/PhpDoc/MethodAssertRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class MethodAssertRule implements Rule +final class MethodAssertRule implements Rule { public function __construct(private AssertRuleHelper $helper) diff --git a/src/Rules/PhpDoc/MethodConditionalReturnTypeRule.php b/src/Rules/PhpDoc/MethodConditionalReturnTypeRule.php index 6925576665..56746b7f7b 100644 --- a/src/Rules/PhpDoc/MethodConditionalReturnTypeRule.php +++ b/src/Rules/PhpDoc/MethodConditionalReturnTypeRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class MethodConditionalReturnTypeRule implements Rule +final class MethodConditionalReturnTypeRule implements Rule { public function __construct(private ConditionalReturnTypeRuleHelper $helper) diff --git a/src/Rules/PhpDoc/PhpDocLineHelper.php b/src/Rules/PhpDoc/PhpDocLineHelper.php index d1d4b52e8b..b008e63470 100644 --- a/src/Rules/PhpDoc/PhpDocLineHelper.php +++ b/src/Rules/PhpDoc/PhpDocLineHelper.php @@ -5,7 +5,7 @@ use PhpParser\Node as PhpParserNode; use PHPStan\PhpDocParser\Ast\Node as PhpDocNode; -class PhpDocLineHelper +final class PhpDocLineHelper { /** diff --git a/src/Rules/PhpDoc/RequireExtendsDefinitionClassRule.php b/src/Rules/PhpDoc/RequireExtendsDefinitionClassRule.php index 27d8b3d6a3..9540555e4f 100644 --- a/src/Rules/PhpDoc/RequireExtendsDefinitionClassRule.php +++ b/src/Rules/PhpDoc/RequireExtendsDefinitionClassRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class RequireExtendsDefinitionClassRule implements Rule +final class RequireExtendsDefinitionClassRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/RequireExtendsDefinitionTraitRule.php b/src/Rules/PhpDoc/RequireExtendsDefinitionTraitRule.php index 174e7c9385..de4be753d9 100644 --- a/src/Rules/PhpDoc/RequireExtendsDefinitionTraitRule.php +++ b/src/Rules/PhpDoc/RequireExtendsDefinitionTraitRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class RequireExtendsDefinitionTraitRule implements Rule +final class RequireExtendsDefinitionTraitRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/RequireImplementsDefinitionClassRule.php b/src/Rules/PhpDoc/RequireImplementsDefinitionClassRule.php index 03e9422e2a..9a33044401 100644 --- a/src/Rules/PhpDoc/RequireImplementsDefinitionClassRule.php +++ b/src/Rules/PhpDoc/RequireImplementsDefinitionClassRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class RequireImplementsDefinitionClassRule implements Rule +final class RequireImplementsDefinitionClassRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/PhpDoc/RequireImplementsDefinitionTraitRule.php b/src/Rules/PhpDoc/RequireImplementsDefinitionTraitRule.php index 2c18b2e3ef..076ae342a0 100644 --- a/src/Rules/PhpDoc/RequireImplementsDefinitionTraitRule.php +++ b/src/Rules/PhpDoc/RequireImplementsDefinitionTraitRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class RequireImplementsDefinitionTraitRule implements Rule +final class RequireImplementsDefinitionTraitRule implements Rule { public function __construct( diff --git a/src/Rules/PhpDoc/UnresolvableTypeHelper.php b/src/Rules/PhpDoc/UnresolvableTypeHelper.php index 8b53af21d5..25b485dfad 100644 --- a/src/Rules/PhpDoc/UnresolvableTypeHelper.php +++ b/src/Rules/PhpDoc/UnresolvableTypeHelper.php @@ -7,7 +7,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeTraverser; -class UnresolvableTypeHelper +final class UnresolvableTypeHelper { public function containsUnresolvableType(Type $type): bool diff --git a/src/Rules/PhpDoc/VarTagChangedExpressionTypeRule.php b/src/Rules/PhpDoc/VarTagChangedExpressionTypeRule.php index 3968f05792..2ce5e70cce 100644 --- a/src/Rules/PhpDoc/VarTagChangedExpressionTypeRule.php +++ b/src/Rules/PhpDoc/VarTagChangedExpressionTypeRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class VarTagChangedExpressionTypeRule implements Rule +final class VarTagChangedExpressionTypeRule implements Rule { public function __construct(private VarTagTypeRuleHelper $varTagTypeRuleHelper) diff --git a/src/Rules/PhpDoc/VarTagTypeRuleHelper.php b/src/Rules/PhpDoc/VarTagTypeRuleHelper.php index d01b17396b..0070554896 100644 --- a/src/Rules/PhpDoc/VarTagTypeRuleHelper.php +++ b/src/Rules/PhpDoc/VarTagTypeRuleHelper.php @@ -21,7 +21,7 @@ use function is_string; use function sprintf; -class VarTagTypeRuleHelper +final class VarTagTypeRuleHelper { public function __construct(private bool $checkTypeAgainstPhpDocType, private bool $strictWideningCheck) diff --git a/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php b/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php index 031edf1743..9e4fc3ebf1 100644 --- a/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php +++ b/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php @@ -31,7 +31,7 @@ /** * @implements Rule */ -class WrongVariableNameInVarTagRule implements Rule +final class WrongVariableNameInVarTagRule implements Rule { public function __construct( diff --git a/src/Rules/Playground/FunctionNeverRule.php b/src/Rules/Playground/FunctionNeverRule.php index 94171408dd..84f6db5239 100644 --- a/src/Rules/Playground/FunctionNeverRule.php +++ b/src/Rules/Playground/FunctionNeverRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class FunctionNeverRule implements Rule +final class FunctionNeverRule implements Rule { public function __construct(private NeverRuleHelper $helper) diff --git a/src/Rules/Playground/MethodNeverRule.php b/src/Rules/Playground/MethodNeverRule.php index 443a31112f..d07066b4cc 100644 --- a/src/Rules/Playground/MethodNeverRule.php +++ b/src/Rules/Playground/MethodNeverRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class MethodNeverRule implements Rule +final class MethodNeverRule implements Rule { public function __construct(private NeverRuleHelper $helper) diff --git a/src/Rules/Playground/NeverRuleHelper.php b/src/Rules/Playground/NeverRuleHelper.php index 9da99b88e9..520b426424 100644 --- a/src/Rules/Playground/NeverRuleHelper.php +++ b/src/Rules/Playground/NeverRuleHelper.php @@ -7,7 +7,7 @@ use PHPStan\Type\NeverType; use PHPStan\Type\Type; -class NeverRuleHelper +final class NeverRuleHelper { /** diff --git a/src/Rules/Playground/NoPhpCodeRule.php b/src/Rules/Playground/NoPhpCodeRule.php index 2042177a2c..c8d0646083 100644 --- a/src/Rules/Playground/NoPhpCodeRule.php +++ b/src/Rules/Playground/NoPhpCodeRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class NoPhpCodeRule implements Rule +final class NoPhpCodeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Playground/NotAnalysedTraitRule.php b/src/Rules/Playground/NotAnalysedTraitRule.php index 7efa804442..c9ba6e0a24 100644 --- a/src/Rules/Playground/NotAnalysedTraitRule.php +++ b/src/Rules/Playground/NotAnalysedTraitRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class NotAnalysedTraitRule implements Rule +final class NotAnalysedTraitRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Properties/AccessPrivatePropertyThroughStaticRule.php b/src/Rules/Properties/AccessPrivatePropertyThroughStaticRule.php index d68fca010a..548e176c1d 100644 --- a/src/Rules/Properties/AccessPrivatePropertyThroughStaticRule.php +++ b/src/Rules/Properties/AccessPrivatePropertyThroughStaticRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class AccessPrivatePropertyThroughStaticRule implements Rule +final class AccessPrivatePropertyThroughStaticRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Properties/AccessPropertiesInAssignRule.php b/src/Rules/Properties/AccessPropertiesInAssignRule.php index e5d3d08b4e..5d7a9abcc4 100644 --- a/src/Rules/Properties/AccessPropertiesInAssignRule.php +++ b/src/Rules/Properties/AccessPropertiesInAssignRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class AccessPropertiesInAssignRule implements Rule +final class AccessPropertiesInAssignRule implements Rule { public function __construct(private AccessPropertiesRule $accessPropertiesRule) diff --git a/src/Rules/Properties/AccessPropertiesRule.php b/src/Rules/Properties/AccessPropertiesRule.php index 0a8d6cdbcf..773c715d04 100644 --- a/src/Rules/Properties/AccessPropertiesRule.php +++ b/src/Rules/Properties/AccessPropertiesRule.php @@ -26,7 +26,7 @@ /** * @implements Rule */ -class AccessPropertiesRule implements Rule +final class AccessPropertiesRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php b/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php index 21d6ff3e1f..f9a6e61602 100644 --- a/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php +++ b/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php @@ -10,7 +10,7 @@ /** * @implements Rule */ -class AccessStaticPropertiesInAssignRule implements Rule +final class AccessStaticPropertiesInAssignRule implements Rule { public function __construct(private AccessStaticPropertiesRule $accessStaticPropertiesRule) diff --git a/src/Rules/Properties/AccessStaticPropertiesRule.php b/src/Rules/Properties/AccessStaticPropertiesRule.php index 9d929c39a2..67a03643f9 100644 --- a/src/Rules/Properties/AccessStaticPropertiesRule.php +++ b/src/Rules/Properties/AccessStaticPropertiesRule.php @@ -34,7 +34,7 @@ /** * @implements Rule */ -class AccessStaticPropertiesRule implements Rule +final class AccessStaticPropertiesRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php b/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php index 8fd67c1e5f..3076d2d3d8 100644 --- a/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php +++ b/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class DefaultValueTypesAssignedToPropertiesRule implements Rule +final class DefaultValueTypesAssignedToPropertiesRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php b/src/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php index 6ce75189d7..0130c2f633 100644 --- a/src/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php +++ b/src/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php @@ -2,7 +2,7 @@ namespace PHPStan\Rules\Properties; -class DirectReadWritePropertiesExtensionProvider implements ReadWritePropertiesExtensionProvider +final class DirectReadWritePropertiesExtensionProvider implements ReadWritePropertiesExtensionProvider { /** diff --git a/src/Rules/Properties/ExistingClassesInPropertiesRule.php b/src/Rules/Properties/ExistingClassesInPropertiesRule.php index 2b138d5bbd..62678e3f14 100644 --- a/src/Rules/Properties/ExistingClassesInPropertiesRule.php +++ b/src/Rules/Properties/ExistingClassesInPropertiesRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class ExistingClassesInPropertiesRule implements Rule +final class ExistingClassesInPropertiesRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/FoundPropertyReflection.php b/src/Rules/Properties/FoundPropertyReflection.php index 0132ac0d3b..57577364cd 100644 --- a/src/Rules/Properties/FoundPropertyReflection.php +++ b/src/Rules/Properties/FoundPropertyReflection.php @@ -10,7 +10,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -class FoundPropertyReflection implements PropertyReflection +final class FoundPropertyReflection implements PropertyReflection { public function __construct( diff --git a/src/Rules/Properties/InvalidCallablePropertyTypeRule.php b/src/Rules/Properties/InvalidCallablePropertyTypeRule.php index 2a8ed41bd8..4c4a2aa655 100644 --- a/src/Rules/Properties/InvalidCallablePropertyTypeRule.php +++ b/src/Rules/Properties/InvalidCallablePropertyTypeRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class InvalidCallablePropertyTypeRule implements Rule +final class InvalidCallablePropertyTypeRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php b/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php index 3f61fd0fb8..f42cb7e7d5 100644 --- a/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php +++ b/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyReadWritePropertiesExtensionProvider implements ReadWritePropertiesExtensionProvider +final class LazyReadWritePropertiesExtensionProvider implements ReadWritePropertiesExtensionProvider { /** @var ReadWritePropertiesExtension[]|null */ diff --git a/src/Rules/Properties/MissingReadOnlyByPhpDocPropertyAssignRule.php b/src/Rules/Properties/MissingReadOnlyByPhpDocPropertyAssignRule.php index 72b30052e6..bbb53f1089 100644 --- a/src/Rules/Properties/MissingReadOnlyByPhpDocPropertyAssignRule.php +++ b/src/Rules/Properties/MissingReadOnlyByPhpDocPropertyAssignRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class MissingReadOnlyByPhpDocPropertyAssignRule implements Rule +final class MissingReadOnlyByPhpDocPropertyAssignRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/MissingReadOnlyPropertyAssignRule.php b/src/Rules/Properties/MissingReadOnlyPropertyAssignRule.php index 54d64878ad..de05aaaab9 100644 --- a/src/Rules/Properties/MissingReadOnlyPropertyAssignRule.php +++ b/src/Rules/Properties/MissingReadOnlyPropertyAssignRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class MissingReadOnlyPropertyAssignRule implements Rule +final class MissingReadOnlyPropertyAssignRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/NullsafePropertyFetchRule.php b/src/Rules/Properties/NullsafePropertyFetchRule.php index 1195f47022..6b72cf6df7 100644 --- a/src/Rules/Properties/NullsafePropertyFetchRule.php +++ b/src/Rules/Properties/NullsafePropertyFetchRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class NullsafePropertyFetchRule implements Rule +final class NullsafePropertyFetchRule implements Rule { public function __construct() diff --git a/src/Rules/Properties/OverridingPropertyRule.php b/src/Rules/Properties/OverridingPropertyRule.php index ca10cd4434..be6a9fca4f 100644 --- a/src/Rules/Properties/OverridingPropertyRule.php +++ b/src/Rules/Properties/OverridingPropertyRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class OverridingPropertyRule implements Rule +final class OverridingPropertyRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/PropertiesInInterfaceRule.php b/src/Rules/Properties/PropertiesInInterfaceRule.php index 35ce4c2c8c..d9f62fa618 100644 --- a/src/Rules/Properties/PropertiesInInterfaceRule.php +++ b/src/Rules/Properties/PropertiesInInterfaceRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class PropertiesInInterfaceRule implements Rule +final class PropertiesInInterfaceRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Properties/PropertyAttributesRule.php b/src/Rules/Properties/PropertyAttributesRule.php index b0d9cf2812..375eb439cf 100644 --- a/src/Rules/Properties/PropertyAttributesRule.php +++ b/src/Rules/Properties/PropertyAttributesRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class PropertyAttributesRule implements Rule +final class PropertyAttributesRule implements Rule { public function __construct(private AttributesCheck $attributesCheck) diff --git a/src/Rules/Properties/PropertyDescriptor.php b/src/Rules/Properties/PropertyDescriptor.php index e45011b361..8588a1a57a 100644 --- a/src/Rules/Properties/PropertyDescriptor.php +++ b/src/Rules/Properties/PropertyDescriptor.php @@ -9,7 +9,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; -class PropertyDescriptor +final class PropertyDescriptor { /** diff --git a/src/Rules/Properties/PropertyReflectionFinder.php b/src/Rules/Properties/PropertyReflectionFinder.php index 3f6cc8b000..6cd33e10d5 100644 --- a/src/Rules/Properties/PropertyReflectionFinder.php +++ b/src/Rules/Properties/PropertyReflectionFinder.php @@ -11,7 +11,7 @@ use PHPStan\Type\Type; use function array_map; -class PropertyReflectionFinder +final class PropertyReflectionFinder { /** diff --git a/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRefRule.php b/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRefRule.php index ce0b1d1f05..981415e915 100644 --- a/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRefRule.php +++ b/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRefRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ReadOnlyByPhpDocPropertyAssignRefRule implements Rule +final class ReadOnlyByPhpDocPropertyAssignRefRule implements Rule { public function __construct(private PropertyReflectionFinder $propertyReflectionFinder) diff --git a/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRule.php b/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRule.php index 9d72bb3895..c71ce58bbc 100644 --- a/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRule.php +++ b/src/Rules/Properties/ReadOnlyByPhpDocPropertyAssignRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ReadOnlyByPhpDocPropertyAssignRule implements Rule +final class ReadOnlyByPhpDocPropertyAssignRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/ReadOnlyByPhpDocPropertyRule.php b/src/Rules/Properties/ReadOnlyByPhpDocPropertyRule.php index a024d70b14..93e7a0fb4d 100644 --- a/src/Rules/Properties/ReadOnlyByPhpDocPropertyRule.php +++ b/src/Rules/Properties/ReadOnlyByPhpDocPropertyRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ReadOnlyByPhpDocPropertyRule implements Rule +final class ReadOnlyByPhpDocPropertyRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Properties/ReadOnlyPropertyAssignRefRule.php b/src/Rules/Properties/ReadOnlyPropertyAssignRefRule.php index b50e887e3b..30f7233614 100644 --- a/src/Rules/Properties/ReadOnlyPropertyAssignRefRule.php +++ b/src/Rules/Properties/ReadOnlyPropertyAssignRefRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ReadOnlyPropertyAssignRefRule implements Rule +final class ReadOnlyPropertyAssignRefRule implements Rule { public function __construct(private PropertyReflectionFinder $propertyReflectionFinder) diff --git a/src/Rules/Properties/ReadOnlyPropertyAssignRule.php b/src/Rules/Properties/ReadOnlyPropertyAssignRule.php index 47d132b639..2b5c7d010a 100644 --- a/src/Rules/Properties/ReadOnlyPropertyAssignRule.php +++ b/src/Rules/Properties/ReadOnlyPropertyAssignRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class ReadOnlyPropertyAssignRule implements Rule +final class ReadOnlyPropertyAssignRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/ReadOnlyPropertyRule.php b/src/Rules/Properties/ReadOnlyPropertyRule.php index a622964ed5..5e777ae164 100644 --- a/src/Rules/Properties/ReadOnlyPropertyRule.php +++ b/src/Rules/Properties/ReadOnlyPropertyRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class ReadOnlyPropertyRule implements Rule +final class ReadOnlyPropertyRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php b/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php index 5e326c12a8..2d2ab20f6a 100644 --- a/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php +++ b/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class ReadingWriteOnlyPropertiesRule implements Rule +final class ReadingWriteOnlyPropertiesRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/TypesAssignedToPropertiesRule.php b/src/Rules/Properties/TypesAssignedToPropertiesRule.php index 9e15b0b33f..bb2c2e83c0 100644 --- a/src/Rules/Properties/TypesAssignedToPropertiesRule.php +++ b/src/Rules/Properties/TypesAssignedToPropertiesRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class TypesAssignedToPropertiesRule implements Rule +final class TypesAssignedToPropertiesRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/UninitializedPropertyRule.php b/src/Rules/Properties/UninitializedPropertyRule.php index a2995c3886..525a9ecbb6 100644 --- a/src/Rules/Properties/UninitializedPropertyRule.php +++ b/src/Rules/Properties/UninitializedPropertyRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class UninitializedPropertyRule implements Rule +final class UninitializedPropertyRule implements Rule { public function __construct( diff --git a/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php b/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php index 5acc86ba91..bfe8b1f7bf 100644 --- a/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php +++ b/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class WritingToReadOnlyPropertiesRule implements Rule +final class WritingToReadOnlyPropertiesRule implements Rule { public function __construct( diff --git a/src/Rules/Pure/FunctionPurityCheck.php b/src/Rules/Pure/FunctionPurityCheck.php index 4e294dc0fe..e70d2eb292 100644 --- a/src/Rules/Pure/FunctionPurityCheck.php +++ b/src/Rules/Pure/FunctionPurityCheck.php @@ -20,7 +20,7 @@ use function lcfirst; use function sprintf; -class FunctionPurityCheck +final class FunctionPurityCheck { /** diff --git a/src/Rules/Pure/PureFunctionRule.php b/src/Rules/Pure/PureFunctionRule.php index 838e9bc67b..2355503a93 100644 --- a/src/Rules/Pure/PureFunctionRule.php +++ b/src/Rules/Pure/PureFunctionRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class PureFunctionRule implements Rule +final class PureFunctionRule implements Rule { public function __construct(private FunctionPurityCheck $check) diff --git a/src/Rules/Pure/PureMethodRule.php b/src/Rules/Pure/PureMethodRule.php index a023720118..30685b4d6e 100644 --- a/src/Rules/Pure/PureMethodRule.php +++ b/src/Rules/Pure/PureMethodRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class PureMethodRule implements Rule +final class PureMethodRule implements Rule { public function __construct(private FunctionPurityCheck $check) diff --git a/src/Rules/Regexp/RegularExpressionPatternRule.php b/src/Rules/Regexp/RegularExpressionPatternRule.php index d99fe4e4ec..b19c3904bd 100644 --- a/src/Rules/Regexp/RegularExpressionPatternRule.php +++ b/src/Rules/Regexp/RegularExpressionPatternRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class RegularExpressionPatternRule implements Rule +final class RegularExpressionPatternRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Regexp/RegularExpressionQuotingRule.php b/src/Rules/Regexp/RegularExpressionQuotingRule.php index 873209c00f..4ffabf4ccd 100644 --- a/src/Rules/Regexp/RegularExpressionQuotingRule.php +++ b/src/Rules/Regexp/RegularExpressionQuotingRule.php @@ -28,7 +28,7 @@ /** * @implements Rule */ -class RegularExpressionQuotingRule implements Rule +final class RegularExpressionQuotingRule implements Rule { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/RuleErrorBuilder.php b/src/Rules/RuleErrorBuilder.php index a838200800..bf673c0fe8 100644 --- a/src/Rules/RuleErrorBuilder.php +++ b/src/Rules/RuleErrorBuilder.php @@ -13,6 +13,7 @@ /** * @api + * @final * @template-covariant T of RuleError */ class RuleErrorBuilder diff --git a/src/Rules/RuleErrors/RuleError1.php b/src/Rules/RuleErrors/RuleError1.php index ef7771dea3..c7a2338b30 100644 --- a/src/Rules/RuleErrors/RuleError1.php +++ b/src/Rules/RuleErrors/RuleError1.php @@ -7,7 +7,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError1 implements RuleError +final class RuleError1 implements RuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError101.php b/src/Rules/RuleErrors/RuleError101.php index cd6a40afe3..ff16ad5339 100644 --- a/src/Rules/RuleErrors/RuleError101.php +++ b/src/Rules/RuleErrors/RuleError101.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError101 implements RuleError, FileRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError101 implements RuleError, FileRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError103.php b/src/Rules/RuleErrors/RuleError103.php index a88780c212..6c125de9b7 100644 --- a/src/Rules/RuleErrors/RuleError103.php +++ b/src/Rules/RuleErrors/RuleError103.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError103 implements RuleError, LineRuleError, FileRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError103 implements RuleError, LineRuleError, FileRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError105.php b/src/Rules/RuleErrors/RuleError105.php index 0fb7b8bc41..a0b8945f52 100644 --- a/src/Rules/RuleErrors/RuleError105.php +++ b/src/Rules/RuleErrors/RuleError105.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError105 implements RuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError105 implements RuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError107.php b/src/Rules/RuleErrors/RuleError107.php index 35b081c092..a0b9b85c84 100644 --- a/src/Rules/RuleErrors/RuleError107.php +++ b/src/Rules/RuleErrors/RuleError107.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError107 implements RuleError, LineRuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError107 implements RuleError, LineRuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError109.php b/src/Rules/RuleErrors/RuleError109.php index 22ddff6f25..a4f81cce53 100644 --- a/src/Rules/RuleErrors/RuleError109.php +++ b/src/Rules/RuleErrors/RuleError109.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError109 implements RuleError, FileRuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError109 implements RuleError, FileRuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError11.php b/src/Rules/RuleErrors/RuleError11.php index 50d8bdb997..be6bc0923a 100644 --- a/src/Rules/RuleErrors/RuleError11.php +++ b/src/Rules/RuleErrors/RuleError11.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError11 implements RuleError, LineRuleError, TipRuleError +final class RuleError11 implements RuleError, LineRuleError, TipRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError111.php b/src/Rules/RuleErrors/RuleError111.php index 3024d5fdf6..ac0b980e01 100644 --- a/src/Rules/RuleErrors/RuleError111.php +++ b/src/Rules/RuleErrors/RuleError111.php @@ -12,7 +12,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError111 implements RuleError, LineRuleError, FileRuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError111 implements RuleError, LineRuleError, FileRuleError, TipRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError113.php b/src/Rules/RuleErrors/RuleError113.php index ee74c1f0ac..5d602a2fe5 100644 --- a/src/Rules/RuleErrors/RuleError113.php +++ b/src/Rules/RuleErrors/RuleError113.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError113 implements RuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError113 implements RuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError115.php b/src/Rules/RuleErrors/RuleError115.php index 7b5f1af9e5..f6d020a9e2 100644 --- a/src/Rules/RuleErrors/RuleError115.php +++ b/src/Rules/RuleErrors/RuleError115.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError115 implements RuleError, LineRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError115 implements RuleError, LineRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError117.php b/src/Rules/RuleErrors/RuleError117.php index 2492802799..80b8bd5fb2 100644 --- a/src/Rules/RuleErrors/RuleError117.php +++ b/src/Rules/RuleErrors/RuleError117.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError117 implements RuleError, FileRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError117 implements RuleError, FileRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError119.php b/src/Rules/RuleErrors/RuleError119.php index 6d6fb6b7a9..ddee015752 100644 --- a/src/Rules/RuleErrors/RuleError119.php +++ b/src/Rules/RuleErrors/RuleError119.php @@ -12,7 +12,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError119 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError119 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError121.php b/src/Rules/RuleErrors/RuleError121.php index 2c8995a0b3..3a05d8d3c3 100644 --- a/src/Rules/RuleErrors/RuleError121.php +++ b/src/Rules/RuleErrors/RuleError121.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError121 implements RuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError121 implements RuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError123.php b/src/Rules/RuleErrors/RuleError123.php index fedd8de5d9..4bae22b6a5 100644 --- a/src/Rules/RuleErrors/RuleError123.php +++ b/src/Rules/RuleErrors/RuleError123.php @@ -12,7 +12,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError123 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError123 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError125.php b/src/Rules/RuleErrors/RuleError125.php index d64be7de95..a24ea70b44 100644 --- a/src/Rules/RuleErrors/RuleError125.php +++ b/src/Rules/RuleErrors/RuleError125.php @@ -12,7 +12,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError125 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError125 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError127.php b/src/Rules/RuleErrors/RuleError127.php index dfb94ecc15..0c2dea58a7 100644 --- a/src/Rules/RuleErrors/RuleError127.php +++ b/src/Rules/RuleErrors/RuleError127.php @@ -13,7 +13,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError127 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError127 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError13.php b/src/Rules/RuleErrors/RuleError13.php index 3ecb8d6233..a606a29b87 100644 --- a/src/Rules/RuleErrors/RuleError13.php +++ b/src/Rules/RuleErrors/RuleError13.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError13 implements RuleError, FileRuleError, TipRuleError +final class RuleError13 implements RuleError, FileRuleError, TipRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError15.php b/src/Rules/RuleErrors/RuleError15.php index 956f7fe0f0..b952f9a3c5 100644 --- a/src/Rules/RuleErrors/RuleError15.php +++ b/src/Rules/RuleErrors/RuleError15.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError15 implements RuleError, LineRuleError, FileRuleError, TipRuleError +final class RuleError15 implements RuleError, LineRuleError, FileRuleError, TipRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError17.php b/src/Rules/RuleErrors/RuleError17.php index 827f6a8724..8cdf151a33 100644 --- a/src/Rules/RuleErrors/RuleError17.php +++ b/src/Rules/RuleErrors/RuleError17.php @@ -8,7 +8,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError17 implements RuleError, IdentifierRuleError +final class RuleError17 implements RuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError19.php b/src/Rules/RuleErrors/RuleError19.php index 3732da9802..d7a3a4388b 100644 --- a/src/Rules/RuleErrors/RuleError19.php +++ b/src/Rules/RuleErrors/RuleError19.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError19 implements RuleError, LineRuleError, IdentifierRuleError +final class RuleError19 implements RuleError, LineRuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError21.php b/src/Rules/RuleErrors/RuleError21.php index 3a6f7eb2d3..91516979e0 100644 --- a/src/Rules/RuleErrors/RuleError21.php +++ b/src/Rules/RuleErrors/RuleError21.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError21 implements RuleError, FileRuleError, IdentifierRuleError +final class RuleError21 implements RuleError, FileRuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError23.php b/src/Rules/RuleErrors/RuleError23.php index 911a7a05fe..4dcb3e0bae 100644 --- a/src/Rules/RuleErrors/RuleError23.php +++ b/src/Rules/RuleErrors/RuleError23.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError23 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError +final class RuleError23 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError25.php b/src/Rules/RuleErrors/RuleError25.php index 1c5c6001e8..429a1ed0ef 100644 --- a/src/Rules/RuleErrors/RuleError25.php +++ b/src/Rules/RuleErrors/RuleError25.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError25 implements RuleError, TipRuleError, IdentifierRuleError +final class RuleError25 implements RuleError, TipRuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError27.php b/src/Rules/RuleErrors/RuleError27.php index e592c0d98e..6910c787fd 100644 --- a/src/Rules/RuleErrors/RuleError27.php +++ b/src/Rules/RuleErrors/RuleError27.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError27 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError +final class RuleError27 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError29.php b/src/Rules/RuleErrors/RuleError29.php index 68f71ae5c7..85a6c85960 100644 --- a/src/Rules/RuleErrors/RuleError29.php +++ b/src/Rules/RuleErrors/RuleError29.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError29 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError +final class RuleError29 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError3.php b/src/Rules/RuleErrors/RuleError3.php index ce5c8fffcc..17ab507d2a 100644 --- a/src/Rules/RuleErrors/RuleError3.php +++ b/src/Rules/RuleErrors/RuleError3.php @@ -8,7 +8,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError3 implements RuleError, LineRuleError +final class RuleError3 implements RuleError, LineRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError31.php b/src/Rules/RuleErrors/RuleError31.php index 6402df1887..d9e7665e9b 100644 --- a/src/Rules/RuleErrors/RuleError31.php +++ b/src/Rules/RuleErrors/RuleError31.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError31 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError +final class RuleError31 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError33.php b/src/Rules/RuleErrors/RuleError33.php index 0f37cede7c..692da9a71a 100644 --- a/src/Rules/RuleErrors/RuleError33.php +++ b/src/Rules/RuleErrors/RuleError33.php @@ -8,7 +8,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError33 implements RuleError, MetadataRuleError +final class RuleError33 implements RuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError35.php b/src/Rules/RuleErrors/RuleError35.php index 65868071a8..91c52036bb 100644 --- a/src/Rules/RuleErrors/RuleError35.php +++ b/src/Rules/RuleErrors/RuleError35.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError35 implements RuleError, LineRuleError, MetadataRuleError +final class RuleError35 implements RuleError, LineRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError37.php b/src/Rules/RuleErrors/RuleError37.php index fe0d25a3f5..a92ded0e4f 100644 --- a/src/Rules/RuleErrors/RuleError37.php +++ b/src/Rules/RuleErrors/RuleError37.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError37 implements RuleError, FileRuleError, MetadataRuleError +final class RuleError37 implements RuleError, FileRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError39.php b/src/Rules/RuleErrors/RuleError39.php index 1a50b299fc..7b74800753 100644 --- a/src/Rules/RuleErrors/RuleError39.php +++ b/src/Rules/RuleErrors/RuleError39.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError39 implements RuleError, LineRuleError, FileRuleError, MetadataRuleError +final class RuleError39 implements RuleError, LineRuleError, FileRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError41.php b/src/Rules/RuleErrors/RuleError41.php index 528a20c731..7cc55fdeb1 100644 --- a/src/Rules/RuleErrors/RuleError41.php +++ b/src/Rules/RuleErrors/RuleError41.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError41 implements RuleError, TipRuleError, MetadataRuleError +final class RuleError41 implements RuleError, TipRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError43.php b/src/Rules/RuleErrors/RuleError43.php index 9992c86c9d..a251840dd9 100644 --- a/src/Rules/RuleErrors/RuleError43.php +++ b/src/Rules/RuleErrors/RuleError43.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError43 implements RuleError, LineRuleError, TipRuleError, MetadataRuleError +final class RuleError43 implements RuleError, LineRuleError, TipRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError45.php b/src/Rules/RuleErrors/RuleError45.php index d77f882c50..aceabd9f78 100644 --- a/src/Rules/RuleErrors/RuleError45.php +++ b/src/Rules/RuleErrors/RuleError45.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError45 implements RuleError, FileRuleError, TipRuleError, MetadataRuleError +final class RuleError45 implements RuleError, FileRuleError, TipRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError47.php b/src/Rules/RuleErrors/RuleError47.php index 3a1158c176..866bbc3ddf 100644 --- a/src/Rules/RuleErrors/RuleError47.php +++ b/src/Rules/RuleErrors/RuleError47.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError47 implements RuleError, LineRuleError, FileRuleError, TipRuleError, MetadataRuleError +final class RuleError47 implements RuleError, LineRuleError, FileRuleError, TipRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError49.php b/src/Rules/RuleErrors/RuleError49.php index 6b8aa73a5b..81b0015029 100644 --- a/src/Rules/RuleErrors/RuleError49.php +++ b/src/Rules/RuleErrors/RuleError49.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError49 implements RuleError, IdentifierRuleError, MetadataRuleError +final class RuleError49 implements RuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError5.php b/src/Rules/RuleErrors/RuleError5.php index f8205fd24f..0dbad8299b 100644 --- a/src/Rules/RuleErrors/RuleError5.php +++ b/src/Rules/RuleErrors/RuleError5.php @@ -8,7 +8,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError5 implements RuleError, FileRuleError +final class RuleError5 implements RuleError, FileRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError51.php b/src/Rules/RuleErrors/RuleError51.php index a008143cd2..96d93510c9 100644 --- a/src/Rules/RuleErrors/RuleError51.php +++ b/src/Rules/RuleErrors/RuleError51.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError51 implements RuleError, LineRuleError, IdentifierRuleError, MetadataRuleError +final class RuleError51 implements RuleError, LineRuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError53.php b/src/Rules/RuleErrors/RuleError53.php index cd8418f5b2..1e11f5e641 100644 --- a/src/Rules/RuleErrors/RuleError53.php +++ b/src/Rules/RuleErrors/RuleError53.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError53 implements RuleError, FileRuleError, IdentifierRuleError, MetadataRuleError +final class RuleError53 implements RuleError, FileRuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError55.php b/src/Rules/RuleErrors/RuleError55.php index 4eb281839d..3bf4a22ccf 100644 --- a/src/Rules/RuleErrors/RuleError55.php +++ b/src/Rules/RuleErrors/RuleError55.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError55 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError, MetadataRuleError +final class RuleError55 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError57.php b/src/Rules/RuleErrors/RuleError57.php index 4fabd64eac..22c77fc545 100644 --- a/src/Rules/RuleErrors/RuleError57.php +++ b/src/Rules/RuleErrors/RuleError57.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError57 implements RuleError, TipRuleError, IdentifierRuleError, MetadataRuleError +final class RuleError57 implements RuleError, TipRuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError59.php b/src/Rules/RuleErrors/RuleError59.php index 837c62602d..a7659febe1 100644 --- a/src/Rules/RuleErrors/RuleError59.php +++ b/src/Rules/RuleErrors/RuleError59.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError59 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError +final class RuleError59 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError61.php b/src/Rules/RuleErrors/RuleError61.php index a861ab2f51..723a0aa79b 100644 --- a/src/Rules/RuleErrors/RuleError61.php +++ b/src/Rules/RuleErrors/RuleError61.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError61 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError +final class RuleError61 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError63.php b/src/Rules/RuleErrors/RuleError63.php index 919587a216..1c88f9fbc2 100644 --- a/src/Rules/RuleErrors/RuleError63.php +++ b/src/Rules/RuleErrors/RuleError63.php @@ -12,7 +12,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError63 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError +final class RuleError63 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError, MetadataRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError65.php b/src/Rules/RuleErrors/RuleError65.php index 095f49475d..fc2593bbfa 100644 --- a/src/Rules/RuleErrors/RuleError65.php +++ b/src/Rules/RuleErrors/RuleError65.php @@ -8,7 +8,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError65 implements RuleError, NonIgnorableRuleError +final class RuleError65 implements RuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError67.php b/src/Rules/RuleErrors/RuleError67.php index 08a214f997..b2218268c3 100644 --- a/src/Rules/RuleErrors/RuleError67.php +++ b/src/Rules/RuleErrors/RuleError67.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError67 implements RuleError, LineRuleError, NonIgnorableRuleError +final class RuleError67 implements RuleError, LineRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError69.php b/src/Rules/RuleErrors/RuleError69.php index 75cd512c3e..7f5e130f09 100644 --- a/src/Rules/RuleErrors/RuleError69.php +++ b/src/Rules/RuleErrors/RuleError69.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError69 implements RuleError, FileRuleError, NonIgnorableRuleError +final class RuleError69 implements RuleError, FileRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError7.php b/src/Rules/RuleErrors/RuleError7.php index af9559cfaa..203696b2fd 100644 --- a/src/Rules/RuleErrors/RuleError7.php +++ b/src/Rules/RuleErrors/RuleError7.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError7 implements RuleError, LineRuleError, FileRuleError +final class RuleError7 implements RuleError, LineRuleError, FileRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError71.php b/src/Rules/RuleErrors/RuleError71.php index 652b0f1922..d78d2813e3 100644 --- a/src/Rules/RuleErrors/RuleError71.php +++ b/src/Rules/RuleErrors/RuleError71.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError71 implements RuleError, LineRuleError, FileRuleError, NonIgnorableRuleError +final class RuleError71 implements RuleError, LineRuleError, FileRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError73.php b/src/Rules/RuleErrors/RuleError73.php index 8cdaeaa36d..fd81121a2d 100644 --- a/src/Rules/RuleErrors/RuleError73.php +++ b/src/Rules/RuleErrors/RuleError73.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError73 implements RuleError, TipRuleError, NonIgnorableRuleError +final class RuleError73 implements RuleError, TipRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError75.php b/src/Rules/RuleErrors/RuleError75.php index 3195db7454..d249eef75e 100644 --- a/src/Rules/RuleErrors/RuleError75.php +++ b/src/Rules/RuleErrors/RuleError75.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError75 implements RuleError, LineRuleError, TipRuleError, NonIgnorableRuleError +final class RuleError75 implements RuleError, LineRuleError, TipRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError77.php b/src/Rules/RuleErrors/RuleError77.php index 09edd26a3d..e0e8547a32 100644 --- a/src/Rules/RuleErrors/RuleError77.php +++ b/src/Rules/RuleErrors/RuleError77.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError77 implements RuleError, FileRuleError, TipRuleError, NonIgnorableRuleError +final class RuleError77 implements RuleError, FileRuleError, TipRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError79.php b/src/Rules/RuleErrors/RuleError79.php index 3c1fcf4d23..3a07eea396 100644 --- a/src/Rules/RuleErrors/RuleError79.php +++ b/src/Rules/RuleErrors/RuleError79.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError79 implements RuleError, LineRuleError, FileRuleError, TipRuleError, NonIgnorableRuleError +final class RuleError79 implements RuleError, LineRuleError, FileRuleError, TipRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError81.php b/src/Rules/RuleErrors/RuleError81.php index 1412335a8a..fe96c09839 100644 --- a/src/Rules/RuleErrors/RuleError81.php +++ b/src/Rules/RuleErrors/RuleError81.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError81 implements RuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError81 implements RuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError83.php b/src/Rules/RuleErrors/RuleError83.php index ceb2141456..9570715ebe 100644 --- a/src/Rules/RuleErrors/RuleError83.php +++ b/src/Rules/RuleErrors/RuleError83.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError83 implements RuleError, LineRuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError83 implements RuleError, LineRuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError85.php b/src/Rules/RuleErrors/RuleError85.php index a0d13d45de..5af535902a 100644 --- a/src/Rules/RuleErrors/RuleError85.php +++ b/src/Rules/RuleErrors/RuleError85.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError85 implements RuleError, FileRuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError85 implements RuleError, FileRuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError87.php b/src/Rules/RuleErrors/RuleError87.php index 386b844a1b..44028fe427 100644 --- a/src/Rules/RuleErrors/RuleError87.php +++ b/src/Rules/RuleErrors/RuleError87.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError87 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError87 implements RuleError, LineRuleError, FileRuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError89.php b/src/Rules/RuleErrors/RuleError89.php index 3b207cf2ad..e69b4058a6 100644 --- a/src/Rules/RuleErrors/RuleError89.php +++ b/src/Rules/RuleErrors/RuleError89.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError89 implements RuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError89 implements RuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError9.php b/src/Rules/RuleErrors/RuleError9.php index e93934d20b..c8454faf62 100644 --- a/src/Rules/RuleErrors/RuleError9.php +++ b/src/Rules/RuleErrors/RuleError9.php @@ -8,7 +8,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError9 implements RuleError, TipRuleError +final class RuleError9 implements RuleError, TipRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError91.php b/src/Rules/RuleErrors/RuleError91.php index a0fc78df5a..8c11c1816f 100644 --- a/src/Rules/RuleErrors/RuleError91.php +++ b/src/Rules/RuleErrors/RuleError91.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError91 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError91 implements RuleError, LineRuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError93.php b/src/Rules/RuleErrors/RuleError93.php index 88b7282eb2..8c5b9c5a64 100644 --- a/src/Rules/RuleErrors/RuleError93.php +++ b/src/Rules/RuleErrors/RuleError93.php @@ -11,7 +11,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError93 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError93 implements RuleError, FileRuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError95.php b/src/Rules/RuleErrors/RuleError95.php index 0fbb2a635b..68b993db00 100644 --- a/src/Rules/RuleErrors/RuleError95.php +++ b/src/Rules/RuleErrors/RuleError95.php @@ -12,7 +12,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError95 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError +final class RuleError95 implements RuleError, LineRuleError, FileRuleError, TipRuleError, IdentifierRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError97.php b/src/Rules/RuleErrors/RuleError97.php index da07902233..da13e04d88 100644 --- a/src/Rules/RuleErrors/RuleError97.php +++ b/src/Rules/RuleErrors/RuleError97.php @@ -9,7 +9,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError97 implements RuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError97 implements RuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleErrors/RuleError99.php b/src/Rules/RuleErrors/RuleError99.php index b26457a1e1..60c3af565f 100644 --- a/src/Rules/RuleErrors/RuleError99.php +++ b/src/Rules/RuleErrors/RuleError99.php @@ -10,7 +10,7 @@ /** * @internal Use PHPStan\Rules\RuleErrorBuilder instead. */ -class RuleError99 implements RuleError, LineRuleError, MetadataRuleError, NonIgnorableRuleError +final class RuleError99 implements RuleError, LineRuleError, MetadataRuleError, NonIgnorableRuleError { public string $message; diff --git a/src/Rules/RuleLevelHelper.php b/src/Rules/RuleLevelHelper.php index c5a08ba5ab..80ef4bccdc 100644 --- a/src/Rules/RuleLevelHelper.php +++ b/src/Rules/RuleLevelHelper.php @@ -28,7 +28,7 @@ use function sprintf; use function str_contains; -class RuleLevelHelper +final class RuleLevelHelper { public function __construct( diff --git a/src/Rules/RuleLevelHelperAcceptsResult.php b/src/Rules/RuleLevelHelperAcceptsResult.php index 201408f8f5..e33db8f0da 100644 --- a/src/Rules/RuleLevelHelperAcceptsResult.php +++ b/src/Rules/RuleLevelHelperAcceptsResult.php @@ -4,7 +4,7 @@ use function array_merge; -class RuleLevelHelperAcceptsResult +final class RuleLevelHelperAcceptsResult { /** diff --git a/src/Rules/TooWideTypehints/TooWideArrowFunctionReturnTypehintRule.php b/src/Rules/TooWideTypehints/TooWideArrowFunctionReturnTypehintRule.php index 2b5c809341..74c5328ba4 100644 --- a/src/Rules/TooWideTypehints/TooWideArrowFunctionReturnTypehintRule.php +++ b/src/Rules/TooWideTypehints/TooWideArrowFunctionReturnTypehintRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class TooWideArrowFunctionReturnTypehintRule implements Rule +final class TooWideArrowFunctionReturnTypehintRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/TooWideTypehints/TooWideClosureReturnTypehintRule.php b/src/Rules/TooWideTypehints/TooWideClosureReturnTypehintRule.php index 77879f99a3..bf49b02765 100644 --- a/src/Rules/TooWideTypehints/TooWideClosureReturnTypehintRule.php +++ b/src/Rules/TooWideTypehints/TooWideClosureReturnTypehintRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -class TooWideClosureReturnTypehintRule implements Rule +final class TooWideClosureReturnTypehintRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/TooWideTypehints/TooWideFunctionParameterOutTypeRule.php b/src/Rules/TooWideTypehints/TooWideFunctionParameterOutTypeRule.php index 8056f39420..6c62fea688 100644 --- a/src/Rules/TooWideTypehints/TooWideFunctionParameterOutTypeRule.php +++ b/src/Rules/TooWideTypehints/TooWideFunctionParameterOutTypeRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class TooWideFunctionParameterOutTypeRule implements Rule +final class TooWideFunctionParameterOutTypeRule implements Rule { public function __construct( diff --git a/src/Rules/TooWideTypehints/TooWideFunctionReturnTypehintRule.php b/src/Rules/TooWideTypehints/TooWideFunctionReturnTypehintRule.php index 9451787f4d..4f4aedec6d 100644 --- a/src/Rules/TooWideTypehints/TooWideFunctionReturnTypehintRule.php +++ b/src/Rules/TooWideTypehints/TooWideFunctionReturnTypehintRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class TooWideFunctionReturnTypehintRule implements Rule +final class TooWideFunctionReturnTypehintRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/TooWideTypehints/TooWideMethodParameterOutTypeRule.php b/src/Rules/TooWideTypehints/TooWideMethodParameterOutTypeRule.php index e715ce7d91..b404ff3464 100644 --- a/src/Rules/TooWideTypehints/TooWideMethodParameterOutTypeRule.php +++ b/src/Rules/TooWideTypehints/TooWideMethodParameterOutTypeRule.php @@ -12,7 +12,7 @@ /** * @implements Rule */ -class TooWideMethodParameterOutTypeRule implements Rule +final class TooWideMethodParameterOutTypeRule implements Rule { public function __construct( diff --git a/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php b/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php index 5e62501f72..0c74e65a02 100644 --- a/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php +++ b/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class TooWideMethodReturnTypehintRule implements Rule +final class TooWideMethodReturnTypehintRule implements Rule { public function __construct(private bool $checkProtectedAndPublicMethods, private bool $alwaysCheckFinal) diff --git a/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php b/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php index 097812f918..ceeb071238 100644 --- a/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php +++ b/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php @@ -14,7 +14,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; -class TooWideParameterOutTypeCheck +final class TooWideParameterOutTypeCheck { /** diff --git a/src/Rules/Traits/ConflictingTraitConstantsRule.php b/src/Rules/Traits/ConflictingTraitConstantsRule.php index 73612f3074..4dd23f32bd 100644 --- a/src/Rules/Traits/ConflictingTraitConstantsRule.php +++ b/src/Rules/Traits/ConflictingTraitConstantsRule.php @@ -19,7 +19,7 @@ /** * @implements Rule */ -class ConflictingTraitConstantsRule implements Rule +final class ConflictingTraitConstantsRule implements Rule { public function __construct(private InitializerExprTypeResolver $initializerExprTypeResolver) diff --git a/src/Rules/Traits/ConstantsInTraitsRule.php b/src/Rules/Traits/ConstantsInTraitsRule.php index 6948568540..177af08c6e 100644 --- a/src/Rules/Traits/ConstantsInTraitsRule.php +++ b/src/Rules/Traits/ConstantsInTraitsRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class ConstantsInTraitsRule implements Rule +final class ConstantsInTraitsRule implements Rule { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Rules/Traits/NotAnalysedTraitRule.php b/src/Rules/Traits/NotAnalysedTraitRule.php index 3ae9b74c46..6abc321550 100644 --- a/src/Rules/Traits/NotAnalysedTraitRule.php +++ b/src/Rules/Traits/NotAnalysedTraitRule.php @@ -13,7 +13,7 @@ /** * @implements Rule */ -class NotAnalysedTraitRule implements Rule +final class NotAnalysedTraitRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Traits/TraitDeclarationCollector.php b/src/Rules/Traits/TraitDeclarationCollector.php index 7ce2cee84d..5ccb33a736 100644 --- a/src/Rules/Traits/TraitDeclarationCollector.php +++ b/src/Rules/Traits/TraitDeclarationCollector.php @@ -9,7 +9,7 @@ /** * @implements Collector */ -class TraitDeclarationCollector implements Collector +final class TraitDeclarationCollector implements Collector { public function getNodeType(): string diff --git a/src/Rules/Traits/TraitUseCollector.php b/src/Rules/Traits/TraitUseCollector.php index 1bd3f82cba..cd97f3b9b4 100644 --- a/src/Rules/Traits/TraitUseCollector.php +++ b/src/Rules/Traits/TraitUseCollector.php @@ -11,7 +11,7 @@ /** * @implements Collector> */ -class TraitUseCollector implements Collector +final class TraitUseCollector implements Collector { public function getNodeType(): string @@ -19,7 +19,10 @@ public function getNodeType(): string return Node\Stmt\TraitUse::class; } - public function processNode(Node $node, Scope $scope) + /** + * @return list + */ + public function processNode(Node $node, Scope $scope): array { return array_values(array_map(static fn (Node\Name $traitName) => $traitName->toString(), $node->traits)); } diff --git a/src/Rules/Types/InvalidTypesInUnionRule.php b/src/Rules/Types/InvalidTypesInUnionRule.php index 88442c2bde..ba53111760 100644 --- a/src/Rules/Types/InvalidTypesInUnionRule.php +++ b/src/Rules/Types/InvalidTypesInUnionRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class InvalidTypesInUnionRule implements Rule +final class InvalidTypesInUnionRule implements Rule { private const ONLY_STANDALONE_TYPES = [ diff --git a/src/Rules/UnusedFunctionParametersCheck.php b/src/Rules/UnusedFunctionParametersCheck.php index 8da2427d31..b85150e267 100644 --- a/src/Rules/UnusedFunctionParametersCheck.php +++ b/src/Rules/UnusedFunctionParametersCheck.php @@ -13,7 +13,7 @@ use function is_string; use function sprintf; -class UnusedFunctionParametersCheck +final class UnusedFunctionParametersCheck { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Rules/Variables/DefinedVariableRule.php b/src/Rules/Variables/DefinedVariableRule.php index fbe15dcfbc..fc665ed901 100644 --- a/src/Rules/Variables/DefinedVariableRule.php +++ b/src/Rules/Variables/DefinedVariableRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class DefinedVariableRule implements Rule +final class DefinedVariableRule implements Rule { public function __construct( diff --git a/src/Rules/Variables/EmptyRule.php b/src/Rules/Variables/EmptyRule.php index ca588bd711..12d3fadf59 100644 --- a/src/Rules/Variables/EmptyRule.php +++ b/src/Rules/Variables/EmptyRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class EmptyRule implements Rule +final class EmptyRule implements Rule { public function __construct(private IssetCheck $issetCheck) diff --git a/src/Rules/Variables/IssetRule.php b/src/Rules/Variables/IssetRule.php index f5c59363ff..69ed263479 100644 --- a/src/Rules/Variables/IssetRule.php +++ b/src/Rules/Variables/IssetRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class IssetRule implements Rule +final class IssetRule implements Rule { public function __construct(private IssetCheck $issetCheck) diff --git a/src/Rules/Variables/NullCoalesceRule.php b/src/Rules/Variables/NullCoalesceRule.php index ef289640e3..563bec59f7 100644 --- a/src/Rules/Variables/NullCoalesceRule.php +++ b/src/Rules/Variables/NullCoalesceRule.php @@ -11,7 +11,7 @@ /** * @implements Rule */ -class NullCoalesceRule implements Rule +final class NullCoalesceRule implements Rule { public function __construct(private IssetCheck $issetCheck) diff --git a/src/Rules/Variables/ParameterOutAssignedTypeRule.php b/src/Rules/Variables/ParameterOutAssignedTypeRule.php index 9c24597525..0d4487d217 100644 --- a/src/Rules/Variables/ParameterOutAssignedTypeRule.php +++ b/src/Rules/Variables/ParameterOutAssignedTypeRule.php @@ -20,7 +20,7 @@ /** * @implements Rule */ -class ParameterOutAssignedTypeRule implements Rule +final class ParameterOutAssignedTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Variables/ParameterOutExecutionEndTypeRule.php b/src/Rules/Variables/ParameterOutExecutionEndTypeRule.php index 648781ccc5..177079ac6c 100644 --- a/src/Rules/Variables/ParameterOutExecutionEndTypeRule.php +++ b/src/Rules/Variables/ParameterOutExecutionEndTypeRule.php @@ -24,7 +24,7 @@ /** * @implements Rule */ -class ParameterOutExecutionEndTypeRule implements Rule +final class ParameterOutExecutionEndTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Variables/ThrowTypeRule.php b/src/Rules/Variables/ThrowTypeRule.php index 7678406a9e..03a80e73bf 100644 --- a/src/Rules/Variables/ThrowTypeRule.php +++ b/src/Rules/Variables/ThrowTypeRule.php @@ -17,7 +17,7 @@ /** * @implements Rule */ -class ThrowTypeRule implements Rule +final class ThrowTypeRule implements Rule { public function __construct( diff --git a/src/Rules/Variables/UnsetRule.php b/src/Rules/Variables/UnsetRule.php index 43efa6646c..dc75eb024e 100644 --- a/src/Rules/Variables/UnsetRule.php +++ b/src/Rules/Variables/UnsetRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -class UnsetRule implements Rule +final class UnsetRule implements Rule { public function getNodeType(): string diff --git a/src/Rules/Variables/VariableCloningRule.php b/src/Rules/Variables/VariableCloningRule.php index 89aca44aa9..da72e99ebe 100644 --- a/src/Rules/Variables/VariableCloningRule.php +++ b/src/Rules/Variables/VariableCloningRule.php @@ -18,7 +18,7 @@ /** * @implements Rule */ -class VariableCloningRule implements Rule +final class VariableCloningRule implements Rule { public function __construct(private RuleLevelHelper $ruleLevelHelper) diff --git a/src/Rules/Whitespace/FileWhitespaceRule.php b/src/Rules/Whitespace/FileWhitespaceRule.php index 7f3bcbdcfe..d234baa6b1 100644 --- a/src/Rules/Whitespace/FileWhitespaceRule.php +++ b/src/Rules/Whitespace/FileWhitespaceRule.php @@ -15,7 +15,7 @@ /** * @implements Rule */ -class FileWhitespaceRule implements Rule +final class FileWhitespaceRule implements Rule { public function getNodeType(): string diff --git a/src/Testing/TestCaseSourceLocatorFactory.php b/src/Testing/TestCaseSourceLocatorFactory.php index fccedd9ec1..a4921c9201 100644 --- a/src/Testing/TestCaseSourceLocatorFactory.php +++ b/src/Testing/TestCaseSourceLocatorFactory.php @@ -23,7 +23,7 @@ use function serialize; use function sha1; -class TestCaseSourceLocatorFactory +final class TestCaseSourceLocatorFactory { /** @var array> */ diff --git a/src/TrinaryLogic.php b/src/TrinaryLogic.php index df4e9f5218..7e387901e0 100644 --- a/src/TrinaryLogic.php +++ b/src/TrinaryLogic.php @@ -10,6 +10,7 @@ /** * @api + * @final * @see https://phpstan.org/developing-extensions/trinary-logic */ class TrinaryLogic diff --git a/src/Type/AcceptsResult.php b/src/Type/AcceptsResult.php index e6e5df0f9b..4cfecb05f6 100644 --- a/src/Type/AcceptsResult.php +++ b/src/Type/AcceptsResult.php @@ -9,7 +9,10 @@ use function array_unique; use function array_values; -/** @api */ +/** + * @api + * @final + */ class AcceptsResult { diff --git a/src/Type/CallableTypeHelper.php b/src/Type/CallableTypeHelper.php index eb58de74bb..29f416d3aa 100644 --- a/src/Type/CallableTypeHelper.php +++ b/src/Type/CallableTypeHelper.php @@ -9,7 +9,7 @@ use function count; use function sprintf; -class CallableTypeHelper +final class CallableTypeHelper { public static function isParametersAcceptorSuperTypeOf( diff --git a/src/Type/CircularTypeAliasDefinitionException.php b/src/Type/CircularTypeAliasDefinitionException.php index ad4bbfa25e..d0502cb9a1 100644 --- a/src/Type/CircularTypeAliasDefinitionException.php +++ b/src/Type/CircularTypeAliasDefinitionException.php @@ -4,7 +4,7 @@ use Exception; -class CircularTypeAliasDefinitionException extends Exception +final class CircularTypeAliasDefinitionException extends Exception { } diff --git a/src/Type/ClosureTypeFactory.php b/src/Type/ClosureTypeFactory.php index 07a395a5fe..a0e82946ff 100644 --- a/src/Type/ClosureTypeFactory.php +++ b/src/Type/ClosureTypeFactory.php @@ -23,7 +23,10 @@ use function count; use function str_replace; -/** @api */ +/** + * @api + * @final + */ class ClosureTypeFactory { diff --git a/src/Type/Constant/ConstantArrayTypeAndMethod.php b/src/Type/Constant/ConstantArrayTypeAndMethod.php index e5bd1caf7b..01e735d949 100644 --- a/src/Type/Constant/ConstantArrayTypeAndMethod.php +++ b/src/Type/Constant/ConstantArrayTypeAndMethod.php @@ -6,7 +6,10 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\Type; -/** @api */ +/** + * @api + * @final + */ class ConstantArrayTypeAndMethod { diff --git a/src/Type/Constant/ConstantArrayTypeBuilder.php b/src/Type/Constant/ConstantArrayTypeBuilder.php index 8547fa39a9..525b65caed 100644 --- a/src/Type/Constant/ConstantArrayTypeBuilder.php +++ b/src/Type/Constant/ConstantArrayTypeBuilder.php @@ -22,7 +22,10 @@ use function min; use function range; -/** @api */ +/** + * @api + * @final + */ class ConstantArrayTypeBuilder { diff --git a/src/Type/Constant/OversizedArrayBuilder.php b/src/Type/Constant/OversizedArrayBuilder.php index 663f1c1513..02e1115e1d 100644 --- a/src/Type/Constant/OversizedArrayBuilder.php +++ b/src/Type/Constant/OversizedArrayBuilder.php @@ -18,7 +18,7 @@ use function array_values; use function count; -class OversizedArrayBuilder +final class OversizedArrayBuilder { /** diff --git a/src/Type/ConstantTypeHelper.php b/src/Type/ConstantTypeHelper.php index 2a1f4cd4f7..48cc18025b 100644 --- a/src/Type/ConstantTypeHelper.php +++ b/src/Type/ConstantTypeHelper.php @@ -20,7 +20,10 @@ use function is_object; use function is_string; -/** @api */ +/** + * @api + * @final + */ class ConstantTypeHelper { diff --git a/src/Type/DirectTypeAliasResolverProvider.php b/src/Type/DirectTypeAliasResolverProvider.php index b64fe8f46d..f7fa61c09e 100644 --- a/src/Type/DirectTypeAliasResolverProvider.php +++ b/src/Type/DirectTypeAliasResolverProvider.php @@ -2,7 +2,7 @@ namespace PHPStan\Type; -class DirectTypeAliasResolverProvider implements TypeAliasResolverProvider +final class DirectTypeAliasResolverProvider implements TypeAliasResolverProvider { public function __construct(private TypeAliasResolver $typeAliasResolver) diff --git a/src/Type/DynamicReturnTypeExtensionRegistry.php b/src/Type/DynamicReturnTypeExtensionRegistry.php index ea3c27a13c..002a87f66e 100644 --- a/src/Type/DynamicReturnTypeExtensionRegistry.php +++ b/src/Type/DynamicReturnTypeExtensionRegistry.php @@ -8,7 +8,7 @@ use function array_merge; use function strtolower; -class DynamicReturnTypeExtensionRegistry +final class DynamicReturnTypeExtensionRegistry { /** @var DynamicMethodReturnTypeExtension[][]|null */ diff --git a/src/Type/ExpressionTypeResolverExtensionRegistry.php b/src/Type/ExpressionTypeResolverExtensionRegistry.php index 75c0d0b5ec..1d9dc436c0 100644 --- a/src/Type/ExpressionTypeResolverExtensionRegistry.php +++ b/src/Type/ExpressionTypeResolverExtensionRegistry.php @@ -2,7 +2,7 @@ namespace PHPStan\Type; -class ExpressionTypeResolverExtensionRegistry +final class ExpressionTypeResolverExtensionRegistry { /** diff --git a/src/Type/FileTypeMapper.php b/src/Type/FileTypeMapper.php index 307be3446f..2ba6b7ae90 100644 --- a/src/Type/FileTypeMapper.php +++ b/src/Type/FileTypeMapper.php @@ -38,7 +38,7 @@ use function str_contains; use function strtolower; -class FileTypeMapper +final class FileTypeMapper { private const SKIP_NODE = 1; diff --git a/src/Type/GeneralizePrecision.php b/src/Type/GeneralizePrecision.php index 0cce10ed32..d69e030e2d 100644 --- a/src/Type/GeneralizePrecision.php +++ b/src/Type/GeneralizePrecision.php @@ -2,7 +2,7 @@ namespace PHPStan\Type; -class GeneralizePrecision +final class GeneralizePrecision { private const LESS_SPECIFIC = 1; diff --git a/src/Type/Generic/TemplateTypeArgumentStrategy.php b/src/Type/Generic/TemplateTypeArgumentStrategy.php index 414ffc12aa..deeb9b6ddd 100644 --- a/src/Type/Generic/TemplateTypeArgumentStrategy.php +++ b/src/Type/Generic/TemplateTypeArgumentStrategy.php @@ -12,7 +12,7 @@ /** * Template type strategy suitable for return type acceptance contexts */ -class TemplateTypeArgumentStrategy implements TemplateTypeStrategy +final class TemplateTypeArgumentStrategy implements TemplateTypeStrategy { public function accepts(TemplateType $left, Type $right, bool $strictTypes): AcceptsResult diff --git a/src/Type/Generic/TemplateTypeHelper.php b/src/Type/Generic/TemplateTypeHelper.php index 166464a884..a38d656556 100644 --- a/src/Type/Generic/TemplateTypeHelper.php +++ b/src/Type/Generic/TemplateTypeHelper.php @@ -10,7 +10,7 @@ use PHPStan\Type\TypeTraverser; use PHPStan\Type\VerbosityLevel; -class TemplateTypeHelper +final class TemplateTypeHelper { /** diff --git a/src/Type/Generic/TemplateTypeMap.php b/src/Type/Generic/TemplateTypeMap.php index f807e3d65e..00fbc34a1d 100644 --- a/src/Type/Generic/TemplateTypeMap.php +++ b/src/Type/Generic/TemplateTypeMap.php @@ -9,7 +9,10 @@ use function array_key_exists; use function count; -/** @api */ +/** + * @api + * @final + */ class TemplateTypeMap { diff --git a/src/Type/Generic/TemplateTypeParameterStrategy.php b/src/Type/Generic/TemplateTypeParameterStrategy.php index 5ad7793665..1ec43f153a 100644 --- a/src/Type/Generic/TemplateTypeParameterStrategy.php +++ b/src/Type/Generic/TemplateTypeParameterStrategy.php @@ -9,7 +9,7 @@ /** * Template type strategy suitable for parameter type acceptance contexts */ -class TemplateTypeParameterStrategy implements TemplateTypeStrategy +final class TemplateTypeParameterStrategy implements TemplateTypeStrategy { public function accepts(TemplateType $left, Type $right, bool $strictTypes): AcceptsResult diff --git a/src/Type/Generic/TemplateTypeReference.php b/src/Type/Generic/TemplateTypeReference.php index 260abd3d93..0be67d5e08 100644 --- a/src/Type/Generic/TemplateTypeReference.php +++ b/src/Type/Generic/TemplateTypeReference.php @@ -2,7 +2,7 @@ namespace PHPStan\Type\Generic; -class TemplateTypeReference +final class TemplateTypeReference { public function __construct(private TemplateType $type, private TemplateTypeVariance $positionVariance) diff --git a/src/Type/Generic/TemplateTypeScope.php b/src/Type/Generic/TemplateTypeScope.php index e40eab90d3..8cc0e54e5e 100644 --- a/src/Type/Generic/TemplateTypeScope.php +++ b/src/Type/Generic/TemplateTypeScope.php @@ -4,7 +4,7 @@ use function sprintf; -class TemplateTypeScope +final class TemplateTypeScope { public static function createWithAnonymousFunction(): self diff --git a/src/Type/Generic/TemplateTypeVariance.php b/src/Type/Generic/TemplateTypeVariance.php index a3ab7a04bd..786c61302c 100644 --- a/src/Type/Generic/TemplateTypeVariance.php +++ b/src/Type/Generic/TemplateTypeVariance.php @@ -12,7 +12,10 @@ use PHPStan\Type\Type; use function sprintf; -/** @api */ +/** + * @api + * @final + */ class TemplateTypeVariance { diff --git a/src/Type/Generic/TemplateTypeVarianceMap.php b/src/Type/Generic/TemplateTypeVarianceMap.php index 55d3a18aa3..bcbb23ea42 100644 --- a/src/Type/Generic/TemplateTypeVarianceMap.php +++ b/src/Type/Generic/TemplateTypeVarianceMap.php @@ -4,7 +4,10 @@ use function array_key_exists; -/** @api */ +/** + * @api + * @final + */ class TemplateTypeVarianceMap { diff --git a/src/Type/Generic/TypeProjectionHelper.php b/src/Type/Generic/TypeProjectionHelper.php index 217103bd09..c311cde2f8 100644 --- a/src/Type/Generic/TypeProjectionHelper.php +++ b/src/Type/Generic/TypeProjectionHelper.php @@ -6,7 +6,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; -class TypeProjectionHelper +final class TypeProjectionHelper { public static function describe( diff --git a/src/Type/GenericTypeVariableResolver.php b/src/Type/GenericTypeVariableResolver.php index 4f13c5eec9..8c3f7d2da5 100644 --- a/src/Type/GenericTypeVariableResolver.php +++ b/src/Type/GenericTypeVariableResolver.php @@ -4,7 +4,10 @@ use PHPStan\Type\Generic\TemplateTypeHelper; -/** @api */ +/** + * @api + * @final + */ class GenericTypeVariableResolver { diff --git a/src/Type/LazyTypeAliasResolverProvider.php b/src/Type/LazyTypeAliasResolverProvider.php index d270e691f2..0b0edeee19 100644 --- a/src/Type/LazyTypeAliasResolverProvider.php +++ b/src/Type/LazyTypeAliasResolverProvider.php @@ -4,7 +4,7 @@ use PHPStan\DependencyInjection\Container; -class LazyTypeAliasResolverProvider implements TypeAliasResolverProvider +final class LazyTypeAliasResolverProvider implements TypeAliasResolverProvider { public function __construct(private Container $container) diff --git a/src/Type/ObjectShapePropertyReflection.php b/src/Type/ObjectShapePropertyReflection.php index a79f924417..e7132ecfb3 100644 --- a/src/Type/ObjectShapePropertyReflection.php +++ b/src/Type/ObjectShapePropertyReflection.php @@ -8,7 +8,7 @@ use PHPStan\TrinaryLogic; use stdClass; -class ObjectShapePropertyReflection implements PropertyReflection +final class ObjectShapePropertyReflection implements PropertyReflection { public function __construct(private Type $type) diff --git a/src/Type/OperatorTypeSpecifyingExtensionRegistry.php b/src/Type/OperatorTypeSpecifyingExtensionRegistry.php index 654d7a1ea8..809ba5bd20 100644 --- a/src/Type/OperatorTypeSpecifyingExtensionRegistry.php +++ b/src/Type/OperatorTypeSpecifyingExtensionRegistry.php @@ -7,7 +7,7 @@ use function array_filter; use function array_values; -class OperatorTypeSpecifyingExtensionRegistry +final class OperatorTypeSpecifyingExtensionRegistry { /** diff --git a/src/Type/ParserNodeTypeToPHPStanType.php b/src/Type/ParserNodeTypeToPHPStanType.php index 7299a08100..e616fffc0e 100644 --- a/src/Type/ParserNodeTypeToPHPStanType.php +++ b/src/Type/ParserNodeTypeToPHPStanType.php @@ -13,7 +13,7 @@ use function in_array; use function strtolower; -class ParserNodeTypeToPHPStanType +final class ParserNodeTypeToPHPStanType { /** diff --git a/src/Type/Php/ArgumentBasedFunctionReturnTypeExtension.php b/src/Type/Php/ArgumentBasedFunctionReturnTypeExtension.php index c4ab9e8b9c..b2508600f4 100644 --- a/src/Type/Php/ArgumentBasedFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArgumentBasedFunctionReturnTypeExtension.php @@ -13,7 +13,7 @@ use PHPStan\Type\TypeCombinator; use function array_key_exists; -class ArgumentBasedFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArgumentBasedFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { private const FUNCTION_NAMES = [ diff --git a/src/Type/Php/ArrayColumnFunctionReturnTypeExtension.php b/src/Type/Php/ArrayColumnFunctionReturnTypeExtension.php index a7edf8777c..7bca91ccd9 100644 --- a/src/Type/Php/ArrayColumnFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayColumnFunctionReturnTypeExtension.php @@ -21,7 +21,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class ArrayColumnFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayColumnFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php b/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php index 62e1d8435b..3ca26e156e 100644 --- a/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php @@ -22,7 +22,7 @@ use PHPStan\Type\UnionType; use function count; -class ArrayCombineFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayCombineFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/ArrayCurrentDynamicReturnTypeExtension.php b/src/Type/Php/ArrayCurrentDynamicReturnTypeExtension.php index 3ca47235f8..9871a469c9 100644 --- a/src/Type/Php/ArrayCurrentDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayCurrentDynamicReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ArrayCurrentDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayCurrentDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php b/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php index 2e85f59099..33ff1509e0 100644 --- a/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php @@ -20,7 +20,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class ArrayFillFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayFillFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { private const MAX_SIZE_USE_CONSTANT_ARRAY = 100; diff --git a/src/Type/Php/ArrayFillKeysFunctionReturnTypeExtension.php b/src/Type/Php/ArrayFillKeysFunctionReturnTypeExtension.php index 785991b2c1..b8c7fdfe97 100644 --- a/src/Type/Php/ArrayFillKeysFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayFillKeysFunctionReturnTypeExtension.php @@ -12,7 +12,7 @@ use PHPStan\Type\Type; use function count; -class ArrayFillKeysFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayFillKeysFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/ArrayFilterFunctionReturnTypeReturnTypeExtension.php b/src/Type/Php/ArrayFilterFunctionReturnTypeReturnTypeExtension.php index d697380439..d6f5a8251c 100644 --- a/src/Type/Php/ArrayFilterFunctionReturnTypeReturnTypeExtension.php +++ b/src/Type/Php/ArrayFilterFunctionReturnTypeReturnTypeExtension.php @@ -37,7 +37,7 @@ use function strtolower; use function substr; -class ArrayFilterFunctionReturnTypeReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayFilterFunctionReturnTypeReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayFlipFunctionReturnTypeExtension.php b/src/Type/Php/ArrayFlipFunctionReturnTypeExtension.php index 1beb76de40..0d6342e584 100644 --- a/src/Type/Php/ArrayFlipFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayFlipFunctionReturnTypeExtension.php @@ -12,7 +12,7 @@ use PHPStan\Type\Type; use function count; -class ArrayFlipFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayFlipFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/ArrayIntersectKeyFunctionReturnTypeExtension.php b/src/Type/Php/ArrayIntersectKeyFunctionReturnTypeExtension.php index 10335fa3e8..e7436d8275 100644 --- a/src/Type/Php/ArrayIntersectKeyFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayIntersectKeyFunctionReturnTypeExtension.php @@ -14,7 +14,7 @@ use function array_slice; use function count; -class ArrayIntersectKeyFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayIntersectKeyFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/ArrayKeyDynamicReturnTypeExtension.php b/src/Type/Php/ArrayKeyDynamicReturnTypeExtension.php index 16e343e12d..fe418f4daa 100644 --- a/src/Type/Php/ArrayKeyDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayKeyDynamicReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ArrayKeyDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayKeyDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php b/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php index d2d5ed8360..d255aa8c15 100644 --- a/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php @@ -23,7 +23,7 @@ use function count; use function in_array; -class ArrayKeyExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class ArrayKeyExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/ArrayKeyFirstDynamicReturnTypeExtension.php b/src/Type/Php/ArrayKeyFirstDynamicReturnTypeExtension.php index 06fcfb7c74..bd9fdd6f0a 100644 --- a/src/Type/Php/ArrayKeyFirstDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayKeyFirstDynamicReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ArrayKeyFirstDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayKeyFirstDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayKeyLastDynamicReturnTypeExtension.php b/src/Type/Php/ArrayKeyLastDynamicReturnTypeExtension.php index c1684afa9d..a13714293c 100644 --- a/src/Type/Php/ArrayKeyLastDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayKeyLastDynamicReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ArrayKeyLastDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayKeyLastDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php b/src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php index 2139222a9a..74a2903ea5 100644 --- a/src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php @@ -13,7 +13,7 @@ use function count; use function strtolower; -class ArrayKeysFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayKeysFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/ArrayMapFunctionReturnTypeExtension.php b/src/Type/Php/ArrayMapFunctionReturnTypeExtension.php index af0f49d231..24561b5598 100644 --- a/src/Type/Php/ArrayMapFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayMapFunctionReturnTypeExtension.php @@ -20,7 +20,7 @@ use function array_slice; use function count; -class ArrayMapFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayMapFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php b/src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php index 5bde2a454e..5b177a9f68 100644 --- a/src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php @@ -21,7 +21,7 @@ use function count; use function in_array; -class ArrayMergeFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayMergeFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayNextDynamicReturnTypeExtension.php b/src/Type/Php/ArrayNextDynamicReturnTypeExtension.php index dff732d028..0f33b7f532 100644 --- a/src/Type/Php/ArrayNextDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayNextDynamicReturnTypeExtension.php @@ -11,7 +11,7 @@ use PHPStan\Type\TypeCombinator; use function in_array; -class ArrayNextDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayNextDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayPointerFunctionsDynamicReturnTypeExtension.php b/src/Type/Php/ArrayPointerFunctionsDynamicReturnTypeExtension.php index cd12f678d1..4e49cd465f 100644 --- a/src/Type/Php/ArrayPointerFunctionsDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayPointerFunctionsDynamicReturnTypeExtension.php @@ -12,7 +12,7 @@ use function count; use function in_array; -class ArrayPointerFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayPointerFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { /** @var string[] */ diff --git a/src/Type/Php/ArrayPopFunctionReturnTypeExtension.php b/src/Type/Php/ArrayPopFunctionReturnTypeExtension.php index 64935edaea..540dda82bb 100644 --- a/src/Type/Php/ArrayPopFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayPopFunctionReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ArrayPopFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayPopFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayRandFunctionReturnTypeExtension.php b/src/Type/Php/ArrayRandFunctionReturnTypeExtension.php index 315acd8488..1d390b59d0 100644 --- a/src/Type/Php/ArrayRandFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayRandFunctionReturnTypeExtension.php @@ -16,7 +16,7 @@ use PHPStan\Type\UnionType; use function count; -class ArrayRandFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayRandFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayReduceFunctionReturnTypeExtension.php b/src/Type/Php/ArrayReduceFunctionReturnTypeExtension.php index 80bd5866ec..970e2cb39f 100644 --- a/src/Type/Php/ArrayReduceFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayReduceFunctionReturnTypeExtension.php @@ -13,7 +13,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class ArrayReduceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayReduceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayReplaceFunctionReturnTypeExtension.php b/src/Type/Php/ArrayReplaceFunctionReturnTypeExtension.php index 94584e3583..e68f0338f7 100644 --- a/src/Type/Php/ArrayReplaceFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayReplaceFunctionReturnTypeExtension.php @@ -13,7 +13,7 @@ use function count; use function strtolower; -class ArrayReplaceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayReplaceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayReverseFunctionReturnTypeExtension.php b/src/Type/Php/ArrayReverseFunctionReturnTypeExtension.php index ef16c66fbf..1a693eff8d 100644 --- a/src/Type/Php/ArrayReverseFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayReverseFunctionReturnTypeExtension.php @@ -11,7 +11,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class ArrayReverseFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayReverseFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php b/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php index 8571c82ed3..4b974bbe1d 100644 --- a/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php @@ -16,7 +16,7 @@ use PHPStan\Type\TypeCombinator; use function strtolower; -class ArraySearchFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class ArraySearchFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/ArrayShiftFunctionReturnTypeExtension.php b/src/Type/Php/ArrayShiftFunctionReturnTypeExtension.php index 47552e875e..cb6c35bbdd 100644 --- a/src/Type/Php/ArrayShiftFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArrayShiftFunctionReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ArrayShiftFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayShiftFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArraySliceFunctionReturnTypeExtension.php b/src/Type/Php/ArraySliceFunctionReturnTypeExtension.php index 811727ae39..156a8c1a46 100644 --- a/src/Type/Php/ArraySliceFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArraySliceFunctionReturnTypeExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class ArraySliceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArraySliceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArraySpliceFunctionReturnTypeExtension.php b/src/Type/Php/ArraySpliceFunctionReturnTypeExtension.php index 45cff582a2..bf4c3abc6b 100644 --- a/src/Type/Php/ArraySpliceFunctionReturnTypeExtension.php +++ b/src/Type/Php/ArraySpliceFunctionReturnTypeExtension.php @@ -9,7 +9,7 @@ use PHPStan\Type\DynamicFunctionReturnTypeExtension; use PHPStan\Type\Type; -class ArraySpliceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArraySpliceFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ArrayValuesFunctionDynamicReturnTypeExtension.php b/src/Type/Php/ArrayValuesFunctionDynamicReturnTypeExtension.php index 4573e7d89d..2378a291b3 100644 --- a/src/Type/Php/ArrayValuesFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/ArrayValuesFunctionDynamicReturnTypeExtension.php @@ -13,7 +13,7 @@ use function count; use function strtolower; -class ArrayValuesFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ArrayValuesFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php b/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php index 413a163535..d1458a27dd 100644 --- a/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php @@ -11,7 +11,7 @@ use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\FunctionTypeSpecifyingExtension; -class AssertFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class AssertFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/AssertThrowTypeExtension.php b/src/Type/Php/AssertThrowTypeExtension.php index 22bbbc2047..2cf4226047 100644 --- a/src/Type/Php/AssertThrowTypeExtension.php +++ b/src/Type/Php/AssertThrowTypeExtension.php @@ -11,7 +11,7 @@ use Throwable; use function count; -class AssertThrowTypeExtension implements DynamicFunctionThrowTypeExtension +final class AssertThrowTypeExtension implements DynamicFunctionThrowTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php b/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php index 8f4103018d..c80bb0950b 100644 --- a/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php +++ b/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php @@ -14,7 +14,7 @@ use function count; use function in_array; -class BackedEnumFromMethodDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension +final class BackedEnumFromMethodDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Type/Php/Base64DecodeDynamicFunctionReturnTypeExtension.php b/src/Type/Php/Base64DecodeDynamicFunctionReturnTypeExtension.php index bb1ef07430..6e38a43a25 100644 --- a/src/Type/Php/Base64DecodeDynamicFunctionReturnTypeExtension.php +++ b/src/Type/Php/Base64DecodeDynamicFunctionReturnTypeExtension.php @@ -13,7 +13,7 @@ use PHPStan\Type\Type; use PHPStan\Type\UnionType; -class Base64DecodeDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class Base64DecodeDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/BcMathStringOrNullReturnTypeExtension.php b/src/Type/Php/BcMathStringOrNullReturnTypeExtension.php index c10cbe2e58..2651cb6b90 100644 --- a/src/Type/Php/BcMathStringOrNullReturnTypeExtension.php +++ b/src/Type/Php/BcMathStringOrNullReturnTypeExtension.php @@ -21,7 +21,7 @@ use function in_array; use function is_numeric; -class BcMathStringOrNullReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class BcMathStringOrNullReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php b/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php index 9367e20b1b..8cf3d88c19 100644 --- a/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php @@ -21,7 +21,7 @@ use function in_array; use function ltrim; -class ClassExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class ClassExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/ClassImplementsFunctionReturnTypeExtension.php b/src/Type/Php/ClassImplementsFunctionReturnTypeExtension.php index 754ac737c8..17e293973b 100644 --- a/src/Type/Php/ClassImplementsFunctionReturnTypeExtension.php +++ b/src/Type/Php/ClassImplementsFunctionReturnTypeExtension.php @@ -18,7 +18,7 @@ use function count; use function in_array; -class ClassImplementsFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ClassImplementsFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php b/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php index 1d0e07a500..719fd172d3 100644 --- a/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php +++ b/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\DynamicStaticMethodReturnTypeExtension; use PHPStan\Type\Type; -class ClosureBindDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension +final class ClosureBindDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php b/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php index 73c34fa9ed..9e495b3163 100644 --- a/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php +++ b/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\DynamicMethodReturnTypeExtension; use PHPStan\Type\Type; -class ClosureBindToDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class ClosureBindToDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php b/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php index ed2bd20acd..45ff96e2c9 100644 --- a/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php +++ b/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class ClosureFromCallableDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension +final class ClosureFromCallableDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Type/Php/CompactFunctionReturnTypeExtension.php b/src/Type/Php/CompactFunctionReturnTypeExtension.php index 4c634ad0d1..435d4b067d 100644 --- a/src/Type/Php/CompactFunctionReturnTypeExtension.php +++ b/src/Type/Php/CompactFunctionReturnTypeExtension.php @@ -13,7 +13,7 @@ use function array_merge; use function count; -class CompactFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class CompactFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private bool $checkMaybeUndefinedVariables) diff --git a/src/Type/Php/ConstantFunctionReturnTypeExtension.php b/src/Type/Php/ConstantFunctionReturnTypeExtension.php index 1e1075c812..83cfb69ef5 100644 --- a/src/Type/Php/ConstantFunctionReturnTypeExtension.php +++ b/src/Type/Php/ConstantFunctionReturnTypeExtension.php @@ -11,7 +11,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class ConstantFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ConstantFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private ConstantHelper $constantHelper) diff --git a/src/Type/Php/ConstantHelper.php b/src/Type/Php/ConstantHelper.php index 7f056f90ec..edcbbf7b7f 100644 --- a/src/Type/Php/ConstantHelper.php +++ b/src/Type/Php/ConstantHelper.php @@ -12,7 +12,7 @@ use function explode; use function ltrim; -class ConstantHelper +final class ConstantHelper { public function createExprFromConstantName(string $constantName): ?Expr diff --git a/src/Type/Php/CountFunctionReturnTypeExtension.php b/src/Type/Php/CountFunctionReturnTypeExtension.php index d4c995f933..9368cb4279 100644 --- a/src/Type/Php/CountFunctionReturnTypeExtension.php +++ b/src/Type/Php/CountFunctionReturnTypeExtension.php @@ -12,7 +12,7 @@ use function in_array; use const COUNT_RECURSIVE; -class CountFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class CountFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/CountFunctionTypeSpecifyingExtension.php b/src/Type/Php/CountFunctionTypeSpecifyingExtension.php index 5940c2d803..03d938a7e4 100644 --- a/src/Type/Php/CountFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/CountFunctionTypeSpecifyingExtension.php @@ -14,7 +14,7 @@ use function count; use function in_array; -class CountFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class CountFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php b/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php index 112ed30292..7e70566044 100644 --- a/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php @@ -21,7 +21,7 @@ use PHPStan\Type\UnionType; use function strtolower; -class CtypeDigitFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class CtypeDigitFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/CurlInitReturnTypeExtension.php b/src/Type/Php/CurlInitReturnTypeExtension.php index e9564278fe..d34d79059a 100644 --- a/src/Type/Php/CurlInitReturnTypeExtension.php +++ b/src/Type/Php/CurlInitReturnTypeExtension.php @@ -12,7 +12,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class CurlInitReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class CurlInitReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/DateFormatFunctionReturnTypeExtension.php b/src/Type/Php/DateFormatFunctionReturnTypeExtension.php index bae299abaa..1a404526f3 100644 --- a/src/Type/Php/DateFormatFunctionReturnTypeExtension.php +++ b/src/Type/Php/DateFormatFunctionReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use function count; -class DateFormatFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class DateFormatFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private DateFunctionReturnTypeHelper $dateFunctionReturnTypeHelper) @@ -26,7 +26,7 @@ public function getTypeFromFunctionCall( FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope, - ): ?Type + ): Type { if (count($functionCall->getArgs()) < 2) { return new StringType(); diff --git a/src/Type/Php/DateFormatMethodReturnTypeExtension.php b/src/Type/Php/DateFormatMethodReturnTypeExtension.php index f028fbea7b..34854d28cc 100644 --- a/src/Type/Php/DateFormatMethodReturnTypeExtension.php +++ b/src/Type/Php/DateFormatMethodReturnTypeExtension.php @@ -11,7 +11,7 @@ use PHPStan\Type\Type; use function count; -class DateFormatMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class DateFormatMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { public function __construct(private DateFunctionReturnTypeHelper $dateFunctionReturnTypeHelper) @@ -28,7 +28,7 @@ public function isMethodSupported(MethodReflection $methodReflection): bool return $methodReflection->getName() === 'format'; } - public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type + public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type { if (count($methodCall->getArgs()) === 0) { return new StringType(); diff --git a/src/Type/Php/DateFunctionReturnTypeExtension.php b/src/Type/Php/DateFunctionReturnTypeExtension.php index 41432d1c3a..32113eb312 100644 --- a/src/Type/Php/DateFunctionReturnTypeExtension.php +++ b/src/Type/Php/DateFunctionReturnTypeExtension.php @@ -9,7 +9,7 @@ use PHPStan\Type\Type; use function count; -class DateFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class DateFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private DateFunctionReturnTypeHelper $dateFunctionReturnTypeHelper) diff --git a/src/Type/Php/DateFunctionReturnTypeHelper.php b/src/Type/Php/DateFunctionReturnTypeHelper.php index d6cadad384..5e15482336 100644 --- a/src/Type/Php/DateFunctionReturnTypeHelper.php +++ b/src/Type/Php/DateFunctionReturnTypeHelper.php @@ -17,10 +17,10 @@ use function str_pad; use const STR_PAD_LEFT; -class DateFunctionReturnTypeHelper +final class DateFunctionReturnTypeHelper { - public function getTypeFromFormatType(Type $formatType, bool $useMicrosec): ?Type + public function getTypeFromFormatType(Type $formatType, bool $useMicrosec): Type { $types = []; foreach ($formatType->getConstantStrings() as $formatString) { diff --git a/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php b/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php index cd7f63662c..04c356151d 100644 --- a/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class DateIntervalConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class DateIntervalConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php b/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php index 1fdcbf4937..563ade3589 100644 --- a/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php +++ b/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php @@ -14,7 +14,7 @@ use function count; use function in_array; -class DateIntervalDynamicReturnTypeExtension +final class DateIntervalDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { diff --git a/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php b/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php index a492e79388..e20c503c05 100644 --- a/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php +++ b/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php @@ -17,7 +17,7 @@ use PHPStan\Type\Type; use function strtolower; -class DatePeriodConstructorReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension +final class DatePeriodConstructorReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Type/Php/DateTimeConstructorThrowTypeExtension.php b/src/Type/Php/DateTimeConstructorThrowTypeExtension.php index 7b691b6257..6bde75bc6d 100644 --- a/src/Type/Php/DateTimeConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateTimeConstructorThrowTypeExtension.php @@ -16,7 +16,7 @@ use function count; use function in_array; -class DateTimeConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class DateTimeConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/DateTimeCreateDynamicReturnTypeExtension.php b/src/Type/Php/DateTimeCreateDynamicReturnTypeExtension.php index bd00c0f12a..9e3e5c892d 100644 --- a/src/Type/Php/DateTimeCreateDynamicReturnTypeExtension.php +++ b/src/Type/Php/DateTimeCreateDynamicReturnTypeExtension.php @@ -16,7 +16,7 @@ use function date_create; use function in_array; -class DateTimeCreateDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class DateTimeCreateDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/DateTimeDynamicReturnTypeExtension.php b/src/Type/Php/DateTimeDynamicReturnTypeExtension.php index b18c8534df..ef42505ede 100644 --- a/src/Type/Php/DateTimeDynamicReturnTypeExtension.php +++ b/src/Type/Php/DateTimeDynamicReturnTypeExtension.php @@ -15,7 +15,7 @@ use function count; use function in_array; -class DateTimeDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class DateTimeDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/DateTimeModifyReturnTypeExtension.php b/src/Type/Php/DateTimeModifyReturnTypeExtension.php index 39a327157a..6ab34811e5 100644 --- a/src/Type/Php/DateTimeModifyReturnTypeExtension.php +++ b/src/Type/Php/DateTimeModifyReturnTypeExtension.php @@ -16,7 +16,7 @@ use Throwable; use function count; -class DateTimeModifyReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class DateTimeModifyReturnTypeExtension implements DynamicMethodReturnTypeExtension { /** @param class-string $dateTimeClass */ diff --git a/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php b/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php index b0eee10181..e1b35ac7ee 100644 --- a/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\TypeCombinator; use function count; -class DateTimeZoneConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class DateTimeZoneConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/DefineConstantTypeSpecifyingExtension.php b/src/Type/Php/DefineConstantTypeSpecifyingExtension.php index 5f996c55e1..81a836f620 100644 --- a/src/Type/Php/DefineConstantTypeSpecifyingExtension.php +++ b/src/Type/Php/DefineConstantTypeSpecifyingExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\FunctionTypeSpecifyingExtension; use function count; -class DefineConstantTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class DefineConstantTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php b/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php index 5f37995240..880a3c8c21 100644 --- a/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php +++ b/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\MixedType; use function count; -class DefinedConstantTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class DefinedConstantTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/DioStatDynamicFunctionReturnTypeExtension.php b/src/Type/Php/DioStatDynamicFunctionReturnTypeExtension.php index 0a96b8d73f..5de459fb73 100644 --- a/src/Type/Php/DioStatDynamicFunctionReturnTypeExtension.php +++ b/src/Type/Php/DioStatDynamicFunctionReturnTypeExtension.php @@ -12,7 +12,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; -class DioStatDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class DioStatDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php b/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php index b69b412e58..9927cc252e 100644 --- a/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php @@ -22,7 +22,7 @@ use PHPStan\Type\TypeUtils; use function count; -class ExplodeFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ExplodeFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/FilterInputDynamicReturnTypeExtension.php b/src/Type/Php/FilterInputDynamicReturnTypeExtension.php index 0dd934cd32..1a04c7d5b9 100644 --- a/src/Type/Php/FilterInputDynamicReturnTypeExtension.php +++ b/src/Type/Php/FilterInputDynamicReturnTypeExtension.php @@ -9,7 +9,7 @@ use PHPStan\Type\Type; use function count; -class FilterInputDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class FilterInputDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private FilterFunctionReturnTypeHelper $filterFunctionReturnTypeHelper) diff --git a/src/Type/Php/FilterVarArrayDynamicReturnTypeExtension.php b/src/Type/Php/FilterVarArrayDynamicReturnTypeExtension.php index caaca73501..2eaa4308b4 100644 --- a/src/Type/Php/FilterVarArrayDynamicReturnTypeExtension.php +++ b/src/Type/Php/FilterVarArrayDynamicReturnTypeExtension.php @@ -26,7 +26,7 @@ use function in_array; use function strtolower; -class FilterVarArrayDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class FilterVarArrayDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private FilterFunctionReturnTypeHelper $filterFunctionReturnTypeHelper, private ReflectionProvider $reflectionProvider) diff --git a/src/Type/Php/FilterVarDynamicReturnTypeExtension.php b/src/Type/Php/FilterVarDynamicReturnTypeExtension.php index 438d6440e9..26c2773555 100644 --- a/src/Type/Php/FilterVarDynamicReturnTypeExtension.php +++ b/src/Type/Php/FilterVarDynamicReturnTypeExtension.php @@ -10,7 +10,7 @@ use function count; use function strtolower; -class FilterVarDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class FilterVarDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private FilterFunctionReturnTypeHelper $filterFunctionReturnTypeHelper) diff --git a/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php b/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php index de7e8dfe40..51bc6c4b2d 100644 --- a/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php @@ -18,7 +18,7 @@ use PHPStan\Type\FunctionTypeSpecifyingExtension; use function ltrim; -class FunctionExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class FunctionExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/GetCalledClassDynamicReturnTypeExtension.php b/src/Type/Php/GetCalledClassDynamicReturnTypeExtension.php index c570e8ec86..612c66d786 100644 --- a/src/Type/Php/GetCalledClassDynamicReturnTypeExtension.php +++ b/src/Type/Php/GetCalledClassDynamicReturnTypeExtension.php @@ -11,7 +11,7 @@ use PHPStan\Type\DynamicFunctionReturnTypeExtension; use PHPStan\Type\Type; -class GetCalledClassDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class GetCalledClassDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/GetClassDynamicReturnTypeExtension.php b/src/Type/Php/GetClassDynamicReturnTypeExtension.php index a6c2fdfdb5..bd1f73b5c2 100644 --- a/src/Type/Php/GetClassDynamicReturnTypeExtension.php +++ b/src/Type/Php/GetClassDynamicReturnTypeExtension.php @@ -23,7 +23,7 @@ use PHPStan\Type\UnionType; use function count; -class GetClassDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class GetClassDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/GetDebugTypeFunctionReturnTypeExtension.php b/src/Type/Php/GetDebugTypeFunctionReturnTypeExtension.php index 936f5b5adf..d5678343b5 100644 --- a/src/Type/Php/GetDebugTypeFunctionReturnTypeExtension.php +++ b/src/Type/Php/GetDebugTypeFunctionReturnTypeExtension.php @@ -14,7 +14,7 @@ use function array_map; use function count; -class GetDebugTypeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class GetDebugTypeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php b/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php index 3dc2dbba5b..b03a68655d 100644 --- a/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php +++ b/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php @@ -18,7 +18,7 @@ use function array_map; use function count; -class GetParentClassDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class GetParentClassDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Type/Php/GettimeofdayDynamicFunctionReturnTypeExtension.php b/src/Type/Php/GettimeofdayDynamicFunctionReturnTypeExtension.php index eb396ad797..8b6a6133cf 100644 --- a/src/Type/Php/GettimeofdayDynamicFunctionReturnTypeExtension.php +++ b/src/Type/Php/GettimeofdayDynamicFunctionReturnTypeExtension.php @@ -15,7 +15,7 @@ use PHPStan\Type\Type; use PHPStan\Type\UnionType; -class GettimeofdayDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class GettimeofdayDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/GettypeFunctionReturnTypeExtension.php b/src/Type/Php/GettypeFunctionReturnTypeExtension.php index 566faa3243..875529ae47 100644 --- a/src/Type/Php/GettypeFunctionReturnTypeExtension.php +++ b/src/Type/Php/GettypeFunctionReturnTypeExtension.php @@ -15,7 +15,7 @@ use PHPStan\Type\UnionType; use function count; -class GettypeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class GettypeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/HrtimeFunctionReturnTypeExtension.php b/src/Type/Php/HrtimeFunctionReturnTypeExtension.php index 47dc50fee9..fdbf783378 100644 --- a/src/Type/Php/HrtimeFunctionReturnTypeExtension.php +++ b/src/Type/Php/HrtimeFunctionReturnTypeExtension.php @@ -16,7 +16,7 @@ use PHPStan\Type\TypeUtils; use function count; -class HrtimeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class HrtimeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/ImplodeFunctionReturnTypeExtension.php b/src/Type/Php/ImplodeFunctionReturnTypeExtension.php index 0daed61c52..bb29690bd6 100644 --- a/src/Type/Php/ImplodeFunctionReturnTypeExtension.php +++ b/src/Type/Php/ImplodeFunctionReturnTypeExtension.php @@ -20,7 +20,7 @@ use function implode; use function in_array; -class ImplodeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ImplodeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php b/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php index a8d9c45276..216423696d 100644 --- a/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php @@ -21,7 +21,7 @@ use function count; use function strtolower; -class InArrayFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class InArrayFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/IniGetReturnTypeExtension.php b/src/Type/Php/IniGetReturnTypeExtension.php index 4e4de99bc4..15dc36a481 100644 --- a/src/Type/Php/IniGetReturnTypeExtension.php +++ b/src/Type/Php/IniGetReturnTypeExtension.php @@ -13,7 +13,7 @@ use function array_key_exists; use function count; -class IniGetReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class IniGetReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/IntdivThrowTypeExtension.php b/src/Type/Php/IntdivThrowTypeExtension.php index aab1448733..bab7bdcdeb 100644 --- a/src/Type/Php/IntdivThrowTypeExtension.php +++ b/src/Type/Php/IntdivThrowTypeExtension.php @@ -15,7 +15,7 @@ use function count; use const PHP_INT_MIN; -class IntdivThrowTypeExtension implements DynamicFunctionThrowTypeExtension +final class IntdivThrowTypeExtension implements DynamicFunctionThrowTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php index 0eb26199df..c4000b9aff 100644 --- a/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php @@ -15,7 +15,7 @@ use function count; use function strtolower; -class IsAFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class IsAFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php index d05b999422..20ca925c1c 100644 --- a/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php @@ -15,7 +15,7 @@ use PHPStan\Type\MixedType; use function strtolower; -class IsArrayFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class IsArrayFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php index 38bb1f3044..472683ffb1 100644 --- a/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php @@ -18,7 +18,7 @@ use function count; use function strtolower; -class IsCallableFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class IsCallableFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php index 470d196894..c523fde243 100644 --- a/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php @@ -15,7 +15,7 @@ use PHPStan\Type\MixedType; use function strtolower; -class IsIterableFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class IsIterableFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php index 3864db74e5..2d52ee99e1 100644 --- a/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php @@ -15,7 +15,7 @@ use function count; use function strtolower; -class IsSubclassOfFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class IsSubclassOfFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php b/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php index a06e2b3370..eda7d4df47 100644 --- a/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php +++ b/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php @@ -20,7 +20,7 @@ use function is_bool; use function json_decode; -class JsonThrowOnErrorDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class JsonThrowOnErrorDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { /** @var array */ diff --git a/src/Type/Php/JsonThrowTypeExtension.php b/src/Type/Php/JsonThrowTypeExtension.php index 29eaf4f290..68e7855bb7 100644 --- a/src/Type/Php/JsonThrowTypeExtension.php +++ b/src/Type/Php/JsonThrowTypeExtension.php @@ -13,7 +13,7 @@ use PHPStan\Type\Type; use function in_array; -class JsonThrowTypeExtension implements DynamicFunctionThrowTypeExtension +final class JsonThrowTypeExtension implements DynamicFunctionThrowTypeExtension { private const ARGUMENTS_POSITIONS = [ diff --git a/src/Type/Php/LtrimFunctionReturnTypeExtension.php b/src/Type/Php/LtrimFunctionReturnTypeExtension.php index 964d605b27..b8b5b38c6f 100644 --- a/src/Type/Php/LtrimFunctionReturnTypeExtension.php +++ b/src/Type/Php/LtrimFunctionReturnTypeExtension.php @@ -12,7 +12,7 @@ use function count; use function ltrim; -class LtrimFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class LtrimFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/MbConvertEncodingFunctionReturnTypeExtension.php b/src/Type/Php/MbConvertEncodingFunctionReturnTypeExtension.php index ae3aa752f9..dd46ed4c2a 100644 --- a/src/Type/Php/MbConvertEncodingFunctionReturnTypeExtension.php +++ b/src/Type/Php/MbConvertEncodingFunctionReturnTypeExtension.php @@ -11,7 +11,7 @@ use PHPStan\Type\StringType; use PHPStan\Type\Type; -class MbConvertEncodingFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class MbConvertEncodingFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/MbFunctionsReturnTypeExtension.php b/src/Type/Php/MbFunctionsReturnTypeExtension.php index 13f8d238b0..d6cb144506 100644 --- a/src/Type/Php/MbFunctionsReturnTypeExtension.php +++ b/src/Type/Php/MbFunctionsReturnTypeExtension.php @@ -21,7 +21,7 @@ use function array_unique; use function count; -class MbFunctionsReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class MbFunctionsReturnTypeExtension implements DynamicFunctionReturnTypeExtension { use MbFunctionsReturnTypeExtensionTrait; diff --git a/src/Type/Php/MbStrlenFunctionReturnTypeExtension.php b/src/Type/Php/MbStrlenFunctionReturnTypeExtension.php index cb246f7e3d..fe28eb34ca 100644 --- a/src/Type/Php/MbStrlenFunctionReturnTypeExtension.php +++ b/src/Type/Php/MbStrlenFunctionReturnTypeExtension.php @@ -33,7 +33,7 @@ use function sprintf; use function var_export; -class MbStrlenFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class MbStrlenFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { private const UNSUPPORTED_ENCODING = 'unsupported'; diff --git a/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php b/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php index f5d0055d9b..a782db6686 100644 --- a/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php +++ b/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php @@ -18,7 +18,7 @@ use function in_array; use function strtolower; -class MbSubstituteCharacterDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class MbSubstituteCharacterDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/MethodExistsTypeSpecifyingExtension.php b/src/Type/Php/MethodExistsTypeSpecifyingExtension.php index 08a366a59b..bdff31b842 100644 --- a/src/Type/Php/MethodExistsTypeSpecifyingExtension.php +++ b/src/Type/Php/MethodExistsTypeSpecifyingExtension.php @@ -18,7 +18,7 @@ use PHPStan\Type\UnionType; use function count; -class MethodExistsTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class MethodExistsTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/MicrotimeFunctionReturnTypeExtension.php b/src/Type/Php/MicrotimeFunctionReturnTypeExtension.php index 422e1355c6..f0cc1561fb 100644 --- a/src/Type/Php/MicrotimeFunctionReturnTypeExtension.php +++ b/src/Type/Php/MicrotimeFunctionReturnTypeExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\UnionType; use function count; -class MicrotimeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class MicrotimeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/MinMaxFunctionReturnTypeExtension.php b/src/Type/Php/MinMaxFunctionReturnTypeExtension.php index e1633c0b64..20128f0a92 100644 --- a/src/Type/Php/MinMaxFunctionReturnTypeExtension.php +++ b/src/Type/Php/MinMaxFunctionReturnTypeExtension.php @@ -20,7 +20,7 @@ use function count; use function in_array; -class MinMaxFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class MinMaxFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct( diff --git a/src/Type/Php/NonEmptyStringFunctionsReturnTypeExtension.php b/src/Type/Php/NonEmptyStringFunctionsReturnTypeExtension.php index cb7cf0eb07..083914085a 100644 --- a/src/Type/Php/NonEmptyStringFunctionsReturnTypeExtension.php +++ b/src/Type/Php/NonEmptyStringFunctionsReturnTypeExtension.php @@ -14,7 +14,7 @@ use function count; use function in_array; -class NonEmptyStringFunctionsReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class NonEmptyStringFunctionsReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/PathinfoFunctionDynamicReturnTypeExtension.php b/src/Type/Php/PathinfoFunctionDynamicReturnTypeExtension.php index 11a5f74752..60fac48358 100644 --- a/src/Type/Php/PathinfoFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/PathinfoFunctionDynamicReturnTypeExtension.php @@ -17,7 +17,7 @@ use function count; use function sprintf; -class PathinfoFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class PathinfoFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Type/Php/PowFunctionReturnTypeExtension.php b/src/Type/Php/PowFunctionReturnTypeExtension.php index ea15dae2e8..6be372d38f 100644 --- a/src/Type/Php/PowFunctionReturnTypeExtension.php +++ b/src/Type/Php/PowFunctionReturnTypeExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\Type; use function count; -class PowFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class PowFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/PregFilterFunctionReturnTypeExtension.php b/src/Type/Php/PregFilterFunctionReturnTypeExtension.php index 3e158d1bcc..acd5ab309b 100644 --- a/src/Type/Php/PregFilterFunctionReturnTypeExtension.php +++ b/src/Type/Php/PregFilterFunctionReturnTypeExtension.php @@ -15,7 +15,7 @@ use PHPStan\Type\UnionType; use function count; -class PregFilterFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class PregFilterFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/PregSplitDynamicReturnTypeExtension.php b/src/Type/Php/PregSplitDynamicReturnTypeExtension.php index 6300d6887d..d898085584 100644 --- a/src/Type/Php/PregSplitDynamicReturnTypeExtension.php +++ b/src/Type/Php/PregSplitDynamicReturnTypeExtension.php @@ -20,7 +20,7 @@ use PHPStan\Type\TypeCombinator; use function strtolower; -class PregSplitDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class PregSplitDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct( diff --git a/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php b/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php index 8907e48a66..70d08b9098 100644 --- a/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php +++ b/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php @@ -19,7 +19,7 @@ use PHPStan\Type\ObjectWithoutClassType; use function count; -class PropertyExistsTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class PropertyExistsTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/RandomIntFunctionReturnTypeExtension.php b/src/Type/Php/RandomIntFunctionReturnTypeExtension.php index e7e17b90f6..3e0873ee11 100644 --- a/src/Type/Php/RandomIntFunctionReturnTypeExtension.php +++ b/src/Type/Php/RandomIntFunctionReturnTypeExtension.php @@ -17,7 +17,7 @@ use function max; use function min; -class RandomIntFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class RandomIntFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/RangeFunctionReturnTypeExtension.php b/src/Type/Php/RangeFunctionReturnTypeExtension.php index 8a67f1d6ab..16c7a37788 100644 --- a/src/Type/Php/RangeFunctionReturnTypeExtension.php +++ b/src/Type/Php/RangeFunctionReturnTypeExtension.php @@ -27,7 +27,7 @@ use function is_array; use function range; -class RangeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class RangeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { private const RANGE_LENGTH_THRESHOLD = 50; diff --git a/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php index bbe3c9de62..487857213d 100644 --- a/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php @@ -13,7 +13,7 @@ use ReflectionClass; use function count; -class ReflectionClassConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class ReflectionClassConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function isStaticMethodSupported(MethodReflection $methodReflection): bool diff --git a/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php b/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php index 842821b1e2..fb3e577d38 100644 --- a/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php +++ b/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php @@ -15,7 +15,7 @@ use PHPStan\Type\ObjectType; use ReflectionClass; -class ReflectionClassIsSubclassOfTypeSpecifyingExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class ReflectionClassIsSubclassOfTypeSpecifyingExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php index 56478c55c9..83df24904f 100644 --- a/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php @@ -14,7 +14,7 @@ use ReflectionFunction; use function count; -class ReflectionFunctionConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class ReflectionFunctionConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php b/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php index bb11536c1b..621831d168 100644 --- a/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php +++ b/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php @@ -13,7 +13,7 @@ use ReflectionAttribute; use function count; -class ReflectionGetAttributesMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class ReflectionGetAttributesMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { /** diff --git a/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php index e6aa5823f5..c0b0df2cf5 100644 --- a/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php @@ -16,7 +16,7 @@ use ReflectionMethod; use function count; -class ReflectionMethodConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class ReflectionMethodConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php index 098b3f1567..b988a7883a 100644 --- a/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php @@ -13,7 +13,7 @@ use ReflectionProperty; use function count; -class ReflectionPropertyConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class ReflectionPropertyConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function __construct(private ReflectionProvider $reflectionProvider) diff --git a/src/Type/Php/RegexCapturingGroup.php b/src/Type/Php/RegexCapturingGroup.php index e5ddac62e2..b89989cb51 100644 --- a/src/Type/Php/RegexCapturingGroup.php +++ b/src/Type/Php/RegexCapturingGroup.php @@ -4,7 +4,7 @@ use PHPStan\Type\Type; -class RegexCapturingGroup +final class RegexCapturingGroup { private bool $forceNonOptional = false; diff --git a/src/Type/Php/RegexNonCapturingGroup.php b/src/Type/Php/RegexNonCapturingGroup.php index 1f3fd26d4c..71bf2d7ead 100644 --- a/src/Type/Php/RegexNonCapturingGroup.php +++ b/src/Type/Php/RegexNonCapturingGroup.php @@ -2,7 +2,7 @@ namespace PHPStan\Type\Php; -class RegexNonCapturingGroup +final class RegexNonCapturingGroup { public function __construct( diff --git a/src/Type/Php/ReplaceFunctionsDynamicReturnTypeExtension.php b/src/Type/Php/ReplaceFunctionsDynamicReturnTypeExtension.php index 1da17b48d8..f6af99e4d2 100644 --- a/src/Type/Php/ReplaceFunctionsDynamicReturnTypeExtension.php +++ b/src/Type/Php/ReplaceFunctionsDynamicReturnTypeExtension.php @@ -18,7 +18,7 @@ use function array_key_exists; use function count; -class ReplaceFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class ReplaceFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { private const FUNCTIONS_SUBJECT_POSITION = [ diff --git a/src/Type/Php/RoundFunctionReturnTypeExtension.php b/src/Type/Php/RoundFunctionReturnTypeExtension.php index e3e3441b3e..8d064c1ef3 100644 --- a/src/Type/Php/RoundFunctionReturnTypeExtension.php +++ b/src/Type/Php/RoundFunctionReturnTypeExtension.php @@ -22,7 +22,7 @@ use function count; use function in_array; -class RoundFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class RoundFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php b/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php index 70526414bb..934aece46e 100644 --- a/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php @@ -18,7 +18,7 @@ use function count; use function strtolower; -class SetTypeFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension +final class SetTypeFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php b/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php index e6c390cd22..a0f33f1841 100644 --- a/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php +++ b/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php @@ -14,7 +14,7 @@ use SimpleXMLElement; use function count; -class SimpleXMLElementAsXMLMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class SimpleXMLElementAsXMLMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php b/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php index dadfdaa478..6b43f932c4 100644 --- a/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php +++ b/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php @@ -10,7 +10,7 @@ use PHPStan\Type\NullType; use PHPStan\Type\ObjectType; -class SimpleXMLElementClassPropertyReflectionExtension implements PropertiesClassReflectionExtension +final class SimpleXMLElementClassPropertyReflectionExtension implements PropertiesClassReflectionExtension { public function hasProperty(ClassReflection $classReflection, string $propertyName): bool diff --git a/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php b/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php index ea5da83872..28995db8ea 100644 --- a/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php +++ b/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php @@ -14,7 +14,7 @@ use function extension_loaded; use function libxml_use_internal_errors; -class SimpleXMLElementConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension +final class SimpleXMLElementConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { public function isStaticMethodSupported(MethodReflection $methodReflection): bool diff --git a/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php b/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php index 5ce6d57598..7255d64887 100644 --- a/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php +++ b/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php @@ -14,7 +14,7 @@ use SimpleXMLElement; use function extension_loaded; -class SimpleXMLElementXpathMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension +final class SimpleXMLElementXpathMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { public function getClass(): string diff --git a/src/Type/Php/SprintfFunctionDynamicReturnTypeExtension.php b/src/Type/Php/SprintfFunctionDynamicReturnTypeExtension.php index 8f1782b0a5..8e53a957c4 100644 --- a/src/Type/Php/SprintfFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/SprintfFunctionDynamicReturnTypeExtension.php @@ -32,7 +32,7 @@ use function substr; use function vsprintf; -class SprintfFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class SprintfFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/SscanfFunctionDynamicReturnTypeExtension.php b/src/Type/Php/SscanfFunctionDynamicReturnTypeExtension.php index 5939bf7ced..18a1275ca6 100644 --- a/src/Type/Php/SscanfFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/SscanfFunctionDynamicReturnTypeExtension.php @@ -21,7 +21,7 @@ use function in_array; use function preg_match_all; -class SscanfFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class SscanfFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StatDynamicReturnTypeExtension.php b/src/Type/Php/StatDynamicReturnTypeExtension.php index 7b8c08f194..4a0141b106 100644 --- a/src/Type/Php/StatDynamicReturnTypeExtension.php +++ b/src/Type/Php/StatDynamicReturnTypeExtension.php @@ -18,7 +18,7 @@ use SplFileObject; use function in_array; -class StatDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension, DynamicMethodReturnTypeExtension +final class StatDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension, DynamicMethodReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrCaseFunctionsReturnTypeExtension.php b/src/Type/Php/StrCaseFunctionsReturnTypeExtension.php index ebb693672d..39355b579e 100644 --- a/src/Type/Php/StrCaseFunctionsReturnTypeExtension.php +++ b/src/Type/Php/StrCaseFunctionsReturnTypeExtension.php @@ -21,7 +21,7 @@ use function is_callable; use function mb_check_encoding; -class StrCaseFunctionsReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrCaseFunctionsReturnTypeExtension implements DynamicFunctionReturnTypeExtension { /** diff --git a/src/Type/Php/StrIncrementDecrementFunctionReturnTypeExtension.php b/src/Type/Php/StrIncrementDecrementFunctionReturnTypeExtension.php index b739263e64..f44a76b71c 100644 --- a/src/Type/Php/StrIncrementDecrementFunctionReturnTypeExtension.php +++ b/src/Type/Php/StrIncrementDecrementFunctionReturnTypeExtension.php @@ -23,7 +23,7 @@ use function str_split; use function stripos; -class StrIncrementDecrementFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrIncrementDecrementFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrPadFunctionReturnTypeExtension.php b/src/Type/Php/StrPadFunctionReturnTypeExtension.php index 3b11f5130e..fd98d36ae4 100644 --- a/src/Type/Php/StrPadFunctionReturnTypeExtension.php +++ b/src/Type/Php/StrPadFunctionReturnTypeExtension.php @@ -15,7 +15,7 @@ use PHPStan\Type\Type; use function count; -class StrPadFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrPadFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrRepeatFunctionReturnTypeExtension.php b/src/Type/Php/StrRepeatFunctionReturnTypeExtension.php index 3ba27a7f9e..22c9714168 100644 --- a/src/Type/Php/StrRepeatFunctionReturnTypeExtension.php +++ b/src/Type/Php/StrRepeatFunctionReturnTypeExtension.php @@ -22,7 +22,7 @@ use function str_repeat; use function strlen; -class StrRepeatFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrRepeatFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrTokFunctionReturnTypeExtension.php b/src/Type/Php/StrTokFunctionReturnTypeExtension.php index 1af80eafe6..85efaa5ad2 100644 --- a/src/Type/Php/StrTokFunctionReturnTypeExtension.php +++ b/src/Type/Php/StrTokFunctionReturnTypeExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\Type; use function count; -class StrTokFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrTokFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrWordCountFunctionDynamicReturnTypeExtension.php b/src/Type/Php/StrWordCountFunctionDynamicReturnTypeExtension.php index 96a532ceef..33ed245739 100644 --- a/src/Type/Php/StrWordCountFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/StrWordCountFunctionDynamicReturnTypeExtension.php @@ -16,7 +16,7 @@ use PHPStan\Type\UnionType; use function count; -class StrWordCountFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrWordCountFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrlenFunctionReturnTypeExtension.php b/src/Type/Php/StrlenFunctionReturnTypeExtension.php index e4a51cb833..e50dc20676 100644 --- a/src/Type/Php/StrlenFunctionReturnTypeExtension.php +++ b/src/Type/Php/StrlenFunctionReturnTypeExtension.php @@ -24,7 +24,7 @@ use function sort; use function strlen; -class StrlenFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrlenFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrtotimeFunctionReturnTypeExtension.php b/src/Type/Php/StrtotimeFunctionReturnTypeExtension.php index ef5e1af787..479adf4c43 100644 --- a/src/Type/Php/StrtotimeFunctionReturnTypeExtension.php +++ b/src/Type/Php/StrtotimeFunctionReturnTypeExtension.php @@ -21,7 +21,7 @@ use function min; use function strtotime; -class StrtotimeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrtotimeFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/StrvalFamilyFunctionReturnTypeExtension.php b/src/Type/Php/StrvalFamilyFunctionReturnTypeExtension.php index 3328313d9a..8ed6c637fc 100644 --- a/src/Type/Php/StrvalFamilyFunctionReturnTypeExtension.php +++ b/src/Type/Php/StrvalFamilyFunctionReturnTypeExtension.php @@ -15,7 +15,7 @@ use function count; use function in_array; -class StrvalFamilyFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class StrvalFamilyFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension { private const FUNCTIONS = [ diff --git a/src/Type/Php/SubstrDynamicReturnTypeExtension.php b/src/Type/Php/SubstrDynamicReturnTypeExtension.php index ae4bf10d5a..e90116c57a 100644 --- a/src/Type/Php/SubstrDynamicReturnTypeExtension.php +++ b/src/Type/Php/SubstrDynamicReturnTypeExtension.php @@ -22,7 +22,7 @@ use function mb_substr; use function substr; -class SubstrDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class SubstrDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/TriggerErrorDynamicReturnTypeExtension.php b/src/Type/Php/TriggerErrorDynamicReturnTypeExtension.php index 1df3f180e5..c05c6f6cef 100644 --- a/src/Type/Php/TriggerErrorDynamicReturnTypeExtension.php +++ b/src/Type/Php/TriggerErrorDynamicReturnTypeExtension.php @@ -18,7 +18,7 @@ use const E_USER_NOTICE; use const E_USER_WARNING; -class TriggerErrorDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class TriggerErrorDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function __construct(private PhpVersion $phpVersion) diff --git a/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php b/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php index 380cfb5b59..1f715dad2c 100644 --- a/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php +++ b/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php @@ -15,7 +15,7 @@ use function count; use function in_array; -class TypeSpecifyingFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension, TypeSpecifierAwareExtension +final class TypeSpecifyingFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension, TypeSpecifierAwareExtension { private TypeSpecifier $typeSpecifier; diff --git a/src/Type/Php/VersionCompareFunctionDynamicReturnTypeExtension.php b/src/Type/Php/VersionCompareFunctionDynamicReturnTypeExtension.php index b8a77540cb..9a5592bf40 100644 --- a/src/Type/Php/VersionCompareFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/VersionCompareFunctionDynamicReturnTypeExtension.php @@ -15,7 +15,7 @@ use function count; use function version_compare; -class VersionCompareFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension +final class VersionCompareFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension { public function isFunctionSupported(FunctionReflection $functionReflection): bool diff --git a/src/Type/Php/XMLReaderOpenReturnTypeExtension.php b/src/Type/Php/XMLReaderOpenReturnTypeExtension.php index 62e820b703..26551ff830 100644 --- a/src/Type/Php/XMLReaderOpenReturnTypeExtension.php +++ b/src/Type/Php/XMLReaderOpenReturnTypeExtension.php @@ -14,7 +14,7 @@ use PHPStan\Type\Type; use PHPStan\Type\UnionType; -class XMLReaderOpenReturnTypeExtension implements DynamicMethodReturnTypeExtension, DynamicStaticMethodReturnTypeExtension +final class XMLReaderOpenReturnTypeExtension implements DynamicMethodReturnTypeExtension, DynamicStaticMethodReturnTypeExtension { private const XML_READER_CLASS = 'XMLReader'; diff --git a/src/Type/RecursionGuard.php b/src/Type/RecursionGuard.php index 8fd995882c..aeecba0db7 100644 --- a/src/Type/RecursionGuard.php +++ b/src/Type/RecursionGuard.php @@ -2,7 +2,7 @@ namespace PHPStan\Type; -class RecursionGuard +final class RecursionGuard { /** @var true[] */ diff --git a/src/Type/SimultaneousTypeTraverser.php b/src/Type/SimultaneousTypeTraverser.php index f0e0e3dfe7..046727de88 100644 --- a/src/Type/SimultaneousTypeTraverser.php +++ b/src/Type/SimultaneousTypeTraverser.php @@ -2,7 +2,7 @@ namespace PHPStan\Type; -class SimultaneousTypeTraverser +final class SimultaneousTypeTraverser { /** @var callable(Type $left, Type $right, callable(Type, Type): Type $traverse): Type */ diff --git a/src/Type/StaticTypeFactory.php b/src/Type/StaticTypeFactory.php index ba99a36130..382e4208ad 100644 --- a/src/Type/StaticTypeFactory.php +++ b/src/Type/StaticTypeFactory.php @@ -8,7 +8,7 @@ use PHPStan\Type\Constant\ConstantIntegerType; use PHPStan\Type\Constant\ConstantStringType; -class StaticTypeFactory +final class StaticTypeFactory { public static function falsey(): Type diff --git a/src/Type/TypeAlias.php b/src/Type/TypeAlias.php index 10d6c09922..7dc7803af0 100644 --- a/src/Type/TypeAlias.php +++ b/src/Type/TypeAlias.php @@ -7,7 +7,7 @@ use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\PhpDocParser\Ast\Type\TypeNode; -class TypeAlias +final class TypeAlias { private ?Type $resolvedType = null; diff --git a/src/Type/TypeCombinator.php b/src/Type/TypeCombinator.php index 88d04af91f..615c9b827a 100644 --- a/src/Type/TypeCombinator.php +++ b/src/Type/TypeCombinator.php @@ -36,7 +36,10 @@ use function sprintf; use function usort; -/** @api */ +/** + * @api + * @final + */ class TypeCombinator { diff --git a/src/Type/TypeTraverser.php b/src/Type/TypeTraverser.php index 1507e8ce58..a95cf246c1 100644 --- a/src/Type/TypeTraverser.php +++ b/src/Type/TypeTraverser.php @@ -2,7 +2,7 @@ namespace PHPStan\Type; -class TypeTraverser +final class TypeTraverser { /** @var callable(Type $type, callable(Type): Type $traverse): Type */ diff --git a/src/Type/TypeUtils.php b/src/Type/TypeUtils.php index c16822e0a4..92cc4343df 100644 --- a/src/Type/TypeUtils.php +++ b/src/Type/TypeUtils.php @@ -15,7 +15,10 @@ use function array_unique; use function array_values; -/** @api */ +/** + * @api + * @final + */ class TypeUtils { diff --git a/src/Type/TypehintHelper.php b/src/Type/TypehintHelper.php index 09e33f5c9b..8f9f5616f3 100644 --- a/src/Type/TypehintHelper.php +++ b/src/Type/TypehintHelper.php @@ -19,7 +19,7 @@ use function str_ends_with; use function strtolower; -class TypehintHelper +final class TypehintHelper { private static function getTypeObjectFromTypehint(string $typeString, ClassReflection|string|null $selfClass): Type diff --git a/src/Type/UnionTypeHelper.php b/src/Type/UnionTypeHelper.php index a2c28b3153..7f82682dc5 100644 --- a/src/Type/UnionTypeHelper.php +++ b/src/Type/UnionTypeHelper.php @@ -12,7 +12,7 @@ use function usort; use const PHP_INT_MIN; -class UnionTypeHelper +final class UnionTypeHelper { /** diff --git a/src/Type/UsefulTypeAliasResolver.php b/src/Type/UsefulTypeAliasResolver.php index 191bad9794..f4ad8abbb8 100644 --- a/src/Type/UsefulTypeAliasResolver.php +++ b/src/Type/UsefulTypeAliasResolver.php @@ -10,7 +10,7 @@ use function array_key_exists; use function sprintf; -class UsefulTypeAliasResolver implements TypeAliasResolver +final class UsefulTypeAliasResolver implements TypeAliasResolver { /** @var array */ diff --git a/src/Type/VerbosityLevel.php b/src/Type/VerbosityLevel.php index c80bcbce99..d9724fc64d 100644 --- a/src/Type/VerbosityLevel.php +++ b/src/Type/VerbosityLevel.php @@ -11,7 +11,7 @@ use PHPStan\Type\Generic\GenericObjectType; use PHPStan\Type\Generic\TemplateType; -class VerbosityLevel +final class VerbosityLevel { private const TYPE_ONLY = 1;