Skip to content

Commit 1925db0

Browse files
committed
Map all BrokerFactory tags in AutowiredAttributeServicesExtension
1 parent 339a29d commit 1925db0

7 files changed

+24
-24
lines changed

conf/config.neon

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,6 @@ services:
753753
tags:
754754
- phpstan.broker.dynamicMethodReturnTypeExtension
755755

756-
-
757-
class: PHPStan\Reflection\BetterReflection\Type\AdapterReflectionEnumDynamicReturnTypeExtension
758-
tags:
759-
- phpstan.broker.dynamicMethodReturnTypeExtension
760-
761756
-
762757
class: PHPStan\Reflection\ConstructorsHelper
763758
arguments:
@@ -793,11 +788,6 @@ services:
793788
-
794789
class: PHPStan\Reflection\Php\Soap\SoapClientMethodsClassReflectionExtension
795790

796-
-
797-
class: PHPStan\Reflection\Php\EnumAllowedSubTypesClassReflectionExtension
798-
tags:
799-
- phpstan.broker.allowedSubTypesClassReflectionExtension
800-
801791
-
802792
class: PHPStan\Reflection\Php\UniversalObjectCratesClassReflectionExtension
803793
tags:
@@ -1071,10 +1061,6 @@ services:
10711061
arguments:
10721062
reportMagicProperties: %reportMagicProperties%
10731063
checkDynamicProperties: %checkDynamicProperties%
1074-
-
1075-
class: PHPStan\Type\Php\BcMathNumberOperatorTypeSpecifyingExtension
1076-
tags:
1077-
- phpstan.broker.operatorTypeSpecifyingExtension
10781064

10791065
-
10801066
class: PHPStan\Rules\Properties\UninitializedPropertyRule
@@ -1310,11 +1296,6 @@ services:
13101296
tags:
13111297
- phpstan.dynamicFunctionThrowTypeExtension
13121298

1313-
-
1314-
class: PHPStan\Type\Php\BackedEnumFromMethodDynamicReturnTypeExtension
1315-
tags:
1316-
- phpstan.broker.dynamicStaticMethodReturnTypeExtension
1317-
13181299
-
13191300
class: PHPStan\Type\Php\Base64DecodeDynamicFunctionReturnTypeExtension
13201301
tags:
@@ -1603,11 +1584,6 @@ services:
16031584
tags:
16041585
- phpstan.typeSpecifier.functionTypeSpecifyingExtension
16051586

1606-
-
1607-
class: PHPStan\Type\Php\SimpleXMLElementClassPropertyReflectionExtension
1608-
tags:
1609-
- phpstan.broker.propertiesClassReflectionExtension
1610-
16111587
-
16121588
class: PHPStan\Type\Php\SimpleXMLElementConstructorThrowTypeExtension
16131589
tags:

src/DependencyInjection/AutowiredAttributeServicesExtension.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55
use Nette\DI\CompilerExtension;
66
use olvlvl\ComposerAttributeCollector\Attributes;
77
use PHPStan\Broker\BrokerFactory;
8+
use PHPStan\Reflection\AllowedSubTypesClassReflectionExtension;
9+
use PHPStan\Reflection\MethodsClassReflectionExtension;
10+
use PHPStan\Reflection\PropertiesClassReflectionExtension;
811
use PHPStan\Rules\LazyRegistry;
912
use PHPStan\Rules\Rule;
1013
use PHPStan\Type\DynamicFunctionReturnTypeExtension;
14+
use PHPStan\Type\DynamicMethodReturnTypeExtension;
15+
use PHPStan\Type\DynamicStaticMethodReturnTypeExtension;
16+
use PHPStan\Type\ExpressionTypeResolverExtension;
17+
use PHPStan\Type\OperatorTypeSpecifyingExtension;
1118
use ReflectionClass;
1219

1320
final class AutowiredAttributeServicesExtension extends CompilerExtension
@@ -20,7 +27,14 @@ public function loadConfiguration(): void
2027
$builder = $this->getContainerBuilder();
2128

2229
$interfaceToTag = [
30+
PropertiesClassReflectionExtension::class => BrokerFactory::PROPERTIES_CLASS_REFLECTION_EXTENSION_TAG,
31+
MethodsClassReflectionExtension::class => BrokerFactory::METHODS_CLASS_REFLECTION_EXTENSION_TAG,
32+
AllowedSubTypesClassReflectionExtension::class => BrokerFactory::ALLOWED_SUB_TYPES_CLASS_REFLECTION_EXTENSION_TAG,
33+
DynamicMethodReturnTypeExtension::class => BrokerFactory::DYNAMIC_METHOD_RETURN_TYPE_EXTENSION_TAG,
34+
DynamicStaticMethodReturnTypeExtension::class => BrokerFactory::DYNAMIC_STATIC_METHOD_RETURN_TYPE_EXTENSION_TAG,
2335
DynamicFunctionReturnTypeExtension::class => BrokerFactory::DYNAMIC_FUNCTION_RETURN_TYPE_EXTENSION_TAG,
36+
OperatorTypeSpecifyingExtension::class => BrokerFactory::OPERATOR_TYPE_SPECIFYING_EXTENSION_TAG,
37+
ExpressionTypeResolverExtension::class => BrokerFactory::EXPRESSION_TYPE_RESOLVER_EXTENSION_TAG,
2438
Rule::class => LazyRegistry::RULE_TAG,
2539
];
2640

src/Reflection/BetterReflection/Type/AdapterReflectionEnumDynamicReturnTypeExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClassConstant;
99
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum;
1010
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType;
11+
use PHPStan\DependencyInjection\AutowiredService;
1112
use PHPStan\Php\PhpVersion;
1213
use PHPStan\Reflection\MethodReflection;
1314
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
@@ -22,6 +23,7 @@
2223
use PHPStan\Type\UnionType;
2324
use function in_array;
2425

26+
#[AutowiredService]
2527
final class AdapterReflectionEnumDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
2628
{
2729

src/Reflection/Php/EnumAllowedSubTypesClassReflectionExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
namespace PHPStan\Reflection\Php;
44

5+
use PHPStan\DependencyInjection\AutowiredService;
56
use PHPStan\Reflection\AllowedSubTypesClassReflectionExtension;
67
use PHPStan\Reflection\ClassReflection;
78
use PHPStan\Type\Enum\EnumCaseObjectType;
89
use function array_keys;
910

11+
#[AutowiredService]
1012
final class EnumAllowedSubTypesClassReflectionExtension implements AllowedSubTypesClassReflectionExtension
1113
{
1214

src/Type/Php/BackedEnumFromMethodDynamicReturnTypeExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use BackedEnum;
66
use PhpParser\Node\Expr\StaticCall;
77
use PHPStan\Analyser\Scope;
8+
use PHPStan\DependencyInjection\AutowiredService;
89
use PHPStan\Reflection\MethodReflection;
910
use PHPStan\Type\DynamicStaticMethodReturnTypeExtension;
1011
use PHPStan\Type\Enum\EnumCaseObjectType;
@@ -14,6 +15,7 @@
1415
use function count;
1516
use function in_array;
1617

18+
#[AutowiredService]
1719
final class BackedEnumFromMethodDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension
1820
{
1921

src/Type/Php/BcMathNumberOperatorTypeSpecifyingExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\Type\Php;
44

5+
use PHPStan\DependencyInjection\AutowiredService;
56
use PHPStan\Php\PhpVersion;
67
use PHPStan\Type\ErrorType;
78
use PHPStan\Type\NeverType;
@@ -10,6 +11,7 @@
1011
use PHPStan\Type\Type;
1112
use function in_array;
1213

14+
#[AutowiredService]
1315
final class BcMathNumberOperatorTypeSpecifyingExtension implements OperatorTypeSpecifyingExtension
1416
{
1517

src/Type/Php/SimpleXMLElementClassPropertyReflectionExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\Type\Php;
44

5+
use PHPStan\DependencyInjection\AutowiredService;
56
use PHPStan\Reflection\ClassReflection;
67
use PHPStan\Reflection\Php\SimpleXMLElementProperty;
78
use PHPStan\Reflection\PropertiesClassReflectionExtension;
@@ -10,6 +11,7 @@
1011
use PHPStan\Type\NullType;
1112
use PHPStan\Type\ObjectType;
1213

14+
#[AutowiredService]
1315
final class SimpleXMLElementClassPropertyReflectionExtension implements PropertiesClassReflectionExtension
1416
{
1517

0 commit comments

Comments
 (0)