diff --git a/phpstan.neon b/phpstan.neon index 3be61f5..0f02e57 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -11,3 +11,6 @@ parameters: - src tmpDir: vendor/.cache.phpstan reportUnmatchedIgnoredErrors: false + ignoreErrors: + # Symfony polyfill bug + - '/^Access to property \$\w+ of internal class Symfony\\Polyfill\\Php80\\PhpToken from outside its root namespace Symfony/' diff --git a/src/Mapping/Driver/ReflectionDriver.php b/src/Mapping/Driver/ReflectionDriver.php index 8a78ee7..705cc8a 100644 --- a/src/Mapping/Driver/ReflectionDriver.php +++ b/src/Mapping/Driver/ReflectionDriver.php @@ -40,6 +40,15 @@ protected function load( $this->fillDefaultValue($property, $metadata); } + $this->loadParametersFor($class, $reflection); + } + + /** + * @param ClassMetadata $class + * @param \ReflectionClass $reflection + */ + private function loadParametersFor(ClassMetadata $class, \ReflectionClass $reflection): void + { $constructor = $reflection->getConstructor(); if ($constructor === null) { @@ -57,6 +66,12 @@ protected function load( $metadata->setDefaultValue($parameter->getDefaultValue()); } } + + $parent = $reflection->getParentClass(); + + if ($parent instanceof \ReflectionClass) { + $this->loadParametersFor($class, $parent); + } } private function fillDefaultValue(\ReflectionProperty $property, PropertyMetadata $meta): void diff --git a/src/Runtime/Value/SymfonyValuePrinter.php b/src/Runtime/Value/SymfonyValuePrinter.php index 8805b93..a9c404a 100644 --- a/src/Runtime/Value/SymfonyValuePrinter.php +++ b/src/Runtime/Value/SymfonyValuePrinter.php @@ -51,6 +51,7 @@ public function dump(Data $data, $output = null): ?string private function createDefaultVarCloner(): VarCloner { $cloner = new VarCloner(); + /** @phpstan-ignore-next-line Allow internal class usage */ $cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO); return $cloner;