kenny1911 / doctrine-inherit-annotations
Support inherit doctrine annotations of parent class
Installs: 2 050
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.1 || ^8.0
- doctrine/annotations: ^1.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-04-24 16:22:39 UTC
README
InheritAnnotationReader
- is implementation of Reader
interface from doctrine/annotations
package, that support
inherit annotations from parent class. To do this, you must specify
@Kenny1911\DoctrineInheritAnnotations\Annotation\Inherit
annotation, like as @inheritDoc
from PHPDoc
.
New InheritAnnotationReader instance
InheritAnnotationReader
instance is decorate original Reader
:
use Doctrine\Common\Annotations\AnnotationReader; use Kenny1911\DoctrineInheritAnnotations\InheritAnnotationReader; $reader = new AnnotationReader(); // Original annotation reader $inheritReader = new InheritAnnotationReader($reader);
Usage
use Doctrine\Common\Annotations\AnnotationReader; use Kenny1911\DoctrineInheritAnnotations\Annotation\Inherit; use Kenny1911\DoctrineInheritAnnotations\InheritAnnotationReader; /** * @FooAnnotation() */ class ParentClass {} /** * @BarAnnotation() * * @Inherit() */ class ChildClass extends ParentClass {} $reader = new AnnotationReader(); $reader->getClassAnnotations(new ReflectionClass(ChildClass::class)); // return [@BarAnnotation(), @Inherit()] $inheritReader = new InheritAnnotationReader($reader); $inheritReader->getClassAnnotations(new ReflectionClass(ChildClass::class)); // return [@BarAnnotation(), @Inherit(), @FooAnnotation()]