55use Nette ;
66use Nette \DI \CompilerExtension ;
77use Nette \Schema \Expect ;
8- use PHPStan \Analyser \ResultCache \ResultCacheMetaExtension ;
9- use PHPStan \Analyser \TypeSpecifierFactory ;
10- use PHPStan \Broker \BrokerFactory ;
11- use PHPStan \Collectors \RegistryFactory as CollectorRegistryFactory ;
12- use PHPStan \DependencyInjection \Type \LazyDynamicThrowTypeExtensionProvider ;
13- use PHPStan \DependencyInjection \Type \LazyParameterClosureTypeExtensionProvider ;
14- use PHPStan \DependencyInjection \Type \LazyParameterOutTypeExtensionProvider ;
15- use PHPStan \Diagnose \DiagnoseExtension ;
16- use PHPStan \Parser \RichParser ;
17- use PHPStan \PhpDoc \StubFilesExtension ;
18- use PHPStan \PhpDoc \TypeNodeResolverExtension ;
19- use PHPStan \Reflection \Deprecation \ClassConstantDeprecationExtension ;
20- use PHPStan \Reflection \Deprecation \ClassDeprecationExtension ;
21- use PHPStan \Reflection \Deprecation \EnumCaseDeprecationExtension ;
22- use PHPStan \Reflection \Deprecation \FunctionDeprecationExtension ;
23- use PHPStan \Reflection \Deprecation \MethodDeprecationExtension ;
24- use PHPStan \Reflection \Deprecation \PropertyDeprecationExtension ;
25- use PHPStan \Rules \Constants \AlwaysUsedClassConstantsExtensionProvider ;
26- use PHPStan \Rules \LazyRegistry ;
27- use PHPStan \Rules \Properties \ReadWritePropertiesExtensionProvider ;
28- use PHPStan \Rules \RestrictedUsage \RestrictedClassConstantUsageExtension ;
29- use PHPStan \Rules \RestrictedUsage \RestrictedClassNameUsageExtension ;
30- use PHPStan \Rules \RestrictedUsage \RestrictedFunctionUsageExtension ;
31- use PHPStan \Rules \RestrictedUsage \RestrictedMethodUsageExtension ;
32- use PHPStan \Rules \RestrictedUsage \RestrictedPropertyUsageExtension ;
338use PHPStan \ShouldNotHappenException ;
9+ use function array_fill_keys ;
3410use function array_reduce ;
11+ use function array_values ;
3512use function count ;
3613use function is_array ;
3714use function sprintf ;
@@ -41,49 +18,11 @@ final class ConditionalTagsExtension extends CompilerExtension
4118
4219 public function getConfigSchema (): Nette \Schema \Schema
4320 {
44- $ bool = Expect::anyOf (Expect::bool (), Expect::listOf (Expect::bool ()));
45- return Expect::arrayOf (Expect::structure ([
46- BrokerFactory::PROPERTIES_CLASS_REFLECTION_EXTENSION_TAG => $ bool ,
47- BrokerFactory::METHODS_CLASS_REFLECTION_EXTENSION_TAG => $ bool ,
48- BrokerFactory::DYNAMIC_METHOD_RETURN_TYPE_EXTENSION_TAG => $ bool ,
49- BrokerFactory::DYNAMIC_STATIC_METHOD_RETURN_TYPE_EXTENSION_TAG => $ bool ,
50- BrokerFactory::DYNAMIC_FUNCTION_RETURN_TYPE_EXTENSION_TAG => $ bool ,
51- BrokerFactory::EXPRESSION_TYPE_RESOLVER_EXTENSION_TAG => $ bool ,
52- BrokerFactory::OPERATOR_TYPE_SPECIFYING_EXTENSION_TAG => $ bool ,
53- BrokerFactory::ALLOWED_SUB_TYPES_CLASS_REFLECTION_EXTENSION_TAG => $ bool ,
54- LazyRegistry::RULE_TAG => $ bool ,
55- TypeNodeResolverExtension::EXTENSION_TAG => $ bool ,
56- StubFilesExtension::EXTENSION_TAG => $ bool ,
57- AlwaysUsedClassConstantsExtensionProvider::EXTENSION_TAG => $ bool ,
58- ReadWritePropertiesExtensionProvider::EXTENSION_TAG => $ bool ,
59- TypeSpecifierFactory::FUNCTION_TYPE_SPECIFYING_EXTENSION_TAG => $ bool ,
60- TypeSpecifierFactory::METHOD_TYPE_SPECIFYING_EXTENSION_TAG => $ bool ,
61- TypeSpecifierFactory::STATIC_METHOD_TYPE_SPECIFYING_EXTENSION_TAG => $ bool ,
62- RichParser::VISITOR_SERVICE_TAG => $ bool ,
63- CollectorRegistryFactory::COLLECTOR_TAG => $ bool ,
64- LazyDynamicThrowTypeExtensionProvider::FUNCTION_TAG => $ bool ,
65- LazyDynamicThrowTypeExtensionProvider::METHOD_TAG => $ bool ,
66- LazyDynamicThrowTypeExtensionProvider::STATIC_METHOD_TAG => $ bool ,
67- LazyParameterClosureTypeExtensionProvider::FUNCTION_TAG => $ bool ,
68- LazyParameterClosureTypeExtensionProvider::METHOD_TAG => $ bool ,
69- LazyParameterClosureTypeExtensionProvider::STATIC_METHOD_TAG => $ bool ,
70- LazyParameterOutTypeExtensionProvider::FUNCTION_TAG => $ bool ,
71- LazyParameterOutTypeExtensionProvider::METHOD_TAG => $ bool ,
72- LazyParameterOutTypeExtensionProvider::STATIC_METHOD_TAG => $ bool ,
73- DiagnoseExtension::EXTENSION_TAG => $ bool ,
74- ResultCacheMetaExtension::EXTENSION_TAG => $ bool ,
75- ClassConstantDeprecationExtension::CLASS_CONSTANT_EXTENSION_TAG => $ bool ,
76- ClassDeprecationExtension::CLASS_EXTENSION_TAG => $ bool ,
77- EnumCaseDeprecationExtension::ENUM_CASE_EXTENSION_TAG => $ bool ,
78- FunctionDeprecationExtension::FUNCTION_EXTENSION_TAG => $ bool ,
79- MethodDeprecationExtension::METHOD_EXTENSION_TAG => $ bool ,
80- PropertyDeprecationExtension::PROPERTY_EXTENSION_TAG => $ bool ,
81- RestrictedMethodUsageExtension::METHOD_EXTENSION_TAG => $ bool ,
82- RestrictedClassNameUsageExtension::CLASS_NAME_EXTENSION_TAG => $ bool ,
83- RestrictedFunctionUsageExtension::FUNCTION_EXTENSION_TAG => $ bool ,
84- RestrictedPropertyUsageExtension::PROPERTY_EXTENSION_TAG => $ bool ,
85- RestrictedClassConstantUsageExtension::CLASS_CONSTANT_EXTENSION_TAG => $ bool ,
86- ])->min (1 ));
21+ $ tags = array_values (ValidateServiceTagsExtension::INTERFACE_TAG_MAPPING );
22+
23+ return Expect::arrayOf (Expect::structure (
24+ array_fill_keys ($ tags , Expect::anyOf (Expect::bool (), Expect::listOf (Expect::bool ()))),
25+ )->min (1 ));
8726 }
8827
8928 public function beforeCompile (): void
0 commit comments