From 4153c9d6ada47f93f142421695d36d7fc833acb8 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 12:11:36 +0200 Subject: [PATCH 1/9] Map all BrokerFactory tags in AutowiredAttributeServicesExtension --- conf/config.neon | 54 ------------- .../AutowiredAttributeServicesExtension.php | 76 +++++++++++++++++++ src/PhpDoc/SocketSelectStubFilesExtension.php | 2 + ...flectionEnumDynamicReturnTypeExtension.php | 2 + ...llowedSubTypesClassReflectionExtension.php | 2 + src/Rules/Functions/PrintfHelper.php | 2 + src/Type/Constant/OversizedArrayBuilder.php | 2 + ...teIdentifierDynamicReturnTypeExtension.php | 2 + src/Type/Php/AssertThrowTypeExtension.php | 2 + ...umFromMethodDynamicReturnTypeExtension.php | 2 + ...hNumberOperatorTypeSpecifyingExtension.php | 2 + ...tePeriodConstructorReturnTypeExtension.php | 2 + ...penSslEncryptParameterOutTypeExtension.php | 2 + ...regReplaceCallbackClosureTypeExtension.php | 2 + ...LElementAsXMLMethodReturnTypeExtension.php | 2 + ...lementClassPropertyReflectionExtension.php | 2 + ...LElementXpathMethodReturnTypeExtension.php | 2 + 17 files changed, 106 insertions(+), 54 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index 7fe441dfc6..97da7ba6fb 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -403,11 +403,6 @@ services: - class: PHPStan\PhpDoc\StubValidator - - - class: PHPStan\PhpDoc\SocketSelectStubFilesExtension - tags: - - phpstan.stubFilesExtension - - class: PHPStan\PhpDoc\DefaultStubFilesProvider arguments: @@ -753,11 +748,6 @@ services: tags: - phpstan.broker.dynamicMethodReturnTypeExtension - - - class: PHPStan\Reflection\BetterReflection\Type\AdapterReflectionEnumDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - class: PHPStan\Reflection\ConstructorsHelper arguments: @@ -793,11 +783,6 @@ services: - class: PHPStan\Reflection\Php\Soap\SoapClientMethodsClassReflectionExtension - - - class: PHPStan\Reflection\Php\EnumAllowedSubTypesClassReflectionExtension - tags: - - phpstan.broker.allowedSubTypesClassReflectionExtension - - class: PHPStan\Reflection\Php\UniversalObjectCratesClassReflectionExtension tags: @@ -1071,10 +1056,6 @@ services: arguments: reportMagicProperties: %reportMagicProperties% checkDynamicProperties: %checkDynamicProperties% - - - class: PHPStan\Type\Php\BcMathNumberOperatorTypeSpecifyingExtension - tags: - - phpstan.broker.operatorTypeSpecifyingExtension - class: PHPStan\Rules\Properties\UninitializedPropertyRule @@ -1256,11 +1237,6 @@ services: tags: - phpstan.dynamicFunctionThrowTypeExtension - - - class: PHPStan\Type\Php\OpenSslEncryptParameterOutTypeExtension - tags: - - phpstan.functionParameterOutTypeExtension - - class: PHPStan\Type\Php\ParseStrParameterOutTypeExtension tags: @@ -1315,11 +1291,6 @@ services: tags: - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - class: PHPStan\Type\Php\SimpleXMLElementClassPropertyReflectionExtension - tags: - - phpstan.broker.propertiesClassReflectionExtension - - class: PHPStan\Type\Php\SimpleXMLElementConstructorThrowTypeExtension tags: @@ -1434,16 +1405,6 @@ services: tags: - phpstan.broker.dynamicFunctionReturnTypeExtension - - - class: PHPStan\Type\Php\SimpleXMLElementAsXMLMethodReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\SimpleXMLElementXpathMethodReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - class: PHPStan\Type\Php\LtrimFunctionReturnTypeExtension tags: @@ -1495,26 +1456,11 @@ services: tags: - phpstan.broker.dynamicMethodReturnTypeExtension - - - class: PHPStan\Type\Php\DatePeriodConstructorReturnTypeExtension - tags: - - phpstan.broker.dynamicStaticMethodReturnTypeExtension - - - - class: PHPStan\Type\PHPStan\ClassNameUsageLocationCreateIdentifierDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - class: PHPStan\Type\ClosureTypeFactory arguments: parser: @currentPhpVersionPhpParser - - - class: PHPStan\Type\Constant\OversizedArrayBuilder - - - - class: PHPStan\Rules\Functions\PrintfHelper - exceptionTypeResolver: class: PHPStan\Rules\Exceptions\ExceptionTypeResolver factory: @PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver diff --git a/src/DependencyInjection/AutowiredAttributeServicesExtension.php b/src/DependencyInjection/AutowiredAttributeServicesExtension.php index cdc63fc012..0762f02836 100644 --- a/src/DependencyInjection/AutowiredAttributeServicesExtension.php +++ b/src/DependencyInjection/AutowiredAttributeServicesExtension.php @@ -4,10 +4,50 @@ use Nette\DI\CompilerExtension; use olvlvl\ComposerAttributeCollector\Attributes; +use PHPStan\Analyser\ResultCache\ResultCacheMetaExtension; +use PHPStan\Analyser\TypeSpecifierFactory; use PHPStan\Broker\BrokerFactory; +use PHPStan\DependencyInjection\Type\LazyDynamicThrowTypeExtensionProvider; +use PHPStan\DependencyInjection\Type\LazyParameterClosureTypeExtensionProvider; +use PHPStan\DependencyInjection\Type\LazyParameterOutTypeExtensionProvider; +use PHPStan\PhpDoc\StubFilesExtension; +use PHPStan\PhpDoc\TypeNodeResolverExtension; +use PHPStan\Reflection\AllowedSubTypesClassReflectionExtension; +use PHPStan\Reflection\Deprecation\ClassConstantDeprecationExtension; +use PHPStan\Reflection\Deprecation\ClassDeprecationExtension; +use PHPStan\Reflection\Deprecation\EnumCaseDeprecationExtension; +use PHPStan\Reflection\Deprecation\FunctionDeprecationExtension; +use PHPStan\Reflection\Deprecation\MethodDeprecationExtension; +use PHPStan\Reflection\Deprecation\PropertyDeprecationExtension; +use PHPStan\Reflection\MethodsClassReflectionExtension; +use PHPStan\Reflection\PropertiesClassReflectionExtension; +use PHPStan\Rules\Constants\AlwaysUsedClassConstantsExtensionProvider; use PHPStan\Rules\LazyRegistry; +use PHPStan\Rules\Properties\ReadWritePropertiesExtension; +use PHPStan\Rules\Properties\ReadWritePropertiesExtensionProvider; +use PHPStan\Rules\RestrictedUsage\RestrictedClassConstantUsageExtension; +use PHPStan\Rules\RestrictedUsage\RestrictedClassNameUsageExtension; +use PHPStan\Rules\RestrictedUsage\RestrictedFunctionUsageExtension; +use PHPStan\Rules\RestrictedUsage\RestrictedMethodUsageExtension; +use PHPStan\Rules\RestrictedUsage\RestrictedPropertyUsageExtension; use PHPStan\Rules\Rule; use PHPStan\Type\DynamicFunctionReturnTypeExtension; +use PHPStan\Type\DynamicFunctionThrowTypeExtension; +use PHPStan\Type\DynamicMethodReturnTypeExtension; +use PHPStan\Type\DynamicMethodThrowTypeExtension; +use PHPStan\Type\DynamicStaticMethodReturnTypeExtension; +use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; +use PHPStan\Type\ExpressionTypeResolverExtension; +use PHPStan\Type\FunctionParameterClosureTypeExtension; +use PHPStan\Type\FunctionParameterOutTypeExtension; +use PHPStan\Type\FunctionTypeSpecifyingExtension; +use PHPStan\Type\MethodParameterClosureTypeExtension; +use PHPStan\Type\MethodParameterOutTypeExtension; +use PHPStan\Type\MethodTypeSpecifyingExtension; +use PHPStan\Type\OperatorTypeSpecifyingExtension; +use PHPStan\Type\StaticMethodParameterClosureTypeExtension; +use PHPStan\Type\StaticMethodParameterOutTypeExtension; +use PHPStan\Type\StaticMethodTypeSpecifyingExtension; use ReflectionClass; final class AutowiredAttributeServicesExtension extends CompilerExtension @@ -20,8 +60,44 @@ public function loadConfiguration(): void $builder = $this->getContainerBuilder(); $interfaceToTag = [ + PropertiesClassReflectionExtension::class => BrokerFactory::PROPERTIES_CLASS_REFLECTION_EXTENSION_TAG, + MethodsClassReflectionExtension::class => BrokerFactory::METHODS_CLASS_REFLECTION_EXTENSION_TAG, + AllowedSubTypesClassReflectionExtension::class => BrokerFactory::ALLOWED_SUB_TYPES_CLASS_REFLECTION_EXTENSION_TAG, + DynamicMethodReturnTypeExtension::class => BrokerFactory::DYNAMIC_METHOD_RETURN_TYPE_EXTENSION_TAG, + DynamicStaticMethodReturnTypeExtension::class => BrokerFactory::DYNAMIC_STATIC_METHOD_RETURN_TYPE_EXTENSION_TAG, DynamicFunctionReturnTypeExtension::class => BrokerFactory::DYNAMIC_FUNCTION_RETURN_TYPE_EXTENSION_TAG, + OperatorTypeSpecifyingExtension::class => BrokerFactory::OPERATOR_TYPE_SPECIFYING_EXTENSION_TAG, + ExpressionTypeResolverExtension::class => BrokerFactory::EXPRESSION_TYPE_RESOLVER_EXTENSION_TAG, + TypeNodeResolverExtension::class => TypeNodeResolverExtension::EXTENSION_TAG, Rule::class => LazyRegistry::RULE_TAG, + StubFilesExtension::class => StubFilesExtension::EXTENSION_TAG, + AlwaysUsedClassConstantsExtensionProvider::class => AlwaysUsedClassConstantsExtensionProvider::EXTENSION_TAG, + ReadWritePropertiesExtension::class => ReadWritePropertiesExtensionProvider::EXTENSION_TAG, + FunctionTypeSpecifyingExtension::class => TypeSpecifierFactory::FUNCTION_TYPE_SPECIFYING_EXTENSION_TAG, + MethodTypeSpecifyingExtension::class => TypeSpecifierFactory::METHOD_TYPE_SPECIFYING_EXTENSION_TAG, + StaticMethodTypeSpecifyingExtension::class => TypeSpecifierFactory::STATIC_METHOD_TYPE_SPECIFYING_EXTENSION_TAG, + DynamicFunctionThrowTypeExtension::class => LazyDynamicThrowTypeExtensionProvider::FUNCTION_TAG, + DynamicMethodThrowTypeExtension::class => LazyDynamicThrowTypeExtensionProvider::METHOD_TAG, + DynamicStaticMethodThrowTypeExtension::class => LazyDynamicThrowTypeExtensionProvider::STATIC_METHOD_TAG, + FunctionParameterClosureTypeExtension::class => LazyParameterClosureTypeExtensionProvider::FUNCTION_TAG, + MethodParameterClosureTypeExtension::class => LazyParameterClosureTypeExtensionProvider::METHOD_TAG, + StaticMethodParameterClosureTypeExtension::class => LazyParameterClosureTypeExtensionProvider::STATIC_METHOD_TAG, + FunctionParameterOutTypeExtension::class => LazyParameterOutTypeExtensionProvider::FUNCTION_TAG, + MethodParameterOutTypeExtension::class => LazyParameterOutTypeExtensionProvider::METHOD_TAG, + StaticMethodParameterOutTypeExtension::class => LazyParameterOutTypeExtensionProvider::STATIC_METHOD_TAG, + ResultCacheMetaExtension::class => ResultCacheMetaExtension::EXTENSION_TAG, + ClassConstantDeprecationExtension::class => ClassConstantDeprecationExtension::CLASS_CONSTANT_EXTENSION_TAG, + ClassDeprecationExtension::class => ClassDeprecationExtension::CLASS_EXTENSION_TAG, + EnumCaseDeprecationExtension::class => EnumCaseDeprecationExtension::ENUM_CASE_EXTENSION_TAG, + FunctionDeprecationExtension::class => FunctionDeprecationExtension::FUNCTION_EXTENSION_TAG, + MethodDeprecationExtension::class => MethodDeprecationExtension::METHOD_EXTENSION_TAG, + PropertyDeprecationExtension::class => PropertyDeprecationExtension::PROPERTY_EXTENSION_TAG, + RestrictedMethodUsageExtension::class => RestrictedMethodUsageExtension::METHOD_EXTENSION_TAG, + RestrictedClassNameUsageExtension::class => RestrictedClassNameUsageExtension::CLASS_NAME_EXTENSION_TAG, + RestrictedFunctionUsageExtension::class => RestrictedFunctionUsageExtension::FUNCTION_EXTENSION_TAG, + RestrictedPropertyUsageExtension::class => RestrictedPropertyUsageExtension::PROPERTY_EXTENSION_TAG, + RestrictedClassConstantUsageExtension::class => RestrictedClassConstantUsageExtension::CLASS_CONSTANT_EXTENSION_TAG, + ]; foreach ($autowiredServiceClasses as $class) { diff --git a/src/PhpDoc/SocketSelectStubFilesExtension.php b/src/PhpDoc/SocketSelectStubFilesExtension.php index c5d60ea909..cd954ca6b0 100644 --- a/src/PhpDoc/SocketSelectStubFilesExtension.php +++ b/src/PhpDoc/SocketSelectStubFilesExtension.php @@ -2,8 +2,10 @@ namespace PHPStan\PhpDoc; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; +#[AutowiredService] final class SocketSelectStubFilesExtension implements StubFilesExtension { diff --git a/src/Reflection/BetterReflection/Type/AdapterReflectionEnumDynamicReturnTypeExtension.php b/src/Reflection/BetterReflection/Type/AdapterReflectionEnumDynamicReturnTypeExtension.php index dfa3218442..2d3920e771 100644 --- a/src/Reflection/BetterReflection/Type/AdapterReflectionEnumDynamicReturnTypeExtension.php +++ b/src/Reflection/BetterReflection/Type/AdapterReflectionEnumDynamicReturnTypeExtension.php @@ -8,6 +8,7 @@ use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClassConstant; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\Accessory\AccessoryNonEmptyStringType; @@ -22,6 +23,7 @@ use PHPStan\Type\UnionType; use function in_array; +#[AutowiredService] final class AdapterReflectionEnumDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { diff --git a/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php b/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php index 04f4fbe8e7..d36306a1b5 100644 --- a/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php +++ b/src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php @@ -2,11 +2,13 @@ namespace PHPStan\Reflection\Php; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\AllowedSubTypesClassReflectionExtension; use PHPStan\Reflection\ClassReflection; use PHPStan\Type\Enum\EnumCaseObjectType; use function array_keys; +#[AutowiredService] final class EnumAllowedSubTypesClassReflectionExtension implements AllowedSubTypesClassReflectionExtension { diff --git a/src/Rules/Functions/PrintfHelper.php b/src/Rules/Functions/PrintfHelper.php index a5d4571f76..7f68f17fa4 100644 --- a/src/Rules/Functions/PrintfHelper.php +++ b/src/Rules/Functions/PrintfHelper.php @@ -3,6 +3,7 @@ namespace PHPStan\Rules\Functions; use Nette\Utils\Strings; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use function array_filter; use function count; @@ -11,6 +12,7 @@ use function strlen; use const PREG_SET_ORDER; +#[AutowiredService] final class PrintfHelper { diff --git a/src/Type/Constant/OversizedArrayBuilder.php b/src/Type/Constant/OversizedArrayBuilder.php index 026e305361..530fe86046 100644 --- a/src/Type/Constant/OversizedArrayBuilder.php +++ b/src/Type/Constant/OversizedArrayBuilder.php @@ -5,6 +5,7 @@ use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\Expr\TypeExpr; use PHPStan\ShouldNotHappenException; use PHPStan\Type\Accessory\AccessoryArrayListType; @@ -19,6 +20,7 @@ use function array_values; use function count; +#[AutowiredService] final class OversizedArrayBuilder { diff --git a/src/Type/PHPStan/ClassNameUsageLocationCreateIdentifierDynamicReturnTypeExtension.php b/src/Type/PHPStan/ClassNameUsageLocationCreateIdentifierDynamicReturnTypeExtension.php index 0b847b8ca6..c15f13bf24 100644 --- a/src/Type/PHPStan/ClassNameUsageLocationCreateIdentifierDynamicReturnTypeExtension.php +++ b/src/Type/PHPStan/ClassNameUsageLocationCreateIdentifierDynamicReturnTypeExtension.php @@ -5,6 +5,7 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\PropertyFetch; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Rules\ClassNameUsageLocation; use PHPStan\Type\DynamicMethodReturnTypeExtension; @@ -14,6 +15,7 @@ use function count; use function sort; +#[AutowiredService] final class ClassNameUsageLocationCreateIdentifierDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { diff --git a/src/Type/Php/AssertThrowTypeExtension.php b/src/Type/Php/AssertThrowTypeExtension.php index 2cf4226047..b30bab71cc 100644 --- a/src/Type/Php/AssertThrowTypeExtension.php +++ b/src/Type/Php/AssertThrowTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\FuncCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\DynamicFunctionThrowTypeExtension; use PHPStan\Type\ObjectType; @@ -11,6 +12,7 @@ use Throwable; use function count; +#[AutowiredService] final class AssertThrowTypeExtension implements DynamicFunctionThrowTypeExtension { diff --git a/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php b/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php index c80bb0950b..5ee4ab5cf0 100644 --- a/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php +++ b/src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php @@ -5,6 +5,7 @@ use BackedEnum; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicStaticMethodReturnTypeExtension; use PHPStan\Type\Enum\EnumCaseObjectType; @@ -14,6 +15,7 @@ use function count; use function in_array; +#[AutowiredService] final class BackedEnumFromMethodDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { diff --git a/src/Type/Php/BcMathNumberOperatorTypeSpecifyingExtension.php b/src/Type/Php/BcMathNumberOperatorTypeSpecifyingExtension.php index 3e0d793052..c75ebd2056 100644 --- a/src/Type/Php/BcMathNumberOperatorTypeSpecifyingExtension.php +++ b/src/Type/Php/BcMathNumberOperatorTypeSpecifyingExtension.php @@ -2,6 +2,7 @@ namespace PHPStan\Type\Php; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Type\ErrorType; use PHPStan\Type\NeverType; @@ -10,6 +11,7 @@ use PHPStan\Type\Type; use function in_array; +#[AutowiredService] final class BcMathNumberOperatorTypeSpecifyingExtension implements OperatorTypeSpecifyingExtension { diff --git a/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php b/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php index e20c503c05..bcdf1032c7 100644 --- a/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php +++ b/src/Type/Php/DatePeriodConstructorReturnTypeExtension.php @@ -8,6 +8,7 @@ use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Name; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicStaticMethodReturnTypeExtension; use PHPStan\Type\Generic\GenericObjectType; @@ -17,6 +18,7 @@ use PHPStan\Type\Type; use function strtolower; +#[AutowiredService] final class DatePeriodConstructorReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { diff --git a/src/Type/Php/OpenSslEncryptParameterOutTypeExtension.php b/src/Type/Php/OpenSslEncryptParameterOutTypeExtension.php index 5d24f86f52..6784622a2a 100644 --- a/src/Type/Php/OpenSslEncryptParameterOutTypeExtension.php +++ b/src/Type/Php/OpenSslEncryptParameterOutTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\FuncCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\ParameterReflection; use PHPStan\Type\Accessory\AccessoryNonEmptyStringType; @@ -17,6 +18,7 @@ use function strtolower; use function substr; +#[AutowiredService] final class OpenSslEncryptParameterOutTypeExtension implements FunctionParameterOutTypeExtension { diff --git a/src/Type/Php/PregReplaceCallbackClosureTypeExtension.php b/src/Type/Php/PregReplaceCallbackClosureTypeExtension.php index a7ea4dc133..1be24ff645 100644 --- a/src/Type/Php/PregReplaceCallbackClosureTypeExtension.php +++ b/src/Type/Php/PregReplaceCallbackClosureTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\FuncCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\Native\NativeParameterReflection; use PHPStan\Reflection\ParameterReflection; @@ -13,6 +14,7 @@ use PHPStan\Type\StringType; use PHPStan\Type\Type; +#[AutowiredService] final class PregReplaceCallbackClosureTypeExtension implements FunctionParameterClosureTypeExtension { diff --git a/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php b/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php index a0f33f1841..e308b37687 100644 --- a/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php +++ b/src/Type/Php/SimpleXMLElementAsXMLMethodReturnTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\BooleanType; use PHPStan\Type\Constant\ConstantBooleanType; @@ -14,6 +15,7 @@ use SimpleXMLElement; use function count; +#[AutowiredService] final class SimpleXMLElementAsXMLMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { diff --git a/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php b/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php index c670914835..1bf6d9854b 100644 --- a/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php +++ b/src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php @@ -2,6 +2,7 @@ namespace PHPStan\Type\Php; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\Php\SimpleXMLElementProperty; use PHPStan\Reflection\PropertiesClassReflectionExtension; @@ -10,6 +11,7 @@ use PHPStan\Type\NullType; use PHPStan\Type\ObjectType; +#[AutowiredService] final class SimpleXMLElementClassPropertyReflectionExtension implements PropertiesClassReflectionExtension { diff --git a/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php b/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php index 7255d64887..84dc243c24 100644 --- a/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php +++ b/src/Type/Php/SimpleXMLElementXpathMethodReturnTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\ArrayType; use PHPStan\Type\DynamicMethodReturnTypeExtension; @@ -14,6 +15,7 @@ use SimpleXMLElement; use function extension_loaded; +#[AutowiredService] final class SimpleXMLElementXpathMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { From d8279ff20649c3fd221b78dcf64cd6c02ec28666 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 15:24:32 +0200 Subject: [PATCH 2/9] autowire --- conf/config.neon | 40 ------------------- .../ReflectionSourceStubberFactory.php | 2 + .../Deprecation/DeprecationProvider.php | 2 + ...peDigitFunctionTypeSpecifyingExtension.php | 2 + .../IsAFunctionTypeSpecifyingExtension.php | 2 + .../Php/IsAFunctionTypeSpecifyingHelper.php | 2 + ...allableFunctionTypeSpecifyingExtension.php | 2 + ...terableFunctionTypeSpecifyingExtension.php | 2 + ...classOfFunctionTypeSpecifyingExtension.php | 2 + .../Php/XMLReaderOpenReturnTypeExtension.php | 2 + 10 files changed, 18 insertions(+), 40 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index 97da7ba6fb..f42b5f0f1a 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -1369,34 +1369,6 @@ services: tags: - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - class: PHPStan\Type\Php\IsCallableFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\IsIterableFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\IsSubclassOfFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\IsAFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\IsAFunctionTypeSpecifyingHelper - - - - class: PHPStan\Type\Php\CtypeDigitFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - class: PHPStan\Type\Php\TypeSpecifyingFunctionsDynamicReturnTypeExtension arguments: @@ -1415,12 +1387,6 @@ services: tags: - phpstan.broker.dynamicFunctionReturnTypeExtension - - - class: PHPStan\Type\Php\XMLReaderOpenReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - phpstan.broker.dynamicStaticMethodReturnTypeExtension - - class: PHPStan\Type\Php\ReflectionGetAttributesMethodReturnTypeExtension arguments: @@ -1628,12 +1594,6 @@ services: autowired: - PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber - - - class: PHPStan\Reflection\BetterReflection\SourceStubber\ReflectionSourceStubberFactory - - - - class: PHPStan\Reflection\Deprecation\DeprecationProvider - php8Lexer: class: PhpParser\Lexer\Emulative factory: @PHPStan\Parser\LexerFactory::createEmulative() diff --git a/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php b/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php index 8f7533ba5f..0a1f1e9e6a 100644 --- a/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php +++ b/src/Reflection/BetterReflection/SourceStubber/ReflectionSourceStubberFactory.php @@ -3,9 +3,11 @@ namespace PHPStan\Reflection\BetterReflection\SourceStubber; use PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\Printer\Printer; use PHPStan\Php\PhpVersion; +#[AutowiredService] final class ReflectionSourceStubberFactory { diff --git a/src/Reflection/Deprecation/DeprecationProvider.php b/src/Reflection/Deprecation/DeprecationProvider.php index 9c526121e9..ebd25cde0d 100644 --- a/src/Reflection/Deprecation/DeprecationProvider.php +++ b/src/Reflection/Deprecation/DeprecationProvider.php @@ -11,8 +11,10 @@ use PHPStan\BetterReflection\Reflection\Adapter\ReflectionMethod; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionProperty; use PHPStan\BetterReflection\Reflection\ReflectionConstant; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\DependencyInjection\Container; +#[AutowiredService] final class DeprecationProvider { diff --git a/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php b/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php index 837c3fb890..04daf2ed55 100644 --- a/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/CtypeDigitFunctionTypeSpecifyingExtension.php @@ -9,6 +9,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\ShouldNotHappenException; use PHPStan\Type\Accessory\AccessoryNumericStringType; @@ -21,6 +22,7 @@ use PHPStan\Type\UnionType; use function strtolower; +#[AutowiredService] final class CtypeDigitFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php index bc4591b9a8..5d19e4950f 100644 --- a/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsAFunctionTypeSpecifyingExtension.php @@ -8,6 +8,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\Constant\ConstantStringType; @@ -15,6 +16,7 @@ use function count; use function strtolower; +#[AutowiredService] final class IsAFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/IsAFunctionTypeSpecifyingHelper.php b/src/Type/Php/IsAFunctionTypeSpecifyingHelper.php index d1f4a1bd82..df33262d8d 100644 --- a/src/Type/Php/IsAFunctionTypeSpecifyingHelper.php +++ b/src/Type/Php/IsAFunctionTypeSpecifyingHelper.php @@ -2,6 +2,7 @@ namespace PHPStan\Type\Php; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Type\ClassStringType; use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\Generic\GenericClassStringType; @@ -16,6 +17,7 @@ use function array_unique; use function array_values; +#[AutowiredService] final class IsAFunctionTypeSpecifyingHelper { diff --git a/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php index 42c5fe8505..a0cde666e5 100644 --- a/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php @@ -11,6 +11,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\ShouldNotHappenException; use PHPStan\Type\CallableType; @@ -18,6 +19,7 @@ use function count; use function strtolower; +#[AutowiredService] final class IsCallableFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php index a8404ef99f..475f9a83cb 100644 --- a/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsIterableFunctionTypeSpecifyingExtension.php @@ -8,6 +8,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\ShouldNotHappenException; use PHPStan\Type\FunctionTypeSpecifyingExtension; @@ -15,6 +16,7 @@ use PHPStan\Type\MixedType; use function strtolower; +#[AutowiredService] final class IsIterableFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php index c62a11b150..e910bd5ea1 100644 --- a/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsSubclassOfFunctionTypeSpecifyingExtension.php @@ -8,6 +8,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\FunctionTypeSpecifyingExtension; @@ -15,6 +16,7 @@ use function count; use function strtolower; +#[AutowiredService] final class IsSubclassOfFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/XMLReaderOpenReturnTypeExtension.php b/src/Type/Php/XMLReaderOpenReturnTypeExtension.php index 26551ff830..e5283ba68e 100644 --- a/src/Type/Php/XMLReaderOpenReturnTypeExtension.php +++ b/src/Type/Php/XMLReaderOpenReturnTypeExtension.php @@ -5,6 +5,7 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\BooleanType; use PHPStan\Type\Constant\ConstantBooleanType; @@ -14,6 +15,7 @@ use PHPStan\Type\Type; use PHPStan\Type\UnionType; +#[AutowiredService] final class XMLReaderOpenReturnTypeExtension implements DynamicMethodReturnTypeExtension, DynamicStaticMethodReturnTypeExtension { From dfbffe5bd8c406a21ffc696afd8bccb42c6c8622 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 15:28:03 +0200 Subject: [PATCH 3/9] more autowire --- conf/config.neon | 40 ------------------- .../AssertFunctionTypeSpecifyingExtension.php | 2 + ...sExistsFunctionTypeSpecifyingExtension.php | 2 + .../DefineConstantTypeSpecifyingExtension.php | 2 + ...DefinedConstantTypeSpecifyingExtension.php | 2 + ...nExistsFunctionTypeSpecifyingExtension.php | 2 + ...InArrayFunctionTypeSpecifyingExtension.php | 2 + ...IsArrayFunctionTypeSpecifyingExtension.php | 2 + src/Type/Php/ThrowableReturnTypeExtension.php | 2 + 9 files changed, 16 insertions(+), 40 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index f42b5f0f1a..03b8c345f5 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -1322,11 +1322,6 @@ services: tags: - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - class: PHPStan\Type\Php\ThrowableReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - class: PHPStan\Type\Php\VersionCompareFunctionDynamicReturnTypeExtension arguments: @@ -1334,41 +1329,6 @@ services: tags: - phpstan.broker.dynamicFunctionReturnTypeExtension - - - class: PHPStan\Type\Php\AssertFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\ClassExistsFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\DefineConstantTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\DefinedConstantTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\FunctionExistsFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\InArrayFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\IsArrayFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - class: PHPStan\Type\Php\TypeSpecifyingFunctionsDynamicReturnTypeExtension arguments: diff --git a/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php b/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php index d1458a27dd..adc436e584 100644 --- a/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/AssertFunctionTypeSpecifyingExtension.php @@ -8,9 +8,11 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\FunctionTypeSpecifyingExtension; +#[AutowiredService] final class AssertFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php b/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php index e10e74a53e..53cec9a0e6 100644 --- a/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/ClassExistsFunctionTypeSpecifyingExtension.php @@ -11,6 +11,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\ClassStringType; use PHPStan\Type\Constant\ConstantBooleanType; @@ -21,6 +22,7 @@ use function in_array; use function ltrim; +#[AutowiredService] final class ClassExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/DefineConstantTypeSpecifyingExtension.php b/src/Type/Php/DefineConstantTypeSpecifyingExtension.php index 9d4ac3d682..7364ff54e9 100644 --- a/src/Type/Php/DefineConstantTypeSpecifyingExtension.php +++ b/src/Type/Php/DefineConstantTypeSpecifyingExtension.php @@ -9,11 +9,13 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\FunctionTypeSpecifyingExtension; use function count; +#[AutowiredService] final class DefineConstantTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php b/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php index 01c310459b..df0fe21f2b 100644 --- a/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php +++ b/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php @@ -8,12 +8,14 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\FunctionTypeSpecifyingExtension; use PHPStan\Type\MixedType; use function count; +#[AutowiredService] final class DefinedConstantTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php b/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php index 5d320104a7..330735d9e4 100644 --- a/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php @@ -11,6 +11,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\CallableType; use PHPStan\Type\Constant\ConstantBooleanType; @@ -18,6 +19,7 @@ use PHPStan\Type\FunctionTypeSpecifyingExtension; use function ltrim; +#[AutowiredService] final class FunctionExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php b/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php index d83e9f78ad..c26d550049 100644 --- a/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php @@ -11,6 +11,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\Expr\AlwaysRememberedExpr; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Accessory\NonEmptyArrayType; @@ -21,6 +22,7 @@ use function count; use function strtolower; +#[AutowiredService] final class InArrayFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php index e31033185e..0beb301d46 100644 --- a/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php @@ -8,6 +8,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\ShouldNotHappenException; use PHPStan\Type\ArrayType; @@ -15,6 +16,7 @@ use PHPStan\Type\MixedType; use function strtolower; +#[AutowiredService] final class IsArrayFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/ThrowableReturnTypeExtension.php b/src/Type/Php/ThrowableReturnTypeExtension.php index 9437b82485..af236b4f2d 100644 --- a/src/Type/Php/ThrowableReturnTypeExtension.php +++ b/src/Type/Php/ThrowableReturnTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\BenevolentUnionType; use PHPStan\Type\DynamicMethodReturnTypeExtension; @@ -18,6 +19,7 @@ use function in_array; use function strtolower; +#[AutowiredService] final class ThrowableReturnTypeExtension implements DynamicMethodReturnTypeExtension { From c14dee12b475b1a07561fafadaa79df8f0431458 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 15:29:49 +0200 Subject: [PATCH 4/9] more autowire --- conf/config.neon | 36 ------------------- .../MethodExistsTypeSpecifyingExtension.php | 2 ++ .../PropertyExistsTypeSpecifyingExtension.php | 2 ++ ...assIsSubclassOfTypeSpecifyingExtension.php | 2 ++ ...SetTypeFunctionTypeSpecifyingExtension.php | 2 ++ ...MLElementConstructorThrowTypeExtension.php | 2 ++ .../Php/StatDynamicReturnTypeExtension.php | 2 ++ .../StrContainingTypeSpecifyingExtension.php | 2 ++ 8 files changed, 14 insertions(+), 36 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index 03b8c345f5..39a1a874c4 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -1286,42 +1286,6 @@ services: tags: - phpstan.dynamicStaticMethodThrowTypeExtension - - - class: PHPStan\Type\Php\StrContainingTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\SimpleXMLElementConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\StatDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicFunctionReturnTypeExtension - - phpstan.broker.dynamicMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\MethodExistsTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\PropertyExistsTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\ReflectionClassIsSubclassOfTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.methodTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\SetTypeFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - class: PHPStan\Type\Php\VersionCompareFunctionDynamicReturnTypeExtension arguments: diff --git a/src/Type/Php/MethodExistsTypeSpecifyingExtension.php b/src/Type/Php/MethodExistsTypeSpecifyingExtension.php index 751a69a41a..3db54618e5 100644 --- a/src/Type/Php/MethodExistsTypeSpecifyingExtension.php +++ b/src/Type/Php/MethodExistsTypeSpecifyingExtension.php @@ -9,6 +9,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Accessory\HasMethodType; use PHPStan\Type\ClassStringType; @@ -20,6 +21,7 @@ use PHPStan\Type\UnionType; use function count; +#[AutowiredService] final class MethodExistsTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php b/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php index 8b4d51142a..e62a04d409 100644 --- a/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php +++ b/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php @@ -11,6 +11,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Rules\Properties\PropertyReflectionFinder; use PHPStan\Type\Accessory\HasPropertyType; @@ -21,6 +22,7 @@ use PHPStan\Type\ObjectWithoutClassType; use function count; +#[AutowiredService] final class PropertyExistsTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php b/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php index f472eab562..2d830e1501 100644 --- a/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php +++ b/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php @@ -8,6 +8,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\Generic\GenericObjectType; use PHPStan\Type\MethodTypeSpecifyingExtension; @@ -15,6 +16,7 @@ use PHPStan\Type\TypeCombinator; use ReflectionClass; +#[AutowiredService] final class ReflectionClassIsSubclassOfTypeSpecifyingExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php b/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php index a9134026ea..32373fcf7a 100644 --- a/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php @@ -8,6 +8,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\ErrorType; use PHPStan\Type\FunctionTypeSpecifyingExtension; @@ -18,6 +19,7 @@ use function count; use function strtolower; +#[AutowiredService] final class SetTypeFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php b/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php index 28995db8ea..78faf2d1d3 100644 --- a/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php +++ b/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; use PHPStan\Type\NeverType; @@ -14,6 +15,7 @@ use function extension_loaded; use function libxml_use_internal_errors; +#[AutowiredService] final class SimpleXMLElementConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/StatDynamicReturnTypeExtension.php b/src/Type/Php/StatDynamicReturnTypeExtension.php index 4a0141b106..b4dcd8bb7e 100644 --- a/src/Type/Php/StatDynamicReturnTypeExtension.php +++ b/src/Type/Php/StatDynamicReturnTypeExtension.php @@ -5,6 +5,7 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\Constant\ConstantArrayTypeBuilder; @@ -18,6 +19,7 @@ use SplFileObject; use function in_array; +#[AutowiredService] final class StatDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension, DynamicMethodReturnTypeExtension { diff --git a/src/Type/Php/StrContainingTypeSpecifyingExtension.php b/src/Type/Php/StrContainingTypeSpecifyingExtension.php index 655e77ddd3..2e24c9dcbd 100644 --- a/src/Type/Php/StrContainingTypeSpecifyingExtension.php +++ b/src/Type/Php/StrContainingTypeSpecifyingExtension.php @@ -13,6 +13,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Accessory\AccessoryLiteralStringType; use PHPStan\Type\Accessory\AccessoryNonEmptyStringType; @@ -25,6 +26,7 @@ use function count; use function strtolower; +#[AutowiredService] final class StrContainingTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { From 5f316aa03d5ea686a5d94e590f034d3164409b11 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 15:32:45 +0200 Subject: [PATCH 5/9] more autowire --- conf/config.neon | 54 ------------------- src/Type/Php/JsonThrowTypeExtension.php | 2 + .../Php/ParseStrParameterOutTypeExtension.php | 2 + .../PregMatchParameterOutTypeExtension.php | 2 + .../Php/PregMatchTypeSpecifyingExtension.php | 2 + ...tionClassConstructorThrowTypeExtension.php | 2 + ...nFunctionConstructorThrowTypeExtension.php | 2 + ...ionMethodConstructorThrowTypeExtension.php | 2 + ...nPropertyConstructorThrowTypeExtension.php | 2 + src/Type/Php/RegexArrayShapeMatcher.php | 2 + src/Type/Regex/RegexExpressionHelper.php | 2 + src/Type/Regex/RegexGroupParser.php | 2 + 12 files changed, 22 insertions(+), 54 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index 39a1a874c4..1971c08dc4 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -1232,60 +1232,6 @@ services: tags: - phpstan.dynamicFunctionThrowTypeExtension - - - class: PHPStan\Type\Php\JsonThrowTypeExtension - tags: - - phpstan.dynamicFunctionThrowTypeExtension - - - - class: PHPStan\Type\Php\ParseStrParameterOutTypeExtension - tags: - - phpstan.functionParameterOutTypeExtension - - - - class: PHPStan\Type\Php\PregMatchTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\PregMatchParameterOutTypeExtension - tags: - - phpstan.functionParameterOutTypeExtension - - - - class: PHPStan\Type\Php\PregReplaceCallbackClosureTypeExtension - tags: - - phpstan.functionParameterClosureTypeExtension - - - - class: PHPStan\Type\Php\RegexArrayShapeMatcher - - - - class: PHPStan\Type\Regex\RegexGroupParser - - - - class: PHPStan\Type\Regex\RegexExpressionHelper - - - - class: PHPStan\Type\Php\ReflectionClassConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\ReflectionFunctionConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\ReflectionMethodConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\ReflectionPropertyConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - class: PHPStan\Type\Php\VersionCompareFunctionDynamicReturnTypeExtension arguments: diff --git a/src/Type/Php/JsonThrowTypeExtension.php b/src/Type/Php/JsonThrowTypeExtension.php index 68e7855bb7..19cfcbaaea 100644 --- a/src/Type/Php/JsonThrowTypeExtension.php +++ b/src/Type/Php/JsonThrowTypeExtension.php @@ -5,6 +5,7 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\BitwiseFlagHelper; @@ -13,6 +14,7 @@ use PHPStan\Type\Type; use function in_array; +#[AutowiredService] final class JsonThrowTypeExtension implements DynamicFunctionThrowTypeExtension { diff --git a/src/Type/Php/ParseStrParameterOutTypeExtension.php b/src/Type/Php/ParseStrParameterOutTypeExtension.php index caabc319bf..8e4a2de7d1 100644 --- a/src/Type/Php/ParseStrParameterOutTypeExtension.php +++ b/src/Type/Php/ParseStrParameterOutTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\FuncCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\ParameterReflection; use PHPStan\Type\Accessory\AccessoryLowercaseStringType; @@ -20,6 +21,7 @@ use function in_array; use function strtolower; +#[AutowiredService] final class ParseStrParameterOutTypeExtension implements FunctionParameterOutTypeExtension { diff --git a/src/Type/Php/PregMatchParameterOutTypeExtension.php b/src/Type/Php/PregMatchParameterOutTypeExtension.php index 9066351d9f..b8bd415b45 100644 --- a/src/Type/Php/PregMatchParameterOutTypeExtension.php +++ b/src/Type/Php/PregMatchParameterOutTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\FuncCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\ParameterReflection; use PHPStan\TrinaryLogic; @@ -12,6 +13,7 @@ use function in_array; use function strtolower; +#[AutowiredService] final class PregMatchParameterOutTypeExtension implements FunctionParameterOutTypeExtension { diff --git a/src/Type/Php/PregMatchTypeSpecifyingExtension.php b/src/Type/Php/PregMatchTypeSpecifyingExtension.php index 09606087f1..dca332f50e 100644 --- a/src/Type/Php/PregMatchTypeSpecifyingExtension.php +++ b/src/Type/Php/PregMatchTypeSpecifyingExtension.php @@ -8,12 +8,14 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\TrinaryLogic; use PHPStan\Type\FunctionTypeSpecifyingExtension; use function in_array; use function strtolower; +#[AutowiredService] final class PregMatchTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php index 487857213d..94f0d95379 100644 --- a/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\ClassStringType; use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; @@ -13,6 +14,7 @@ use ReflectionClass; use function count; +#[AutowiredService] final class ReflectionClassConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php index 83df24904f..01fe08f354 100644 --- a/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php @@ -5,6 +5,7 @@ use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Name; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; @@ -14,6 +15,7 @@ use ReflectionFunction; use function count; +#[AutowiredService] final class ReflectionFunctionConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php index c0b0df2cf5..a2371b6434 100644 --- a/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\Constant\ConstantStringType; @@ -16,6 +17,7 @@ use ReflectionMethod; use function count; +#[AutowiredService] final class ReflectionMethodConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php index b988a7883a..22140eba68 100644 --- a/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php +++ b/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; @@ -13,6 +14,7 @@ use ReflectionProperty; use function count; +#[AutowiredService] final class ReflectionPropertyConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/RegexArrayShapeMatcher.php b/src/Type/Php/RegexArrayShapeMatcher.php index a23e3445d8..11c3087222 100644 --- a/src/Type/Php/RegexArrayShapeMatcher.php +++ b/src/Type/Php/RegexArrayShapeMatcher.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\TrinaryLogic; use PHPStan\Type\Accessory\AccessoryArrayListType; @@ -32,6 +33,7 @@ /** * @api */ +#[AutowiredService] final class RegexArrayShapeMatcher { diff --git a/src/Type/Regex/RegexExpressionHelper.php b/src/Type/Regex/RegexExpressionHelper.php index 0df0dc011c..0dd32830cd 100644 --- a/src/Type/Regex/RegexExpressionHelper.php +++ b/src/Type/Regex/RegexExpressionHelper.php @@ -6,6 +6,7 @@ use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Name; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\InitializerExprTypeResolver; use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\Type; @@ -15,6 +16,7 @@ use function strrpos; use function substr; +#[AutowiredService] final class RegexExpressionHelper { diff --git a/src/Type/Regex/RegexGroupParser.php b/src/Type/Regex/RegexGroupParser.php index 2f90e08c22..5a99743a18 100644 --- a/src/Type/Regex/RegexGroupParser.php +++ b/src/Type/Regex/RegexGroupParser.php @@ -9,6 +9,7 @@ use Hoa\File\Read; use Nette\Utils\RegexpException; use Nette\Utils\Strings; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\ShouldNotHappenException; use PHPStan\TrinaryLogic; @@ -33,6 +34,7 @@ use function substr; use function trim; +#[AutowiredService] final class RegexGroupParser { From b418b81c6497e7f3c8f74b807dc6b42575dfcc20 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 15:35:29 +0200 Subject: [PATCH 6/9] more autowire --- conf/config.neon | 35 ------------------- .../DateTimeConstructorThrowTypeExtension.php | 2 ++ ...DateTimeModifyMethodThrowTypeExtension.php | 2 ++ .../DateTimeSubMethodThrowTypeExtension.php | 2 ++ ...eTimeZoneConstructorThrowTypeExtension.php | 2 ++ .../DsMapDynamicMethodThrowTypeExtension.php | 2 ++ .../Php/DsMapDynamicReturnTypeExtension.php | 2 ++ src/Type/Php/IntdivThrowTypeExtension.php | 2 ++ 8 files changed, 14 insertions(+), 35 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index 1971c08dc4..a24016d02c 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -1197,41 +1197,6 @@ services: arguments: dateTimeClass: DateTimeImmutable - - - class: PHPStan\Type\Php\DateTimeConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\DateTimeModifyMethodThrowTypeExtension - tags: - - phpstan.dynamicMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\DateTimeSubMethodThrowTypeExtension - tags: - - phpstan.dynamicMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\DateTimeZoneConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\DsMapDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\DsMapDynamicMethodThrowTypeExtension - tags: - - phpstan.dynamicMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\IntdivThrowTypeExtension - tags: - - phpstan.dynamicFunctionThrowTypeExtension - - class: PHPStan\Type\Php\VersionCompareFunctionDynamicReturnTypeExtension arguments: diff --git a/src/Type/Php/DateTimeConstructorThrowTypeExtension.php b/src/Type/Php/DateTimeConstructorThrowTypeExtension.php index 6bde75bc6d..2facd03945 100644 --- a/src/Type/Php/DateTimeConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateTimeConstructorThrowTypeExtension.php @@ -6,6 +6,7 @@ use DateTimeImmutable; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; @@ -16,6 +17,7 @@ use function count; use function in_array; +#[AutowiredService] final class DateTimeConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php b/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php index d22637d4e5..02c0099c4e 100644 --- a/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php +++ b/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php @@ -6,6 +6,7 @@ use DateTimeImmutable; use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicMethodThrowTypeExtension; @@ -16,6 +17,7 @@ use function count; use function in_array; +#[AutowiredService] final class DateTimeModifyMethodThrowTypeExtension implements DynamicMethodThrowTypeExtension { diff --git a/src/Type/Php/DateTimeSubMethodThrowTypeExtension.php b/src/Type/Php/DateTimeSubMethodThrowTypeExtension.php index ce6d31b581..fc92e2b91d 100644 --- a/src/Type/Php/DateTimeSubMethodThrowTypeExtension.php +++ b/src/Type/Php/DateTimeSubMethodThrowTypeExtension.php @@ -6,6 +6,7 @@ use DateTimeImmutable; use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicMethodThrowTypeExtension; @@ -14,6 +15,7 @@ use function count; use function in_array; +#[AutowiredService] final class DateTimeSubMethodThrowTypeExtension implements DynamicMethodThrowTypeExtension { diff --git a/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php b/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php index e1b35ac7ee..0c4c0bd9dd 100644 --- a/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php @@ -5,6 +5,7 @@ use DateTimeZone; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; @@ -14,6 +15,7 @@ use PHPStan\Type\TypeCombinator; use function count; +#[AutowiredService] final class DateTimeZoneConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/DsMapDynamicMethodThrowTypeExtension.php b/src/Type/Php/DsMapDynamicMethodThrowTypeExtension.php index 3075827a96..8d2ceddc98 100644 --- a/src/Type/Php/DsMapDynamicMethodThrowTypeExtension.php +++ b/src/Type/Php/DsMapDynamicMethodThrowTypeExtension.php @@ -4,12 +4,14 @@ use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicMethodThrowTypeExtension; use PHPStan\Type\Type; use PHPStan\Type\VoidType; use function count; +#[AutowiredService] final class DsMapDynamicMethodThrowTypeExtension implements DynamicMethodThrowTypeExtension { diff --git a/src/Type/Php/DsMapDynamicReturnTypeExtension.php b/src/Type/Php/DsMapDynamicReturnTypeExtension.php index 50ecba6226..6b833656d7 100644 --- a/src/Type/Php/DsMapDynamicReturnTypeExtension.php +++ b/src/Type/Php/DsMapDynamicReturnTypeExtension.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicMethodReturnTypeExtension; use PHPStan\Type\Type; @@ -11,6 +12,7 @@ use function count; use function in_array; +#[AutowiredService] final class DsMapDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { diff --git a/src/Type/Php/IntdivThrowTypeExtension.php b/src/Type/Php/IntdivThrowTypeExtension.php index 46920122a6..baab09248b 100644 --- a/src/Type/Php/IntdivThrowTypeExtension.php +++ b/src/Type/Php/IntdivThrowTypeExtension.php @@ -6,6 +6,7 @@ use DivisionByZeroError; use PhpParser\Node\Expr\FuncCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Constant\ConstantIntegerType; use PHPStan\Type\DynamicFunctionThrowTypeExtension; @@ -14,6 +15,7 @@ use function count; use const PHP_INT_MIN; +#[AutowiredService] final class IntdivThrowTypeExtension implements DynamicFunctionThrowTypeExtension { From 2908da65e5dac9ce7c48276ffaeea3e9688615a7 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 15:38:48 +0200 Subject: [PATCH 7/9] more autowire --- conf/config.neon | 73 ------------------- .../Properties/PropertyReflectionFinder.php | 2 + src/Rules/Pure/FunctionPurityCheck.php | 2 + .../TooWideParameterOutTypeCheck.php | 2 + src/Type/BitwiseFlagHelper.php | 2 + ...yExistsFunctionTypeSpecifyingExtension.php | 2 + ...ySearchFunctionTypeSpecifyingExtension.php | 2 + .../ClosureBindDynamicReturnTypeExtension.php | 2 + ...losureBindToDynamicReturnTypeExtension.php | 2 + ...FromCallableDynamicReturnTypeExtension.php | 2 + src/Type/Php/ConstantHelper.php | 2 + .../CountFunctionTypeSpecifyingExtension.php | 2 + .../DateFormatMethodReturnTypeExtension.php | 2 + src/Type/Php/DateFunctionReturnTypeHelper.php | 2 + ...eIntervalConstructorThrowTypeExtension.php | 2 + ...DateIntervalDynamicReturnTypeExtension.php | 2 + 16 files changed, 30 insertions(+), 73 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index a24016d02c..abdf0f6067 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -1066,12 +1066,6 @@ services: - class: PHPStan\Rules\Properties\PropertyDescriptor - - - class: PHPStan\Rules\Properties\PropertyReflectionFinder - - - - class: PHPStan\Rules\Pure\FunctionPurityCheck - - class: PHPStan\Rules\RuleLevelHelper arguments: @@ -1088,9 +1082,6 @@ services: arguments: reportExactLine: %featureToggles.reportPreciseLineForUnusedFunctionParameter% - - - class: PHPStan\Rules\TooWideTypehints\TooWideParameterOutTypeCheck - - class: PHPStan\Type\FileTypeMapper arguments: @@ -1112,9 +1103,6 @@ services: class: PHPStan\Type\TypeAliasResolverProvider factory: PHPStan\Type\LazyTypeAliasResolverProvider - - - class: PHPStan\Type\BitwiseFlagHelper - - class: PHPStan\Type\Php\CompactFunctionReturnTypeExtension tags: @@ -1122,67 +1110,6 @@ services: arguments: checkMaybeUndefinedVariables: %checkMaybeUndefinedVariables% - - - class: PHPStan\Type\Php\ConstantHelper - - - - class: PHPStan\Type\Php\DateFunctionReturnTypeHelper - - - - class: PHPStan\Type\Php\ArrayKeyExistsFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\AssertThrowTypeExtension - tags: - - phpstan.dynamicFunctionThrowTypeExtension - - - - class: PHPStan\Type\Php\ArraySearchFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\ClosureBindDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicStaticMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\CountFunctionTypeSpecifyingExtension - tags: - - phpstan.typeSpecifier.functionTypeSpecifyingExtension - - - - class: PHPStan\Type\Php\ClosureBindToDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\ClosureFromCallableDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicStaticMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\BackedEnumFromMethodDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicStaticMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\DateFormatMethodReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - - - class: PHPStan\Type\Php\DateIntervalConstructorThrowTypeExtension - tags: - - phpstan.dynamicStaticMethodThrowTypeExtension - - - - class: PHPStan\Type\Php\DateIntervalDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicStaticMethodReturnTypeExtension - - class: PHPStan\Type\Php\DateTimeModifyReturnTypeExtension tags: diff --git a/src/Rules/Properties/PropertyReflectionFinder.php b/src/Rules/Properties/PropertyReflectionFinder.php index 67b2785fa9..3daa5ee867 100644 --- a/src/Rules/Properties/PropertyReflectionFinder.php +++ b/src/Rules/Properties/PropertyReflectionFinder.php @@ -7,11 +7,13 @@ use PhpParser\Node\Scalar\String_; use PhpParser\Node\VarLikeIdentifier; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\Type; use function array_map; use function count; +#[AutowiredService] final class PropertyReflectionFinder { diff --git a/src/Rules/Pure/FunctionPurityCheck.php b/src/Rules/Pure/FunctionPurityCheck.php index a799cd4351..1e5f7a32d6 100644 --- a/src/Rules/Pure/FunctionPurityCheck.php +++ b/src/Rules/Pure/FunctionPurityCheck.php @@ -7,6 +7,7 @@ use PhpParser\Node\Stmt; use PHPStan\Analyser\ImpurePoint; use PHPStan\Analyser\ThrowPoint; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ExtendedMethodReflection; use PHPStan\Reflection\ExtendedParameterReflection; use PHPStan\Reflection\FunctionReflection; @@ -20,6 +21,7 @@ use function lcfirst; use function sprintf; +#[AutowiredService] final class FunctionPurityCheck { diff --git a/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php b/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php index e891b65fb6..47ff428789 100644 --- a/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php +++ b/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php @@ -4,6 +4,7 @@ use PhpParser\Node\Expr\Variable; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\ExecutionEndNode; use PHPStan\Node\ReturnStatement; use PHPStan\Reflection\ExtendedParameterReflection; @@ -14,6 +15,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; +#[AutowiredService] final class TooWideParameterOutTypeCheck { diff --git a/src/Type/BitwiseFlagHelper.php b/src/Type/BitwiseFlagHelper.php index 7d5e4c3db9..37e0a4a5cd 100644 --- a/src/Type/BitwiseFlagHelper.php +++ b/src/Type/BitwiseFlagHelper.php @@ -7,10 +7,12 @@ use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Name\FullyQualified; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ReflectionProvider; use PHPStan\TrinaryLogic; use PHPStan\Type\Constant\ConstantIntegerType; +#[AutowiredService] final class BitwiseFlagHelper { diff --git a/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php b/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php index 7d2eb3b2a4..af63cc047d 100644 --- a/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php @@ -12,6 +12,7 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Accessory\HasOffsetType; use PHPStan\Type\Accessory\NonEmptyArrayType; @@ -24,6 +25,7 @@ use function count; use function in_array; +#[AutowiredService] final class ArrayKeyExistsFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php b/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php index 68f2992096..38d8909e9b 100644 --- a/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/ArraySearchFunctionTypeSpecifyingExtension.php @@ -8,11 +8,13 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Accessory\NonEmptyArrayType; use PHPStan\Type\FunctionTypeSpecifyingExtension; use function strtolower; +#[AutowiredService] final class ArraySearchFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php b/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php index 719fd172d3..580595acd7 100644 --- a/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php +++ b/src/Type/Php/ClosureBindDynamicReturnTypeExtension.php @@ -5,11 +5,13 @@ use Closure; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\ClosureType; use PHPStan\Type\DynamicStaticMethodReturnTypeExtension; use PHPStan\Type\Type; +#[AutowiredService] final class ClosureBindDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { diff --git a/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php b/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php index 9e495b3163..3e275677e2 100644 --- a/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php +++ b/src/Type/Php/ClosureBindToDynamicReturnTypeExtension.php @@ -5,11 +5,13 @@ use Closure; use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\ClosureType; use PHPStan\Type\DynamicMethodReturnTypeExtension; use PHPStan\Type\Type; +#[AutowiredService] final class ClosureBindToDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { diff --git a/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php b/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php index d579157160..fd103b4f6a 100644 --- a/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php +++ b/src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php @@ -5,6 +5,7 @@ use Closure; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ExtendedParametersAcceptor; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\ClosureType; @@ -14,6 +15,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; +#[AutowiredService] final class ClosureFromCallableDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { diff --git a/src/Type/Php/ConstantHelper.php b/src/Type/Php/ConstantHelper.php index a3e8c5224f..16e55861bc 100644 --- a/src/Type/Php/ConstantHelper.php +++ b/src/Type/Php/ConstantHelper.php @@ -8,10 +8,12 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; +use PHPStan\DependencyInjection\AutowiredService; use function count; use function explode; use function ltrim; +#[AutowiredService] final class ConstantHelper { diff --git a/src/Type/Php/CountFunctionTypeSpecifyingExtension.php b/src/Type/Php/CountFunctionTypeSpecifyingExtension.php index b109b13f91..741c7cc880 100644 --- a/src/Type/Php/CountFunctionTypeSpecifyingExtension.php +++ b/src/Type/Php/CountFunctionTypeSpecifyingExtension.php @@ -8,12 +8,14 @@ use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierAwareExtension; use PHPStan\Analyser\TypeSpecifierContext; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\FunctionReflection; use PHPStan\Type\Accessory\NonEmptyArrayType; use PHPStan\Type\FunctionTypeSpecifyingExtension; use function count; use function in_array; +#[AutowiredService] final class CountFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension { diff --git a/src/Type/Php/DateFormatMethodReturnTypeExtension.php b/src/Type/Php/DateFormatMethodReturnTypeExtension.php index 34854d28cc..55d9e28d74 100644 --- a/src/Type/Php/DateFormatMethodReturnTypeExtension.php +++ b/src/Type/Php/DateFormatMethodReturnTypeExtension.php @@ -5,12 +5,14 @@ use DateTimeInterface; use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicMethodReturnTypeExtension; use PHPStan\Type\StringType; use PHPStan\Type\Type; use function count; +#[AutowiredService] final class DateFormatMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { diff --git a/src/Type/Php/DateFunctionReturnTypeHelper.php b/src/Type/Php/DateFunctionReturnTypeHelper.php index 7723ee2151..bac485292b 100644 --- a/src/Type/Php/DateFunctionReturnTypeHelper.php +++ b/src/Type/Php/DateFunctionReturnTypeHelper.php @@ -2,6 +2,7 @@ namespace PHPStan\Type\Php; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Type\Accessory\AccessoryNonEmptyStringType; use PHPStan\Type\Accessory\AccessoryNonFalsyStringType; use PHPStan\Type\Accessory\AccessoryNumericStringType; @@ -17,6 +18,7 @@ use function str_pad; use const STR_PAD_LEFT; +#[AutowiredService] final class DateFunctionReturnTypeHelper { diff --git a/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php b/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php index 04c356151d..971f593bfc 100644 --- a/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php @@ -5,6 +5,7 @@ use DateInterval; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; @@ -14,6 +15,7 @@ use PHPStan\Type\TypeCombinator; use function count; +#[AutowiredService] final class DateIntervalConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension { diff --git a/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php b/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php index 563ade3589..c5f597fcdc 100644 --- a/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php +++ b/src/Type/Php/DateIntervalDynamicReturnTypeExtension.php @@ -5,6 +5,7 @@ use DateInterval; use PhpParser\Node\Expr\StaticCall; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\DynamicStaticMethodReturnTypeExtension; @@ -14,6 +15,7 @@ use function count; use function in_array; +#[AutowiredService] final class DateIntervalDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension { From 8b2d4f156fa98e9f97016460aaedb0ef377b66bb Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 15:43:40 +0200 Subject: [PATCH 8/9] more autowire --- conf/config.neon | 68 ------------------- ...aysUsedClassConstantsExtensionProvider.php | 2 + ...ngCheckedExceptionInFunctionThrowsRule.php | 2 + ...singCheckedExceptionInMethodThrowsRule.php | 2 + ...eckedExceptionInPropertyHookThrowsRule.php | 2 + src/Rules/FunctionReturnTypeCheck.php | 2 + .../Generics/CrossCheckInterfacesHelper.php | 2 + src/Rules/Generics/GenericObjectTypeCheck.php | 2 + .../Generics/MethodTagTemplateTypeCheck.php | 2 + src/Rules/Generics/VarianceCheck.php | 2 + .../RestrictedInternalUsageHelper.php | 2 + .../LazyAlwaysUsedMethodExtensionProvider.php | 2 + .../MethodParameterComparisonHelper.php | 2 + .../MethodVisibilityComparisonHelper.php | 2 + src/Rules/NullsafeCheck.php | 2 + src/Rules/ParameterCastableToStringCheck.php | 2 + .../ConditionalReturnTypeRuleHelper.php | 2 + .../PhpDoc/GenericCallableRuleHelper.php | 2 + .../PhpDoc/IncompatiblePhpDocTypeCheck.php | 2 + src/Rules/PhpDoc/UnresolvableTypeHelper.php | 2 + src/Rules/Playground/NeverRuleHelper.php | 2 + ...zyReadWritePropertiesExtensionProvider.php | 2 + src/Rules/Properties/PropertyDescriptor.php | 2 + .../Properties/UninitializedPropertyRule.php | 2 + 24 files changed, 46 insertions(+), 68 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index abdf0f6067..ba9ffd7a0e 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -913,15 +913,6 @@ services: autowired: - PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver - - - class: PHPStan\Rules\Exceptions\MissingCheckedExceptionInFunctionThrowsRule - - - - class: PHPStan\Rules\Exceptions\MissingCheckedExceptionInMethodThrowsRule - - - - class: PHPStan\Rules\Exceptions\MissingCheckedExceptionInPropertyHookThrowsRule - - class: PHPStan\Rules\Exceptions\MissingCheckedExceptionInThrowsCheck arguments: @@ -946,37 +937,17 @@ services: checkClassCaseSensitivity: %checkClassCaseSensitivity% checkThisOnly: %checkThisOnly% - - - class: PHPStan\Rules\FunctionReturnTypeCheck - - - class: PHPStan\Rules\ParameterCastableToStringCheck - - - - class: PHPStan\Rules\Generics\CrossCheckInterfacesHelper - - class: PHPStan\Rules\Generics\GenericAncestorsCheck arguments: skipCheckGenericClasses: %featureToggles.skipCheckGenericClasses% checkMissingTypehints: %checkMissingTypehints% - - - class: PHPStan\Rules\Generics\GenericObjectTypeCheck - - - - class: PHPStan\Rules\Generics\MethodTagTemplateTypeCheck - - class: PHPStan\Rules\Generics\TemplateTypeCheck arguments: checkClassCaseSensitivity: %checkClassCaseSensitivity% - - - class: PHPStan\Rules\Generics\VarianceCheck - - - - class: PHPStan\Rules\InternalTag\RestrictedInternalUsageHelper - - class: PHPStan\Rules\IssetCheck arguments: @@ -1003,69 +974,30 @@ services: reportMaybes: %reportMaybesInMethodSignatures% reportStatic: %reportStaticMethodSignatures% - - - class: PHPStan\Rules\Methods\MethodParameterComparisonHelper - - - - class: PHPStan\Rules\Methods\MethodVisibilityComparisonHelper - - class: PHPStan\Rules\MissingTypehintCheck arguments: checkMissingCallableSignature: %checkMissingCallableSignature% skipCheckGenericClasses: %featureToggles.skipCheckGenericClasses% - - - class: PHPStan\Rules\NullsafeCheck - - - - class: PHPStan\Rules\Constants\LazyAlwaysUsedClassConstantsExtensionProvider - - - - class: PHPStan\Rules\Methods\LazyAlwaysUsedMethodExtensionProvider - - - - class: PHPStan\Rules\PhpDoc\ConditionalReturnTypeRuleHelper - - class: PHPStan\Rules\PhpDoc\AssertRuleHelper arguments: checkMissingTypehints: %checkMissingTypehints% checkClassCaseSensitivity: %checkClassCaseSensitivity% - - - class: PHPStan\Rules\PhpDoc\UnresolvableTypeHelper - - - - class: PHPStan\Rules\PhpDoc\GenericCallableRuleHelper - - - - class: PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeCheck - - class: PHPStan\Rules\PhpDoc\VarTagTypeRuleHelper arguments: checkTypeAgainstPhpDocType: %reportWrongPhpDocTypeInVarTag% strictWideningCheck: %reportAnyTypeWideningInVarTag% - - - class: PHPStan\Rules\Playground\NeverRuleHelper - - class: PHPStan\Rules\Properties\AccessPropertiesCheck arguments: reportMagicProperties: %reportMagicProperties% checkDynamicProperties: %checkDynamicProperties% - - - class: PHPStan\Rules\Properties\UninitializedPropertyRule - - - - class: PHPStan\Rules\Properties\LazyReadWritePropertiesExtensionProvider - - - - class: PHPStan\Rules\Properties\PropertyDescriptor - - class: PHPStan\Rules\RuleLevelHelper arguments: diff --git a/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php b/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php index e91391e8bb..9425eb8849 100644 --- a/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php +++ b/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php @@ -2,8 +2,10 @@ namespace PHPStan\Rules\Constants; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\DependencyInjection\Container; +#[AutowiredService] final class LazyAlwaysUsedClassConstantsExtensionProvider implements AlwaysUsedClassConstantsExtensionProvider { diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php b/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php index f3ed6e08f8..3f7d03df72 100644 --- a/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php +++ b/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\FunctionReturnStatementsNode; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -12,6 +13,7 @@ /** * @implements Rule */ +#[AutowiredService] final class MissingCheckedExceptionInFunctionThrowsRule implements Rule { diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php b/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php index c564711b2f..fc686735e7 100644 --- a/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php +++ b/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\MethodReturnStatementsNode; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -12,6 +13,7 @@ /** * @implements Rule */ +#[AutowiredService] final class MissingCheckedExceptionInMethodThrowsRule implements Rule { diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRule.php b/src/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRule.php index d9b7a6b864..a260881b5c 100644 --- a/src/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRule.php +++ b/src/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRule.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\PropertyHookReturnStatementsNode; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -14,6 +15,7 @@ /** * @implements Rule */ +#[AutowiredService] final class MissingCheckedExceptionInPropertyHookThrowsRule implements Rule { diff --git a/src/Rules/FunctionReturnTypeCheck.php b/src/Rules/FunctionReturnTypeCheck.php index 994b3943f2..e61965ca3a 100644 --- a/src/Rules/FunctionReturnTypeCheck.php +++ b/src/Rules/FunctionReturnTypeCheck.php @@ -6,6 +6,7 @@ use PhpParser\Node; use PhpParser\Node\Expr; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Type\ErrorType; use PHPStan\Type\NeverType; use PHPStan\Type\Type; @@ -13,6 +14,7 @@ use PHPStan\Type\VerbosityLevel; use function sprintf; +#[AutowiredService] final class FunctionReturnTypeCheck { diff --git a/src/Rules/Generics/CrossCheckInterfacesHelper.php b/src/Rules/Generics/CrossCheckInterfacesHelper.php index 3e9c477cb3..25b57e10e6 100644 --- a/src/Rules/Generics/CrossCheckInterfacesHelper.php +++ b/src/Rules/Generics/CrossCheckInterfacesHelper.php @@ -2,6 +2,7 @@ namespace PHPStan\Rules\Generics; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ClassReflection; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\RuleErrorBuilder; @@ -9,6 +10,7 @@ use function array_key_exists; use function sprintf; +#[AutowiredService] final class CrossCheckInterfacesHelper { diff --git a/src/Rules/Generics/GenericObjectTypeCheck.php b/src/Rules/Generics/GenericObjectTypeCheck.php index c0a4936bdc..0ed2f74166 100644 --- a/src/Rules/Generics/GenericObjectTypeCheck.php +++ b/src/Rules/Generics/GenericObjectTypeCheck.php @@ -2,6 +2,7 @@ namespace PHPStan\Rules\Generics; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\RuleErrorBuilder; use PHPStan\ShouldNotHappenException; @@ -23,6 +24,7 @@ use function sprintf; use function strtolower; +#[AutowiredService] final class GenericObjectTypeCheck { diff --git a/src/Rules/Generics/MethodTagTemplateTypeCheck.php b/src/Rules/Generics/MethodTagTemplateTypeCheck.php index afa672f983..31eb219ad8 100644 --- a/src/Rules/Generics/MethodTagTemplateTypeCheck.php +++ b/src/Rules/Generics/MethodTagTemplateTypeCheck.php @@ -4,6 +4,7 @@ use PhpParser\Node\Stmt\ClassLike; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Internal\SprintfHelper; use PHPStan\Reflection\ClassReflection; use PHPStan\Rules\IdentifierRuleError; @@ -15,6 +16,7 @@ use function array_merge; use function sprintf; +#[AutowiredService] final class MethodTagTemplateTypeCheck { diff --git a/src/Rules/Generics/VarianceCheck.php b/src/Rules/Generics/VarianceCheck.php index d01dbf75a3..cd8d7192bf 100644 --- a/src/Rules/Generics/VarianceCheck.php +++ b/src/Rules/Generics/VarianceCheck.php @@ -2,6 +2,7 @@ namespace PHPStan\Rules\Generics; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ExtendedParametersAcceptor; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\RuleErrorBuilder; @@ -10,6 +11,7 @@ use PHPStan\Type\Type; use function sprintf; +#[AutowiredService] final class VarianceCheck { diff --git a/src/Rules/InternalTag/RestrictedInternalUsageHelper.php b/src/Rules/InternalTag/RestrictedInternalUsageHelper.php index 1767c02fbb..f5c6147b13 100644 --- a/src/Rules/InternalTag/RestrictedInternalUsageHelper.php +++ b/src/Rules/InternalTag/RestrictedInternalUsageHelper.php @@ -3,10 +3,12 @@ namespace PHPStan\Rules\InternalTag; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use function array_slice; use function explode; use function str_starts_with; +#[AutowiredService] final class RestrictedInternalUsageHelper { diff --git a/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php b/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php index 6fca3226a5..1a2b49ee38 100644 --- a/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php +++ b/src/Rules/Methods/LazyAlwaysUsedMethodExtensionProvider.php @@ -2,8 +2,10 @@ namespace PHPStan\Rules\Methods; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\DependencyInjection\Container; +#[AutowiredService] final class LazyAlwaysUsedMethodExtensionProvider implements AlwaysUsedMethodExtensionProvider { diff --git a/src/Rules/Methods/MethodParameterComparisonHelper.php b/src/Rules/Methods/MethodParameterComparisonHelper.php index 34f66bb8bb..a52dbe86f5 100644 --- a/src/Rules/Methods/MethodParameterComparisonHelper.php +++ b/src/Rules/Methods/MethodParameterComparisonHelper.php @@ -2,6 +2,7 @@ namespace PHPStan\Rules\Methods; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Php\PhpVersion; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ExtendedMethodReflection; @@ -21,6 +22,7 @@ use function count; use function sprintf; +#[AutowiredService] final class MethodParameterComparisonHelper { diff --git a/src/Rules/Methods/MethodVisibilityComparisonHelper.php b/src/Rules/Methods/MethodVisibilityComparisonHelper.php index 4807453f2a..f0e922deec 100755 --- a/src/Rules/Methods/MethodVisibilityComparisonHelper.php +++ b/src/Rules/Methods/MethodVisibilityComparisonHelper.php @@ -2,6 +2,7 @@ namespace PHPStan\Rules\Methods; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ExtendedMethodReflection; use PHPStan\Reflection\Php\PhpMethodFromParserNodeReflection; @@ -9,6 +10,7 @@ use PHPStan\Rules\RuleErrorBuilder; use function sprintf; +#[AutowiredService] final class MethodVisibilityComparisonHelper { diff --git a/src/Rules/NullsafeCheck.php b/src/Rules/NullsafeCheck.php index a4424b69ac..4bd8d724ad 100644 --- a/src/Rules/NullsafeCheck.php +++ b/src/Rules/NullsafeCheck.php @@ -3,7 +3,9 @@ namespace PHPStan\Rules; use PhpParser\Node\Expr; +use PHPStan\DependencyInjection\AutowiredService; +#[AutowiredService] final class NullsafeCheck { diff --git a/src/Rules/ParameterCastableToStringCheck.php b/src/Rules/ParameterCastableToStringCheck.php index 9753863557..244cd1ba4f 100644 --- a/src/Rules/ParameterCastableToStringCheck.php +++ b/src/Rules/ParameterCastableToStringCheck.php @@ -5,12 +5,14 @@ use PhpParser\Node\Arg; use PHPStan\Analyser\ArgumentsNormalizer; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ParameterReflection; use PHPStan\Type\ErrorType; use PHPStan\Type\Type; use PHPStan\Type\VerbosityLevel; use function sprintf; +#[AutowiredService] final class ParameterCastableToStringCheck { diff --git a/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php b/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php index f48a8abc7a..af7cfda155 100644 --- a/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php +++ b/src/Rules/PhpDoc/ConditionalReturnTypeRuleHelper.php @@ -2,6 +2,7 @@ namespace PHPStan\Rules\PhpDoc; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\ExtendedParametersAcceptor; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\RuleErrorBuilder; @@ -17,6 +18,7 @@ use function sprintf; use function substr; +#[AutowiredService] final class ConditionalReturnTypeRuleHelper { diff --git a/src/Rules/PhpDoc/GenericCallableRuleHelper.php b/src/Rules/PhpDoc/GenericCallableRuleHelper.php index c32491fe42..d38279a659 100644 --- a/src/Rules/PhpDoc/GenericCallableRuleHelper.php +++ b/src/Rules/PhpDoc/GenericCallableRuleHelper.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\PhpDoc\Tag\TemplateTag; use PHPStan\Reflection\ClassReflection; use PHPStan\Rules\Generics\TemplateTypeCheck; @@ -18,6 +19,7 @@ use function array_keys; use function sprintf; +#[AutowiredService] final class GenericCallableRuleHelper { diff --git a/src/Rules/PhpDoc/IncompatiblePhpDocTypeCheck.php b/src/Rules/PhpDoc/IncompatiblePhpDocTypeCheck.php index 56c0ac529e..8fcc1569d2 100644 --- a/src/Rules/PhpDoc/IncompatiblePhpDocTypeCheck.php +++ b/src/Rules/PhpDoc/IncompatiblePhpDocTypeCheck.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Internal\SprintfHelper; use PHPStan\PhpDoc\ResolvedPhpDocBlock; use PHPStan\PhpDoc\Tag\ParamOutTag; @@ -19,6 +20,7 @@ use function in_array; use function sprintf; +#[AutowiredService] final class IncompatiblePhpDocTypeCheck { diff --git a/src/Rules/PhpDoc/UnresolvableTypeHelper.php b/src/Rules/PhpDoc/UnresolvableTypeHelper.php index 25b485dfad..69f539f373 100644 --- a/src/Rules/PhpDoc/UnresolvableTypeHelper.php +++ b/src/Rules/PhpDoc/UnresolvableTypeHelper.php @@ -2,11 +2,13 @@ namespace PHPStan\Rules\PhpDoc; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Type\ErrorType; use PHPStan\Type\NeverType; use PHPStan\Type\Type; use PHPStan\Type\TypeTraverser; +#[AutowiredService] final class UnresolvableTypeHelper { diff --git a/src/Rules/Playground/NeverRuleHelper.php b/src/Rules/Playground/NeverRuleHelper.php index 9865d3d1ce..a0870f7ce3 100644 --- a/src/Rules/Playground/NeverRuleHelper.php +++ b/src/Rules/Playground/NeverRuleHelper.php @@ -3,10 +3,12 @@ namespace PHPStan\Rules\Playground; use PhpParser\Node; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\ReturnStatementsNode; use PHPStan\Type\NeverType; use PHPStan\Type\Type; +#[AutowiredService] final class NeverRuleHelper { diff --git a/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php b/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php index f42cb7e7d5..07dfafea6b 100644 --- a/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php +++ b/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php @@ -2,8 +2,10 @@ namespace PHPStan\Rules\Properties; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\DependencyInjection\Container; +#[AutowiredService] final class LazyReadWritePropertiesExtensionProvider implements ReadWritePropertiesExtensionProvider { diff --git a/src/Rules/Properties/PropertyDescriptor.php b/src/Rules/Properties/PropertyDescriptor.php index 8588a1a57a..d9d6e10c99 100644 --- a/src/Rules/Properties/PropertyDescriptor.php +++ b/src/Rules/Properties/PropertyDescriptor.php @@ -4,11 +4,13 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Reflection\PropertyReflection; use PHPStan\Type\ObjectType; use PHPStan\Type\VerbosityLevel; use function sprintf; +#[AutowiredService] final class PropertyDescriptor { diff --git a/src/Rules/Properties/UninitializedPropertyRule.php b/src/Rules/Properties/UninitializedPropertyRule.php index 525a9ecbb6..576aac92b2 100644 --- a/src/Rules/Properties/UninitializedPropertyRule.php +++ b/src/Rules/Properties/UninitializedPropertyRule.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\DependencyInjection\AutowiredService; use PHPStan\Node\ClassPropertiesNode; use PHPStan\Reflection\ConstructorsHelper; use PHPStan\Rules\Rule; @@ -13,6 +14,7 @@ /** * @implements Rule */ +#[AutowiredService] final class UninitializedPropertyRule implements Rule { From 318067508d37321d87d0bc4c57d55ab119575dd3 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 25 May 2025 16:28:25 +0200 Subject: [PATCH 9/9] Update AutowiredAttributeServicesExtension.php --- .../AutowiredAttributeServicesExtension.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/DependencyInjection/AutowiredAttributeServicesExtension.php b/src/DependencyInjection/AutowiredAttributeServicesExtension.php index 0762f02836..f326b2d308 100644 --- a/src/DependencyInjection/AutowiredAttributeServicesExtension.php +++ b/src/DependencyInjection/AutowiredAttributeServicesExtension.php @@ -21,8 +21,11 @@ use PHPStan\Reflection\Deprecation\PropertyDeprecationExtension; use PHPStan\Reflection\MethodsClassReflectionExtension; use PHPStan\Reflection\PropertiesClassReflectionExtension; +use PHPStan\Rules\Constants\AlwaysUsedClassConstantsExtension; use PHPStan\Rules\Constants\AlwaysUsedClassConstantsExtensionProvider; use PHPStan\Rules\LazyRegistry; +use PHPStan\Rules\Methods\AlwaysUsedMethodExtension; +use PHPStan\Rules\Methods\AlwaysUsedMethodExtensionProvider; use PHPStan\Rules\Properties\ReadWritePropertiesExtension; use PHPStan\Rules\Properties\ReadWritePropertiesExtensionProvider; use PHPStan\Rules\RestrictedUsage\RestrictedClassConstantUsageExtension; @@ -71,7 +74,8 @@ public function loadConfiguration(): void TypeNodeResolverExtension::class => TypeNodeResolverExtension::EXTENSION_TAG, Rule::class => LazyRegistry::RULE_TAG, StubFilesExtension::class => StubFilesExtension::EXTENSION_TAG, - AlwaysUsedClassConstantsExtensionProvider::class => AlwaysUsedClassConstantsExtensionProvider::EXTENSION_TAG, + AlwaysUsedClassConstantsExtension::class => AlwaysUsedClassConstantsExtensionProvider::EXTENSION_TAG, + AlwaysUsedMethodExtension::class => AlwaysUsedMethodExtensionProvider::EXTENSION_TAG, ReadWritePropertiesExtension::class => ReadWritePropertiesExtensionProvider::EXTENSION_TAG, FunctionTypeSpecifyingExtension::class => TypeSpecifierFactory::FUNCTION_TYPE_SPECIFYING_EXTENSION_TAG, MethodTypeSpecifyingExtension::class => TypeSpecifierFactory::METHOD_TYPE_SPECIFYING_EXTENSION_TAG,