Skip to content

Commit

Permalink
Run @mixin class reflection extensions after all other class reflec…
Browse files Browse the repository at this point in the history
…tion extensions
  • Loading branch information
ondrejmirtes committed Sep 5, 2024
1 parent 42709fc commit c889baa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 0 additions & 4 deletions conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -797,15 +797,11 @@ services:

-
class: PHPStan\Reflection\Mixin\MixinMethodsClassReflectionExtension
tags:
- phpstan.broker.methodsClassReflectionExtension
arguments:
mixinExcludeClasses: %mixinExcludeClasses%

-
class: PHPStan\Reflection\Mixin\MixinPropertiesClassReflectionExtension
tags:
- phpstan.broker.propertiesClassReflectionExtension
arguments:
mixinExcludeClasses: %mixinExcludeClasses%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use PHPStan\Reflection\Annotations\AnnotationsMethodsClassReflectionExtension;
use PHPStan\Reflection\Annotations\AnnotationsPropertiesClassReflectionExtension;
use PHPStan\Reflection\ClassReflectionExtensionRegistry;
use PHPStan\Reflection\Mixin\MixinMethodsClassReflectionExtension;
use PHPStan\Reflection\Mixin\MixinPropertiesClassReflectionExtension;
use PHPStan\Reflection\Php\PhpClassReflectionExtension;
use PHPStan\Reflection\RequireExtension\RequireExtendsMethodsClassReflectionExtension;
use PHPStan\Reflection\RequireExtension\RequireExtendsPropertiesClassReflectionExtension;
Expand All @@ -29,10 +31,13 @@ public function getRegistry(): ClassReflectionExtensionRegistry
$annotationsMethodsClassReflectionExtension = $this->container->getByType(AnnotationsMethodsClassReflectionExtension::class);
$annotationsPropertiesClassReflectionExtension = $this->container->getByType(AnnotationsPropertiesClassReflectionExtension::class);

$mixinMethodsClassReflectionExtension = $this->container->getByType(MixinMethodsClassReflectionExtension::class);
$mixinPropertiesClassReflectionExtension = $this->container->getByType(MixinPropertiesClassReflectionExtension::class);

$this->registry = new ClassReflectionExtensionRegistry(
$this->container->getByType(Broker::class),
array_merge([$phpClassReflectionExtension], $this->container->getServicesByTag(BrokerFactory::PROPERTIES_CLASS_REFLECTION_EXTENSION_TAG), [$annotationsPropertiesClassReflectionExtension]),
array_merge([$phpClassReflectionExtension], $this->container->getServicesByTag(BrokerFactory::METHODS_CLASS_REFLECTION_EXTENSION_TAG), [$annotationsMethodsClassReflectionExtension]),
array_merge([$phpClassReflectionExtension], $this->container->getServicesByTag(BrokerFactory::PROPERTIES_CLASS_REFLECTION_EXTENSION_TAG), [$annotationsPropertiesClassReflectionExtension, $mixinPropertiesClassReflectionExtension]),
array_merge([$phpClassReflectionExtension], $this->container->getServicesByTag(BrokerFactory::METHODS_CLASS_REFLECTION_EXTENSION_TAG), [$annotationsMethodsClassReflectionExtension, $mixinMethodsClassReflectionExtension]),
$this->container->getServicesByTag(BrokerFactory::ALLOWED_SUB_TYPES_CLASS_REFLECTION_EXTENSION_TAG),
$this->container->getByType(RequireExtendsPropertiesClassReflectionExtension::class),
$this->container->getByType(RequireExtendsMethodsClassReflectionExtension::class),
Expand Down

0 comments on commit c889baa

Please sign in to comment.