diff --git a/src/Blueprint/Domain/Blueprint.php b/src/Blueprint/Domain/Blueprint.php index ce6b154..9c7eaf1 100644 --- a/src/Blueprint/Domain/Blueprint.php +++ b/src/Blueprint/Domain/Blueprint.php @@ -18,7 +18,6 @@ private function __construct( } /** - * @param BlueprintId $id * @param array $classBlueprints */ public static function create(BlueprintId $id, array $classBlueprints): static @@ -33,7 +32,6 @@ public static function create(BlueprintId $id, array $classBlueprints): static } /** - * @param BlueprintId $id * @param array $classBlueprints */ public static function recreate(BlueprintId $id, array $classBlueprints): static diff --git a/src/Blueprint/Domain/Entities/ClassBlueprint.php b/src/Blueprint/Domain/Entities/ClassBlueprint.php index 342baff..08331cf 100644 --- a/src/Blueprint/Domain/Entities/ClassBlueprint.php +++ b/src/Blueprint/Domain/Entities/ClassBlueprint.php @@ -18,7 +18,6 @@ private function __construct( } /** - * @param BlueprintId $id * @param array $propertyBlueprints */ public static function create(BlueprintId $id, array $propertyBlueprints): static @@ -33,7 +32,6 @@ public static function create(BlueprintId $id, array $propertyBlueprints): stati } /** - * @param BlueprintId $id * @param array $propertyBlueprints */ public static function recreate(BlueprintId $id, array $propertyBlueprints): static diff --git a/src/Reflection/Domain/Entities/AttributeReflection.php b/src/Reflection/Domain/Entities/AttributeReflection.php index fb38548..a36daed 100644 --- a/src/Reflection/Domain/Entities/AttributeReflection.php +++ b/src/Reflection/Domain/Entities/AttributeReflection.php @@ -9,10 +9,10 @@ use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionCreated; use PBaszak\UltraMapper\Reflection\Domain\Exception\ReflectionException; use PBaszak\UltraMapper\Reflection\Domain\Identity\ReflectionId; -use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; +use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Entity; use PBaszak\UltraMapper\Shared\Infrastructure\Normalization\Normalizable; -final class AttributeReflection extends AggregateRoot implements Normalizable, ReflectionInterface +final class AttributeReflection extends Entity implements Normalizable, ReflectionInterface { private ReflectionInterface&AttributesSupport $parent; @@ -26,7 +26,6 @@ private function __construct( private array $arguments, private false|string $fileName, private false|string $fileHash, - private false|string $docBlock, ) { } @@ -44,7 +43,6 @@ public static function create( arguments: $reflectionAttribute->getArguments(), fileName: $reflectionClass->getFileName(), fileHash: $reflectionClass->getFileName() ? md5_file($reflectionClass->getFileName()) : false, - docBlock: $reflectionClass->getDocComment(), ); $instance->parent = $parent; @@ -58,14 +56,7 @@ public static function create( } /** - * @param ReflectionId $id - * @param string $name - * @param string $shortName - * @param string $namespace * @param array $arguments - * @param false|string $fileName - * @param false|string $fileHash - * @param false|string $docBlock */ public static function recreate( ReflectionId $id, @@ -75,7 +66,6 @@ public static function recreate( array $arguments, false|string $fileName, false|string $fileHash, - false|string $docBlock, ): static { return new static( id: $id, @@ -85,11 +75,10 @@ public static function recreate( arguments: $arguments, fileName: $fileName, fileHash: $fileHash, - docBlock: $docBlock, ); } - public function parent(null|(ReflectionInterface&AttributesSupport) $parent = null): ReflectionInterface&AttributesSupport + public function parent((ReflectionInterface&AttributesSupport)|null $parent = null): ReflectionInterface&AttributesSupport { if (!$parent) { return $this->parent; @@ -101,7 +90,7 @@ public function parent(null|(ReflectionInterface&AttributesSupport) $parent = nu return $this->parent; } - throw new \InvalidArgumentException("Cannot set parent property. Parent property is read-only."); + throw new \InvalidArgumentException('Cannot set parent property. Parent property is read-only.'); } public function id(): ReflectionId @@ -140,11 +129,6 @@ public function fileHash(): false|string return $this->fileHash; } - public function docBlock(): false|string - { - return $this->docBlock; - } - public function instance(): object { return new $this->name(...$this->arguments); @@ -154,8 +138,8 @@ public function reflection(): \Reflector { if (method_exists($parentReflection = $this->parent->reflection(), 'getAttributes')) { /** - * @var \ReflectionClass|\ReflectionMethod|\ReflectionProperty|\ReflectionParameter $parentReflection - * @var \ReflectionAttribute[] $attrs + * @var \ReflectionClass|\ReflectionMethod|\ReflectionProperty|\ReflectionParameter $parentReflection + * @var \ReflectionAttribute[] $attrs */ $attrs = $parentReflection->getAttributes($this->name); foreach ($attrs as $attr) { @@ -165,11 +149,7 @@ public function reflection(): \Reflector } } - throw new ReflectionException( - "ReflectionAttribute for `{$this->name}` in `{$parentReflection->__toString()}` class not found.", - "Check if the attribute is still present in the class and if the arguments match.", - 5 - ); + throw new ReflectionException("ReflectionAttribute for `{$this->name}` in `{$parentReflection->__toString()}` class not found.", 'Check if the attribute is still present in the class and if the arguments match.', 5); } public function normalize(): array @@ -182,7 +162,6 @@ public function normalize(): array 'arguments' => $this->arguments, 'fileName' => $this->fileName, 'fileHash' => $this->fileHash, - 'docBlock' => $this->docBlock, ]; } @@ -196,7 +175,6 @@ public static function denormalize(array $data): static $data['arguments'], $data['fileName'], $data['fileHash'], - $data['docBlock'], ); } } diff --git a/src/Reflection/Domain/Entities/ClassReflection.php b/src/Reflection/Domain/Entities/ClassReflection.php index 13612fc..0701971 100644 --- a/src/Reflection/Domain/Entities/ClassReflection.php +++ b/src/Reflection/Domain/Entities/ClassReflection.php @@ -6,21 +6,21 @@ use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\AttributesSupport; use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\ReflectionInterface; -use PBaszak\UltraMapper\Reflection\Domain\Entities\traits\Attributes; -use PBaszak\UltraMapper\Reflection\Domain\Entities\traits\Methods; -use PBaszak\UltraMapper\Reflection\Domain\Entities\traits\Properties; -use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionAdded; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Traits\Attributes; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Traits\Methods; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Traits\Properties; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionCreated; -use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionRemoved; use PBaszak\UltraMapper\Reflection\Domain\Exception\ReflectionException; use PBaszak\UltraMapper\Reflection\Domain\Identity\ReflectionId; use PBaszak\UltraMapper\Reflection\Domain\Reflection; -use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; +use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Entity; use PBaszak\UltraMapper\Shared\Infrastructure\Normalization\Normalizable; -final class ClassReflection extends AggregateRoot implements Normalizable, AttributesSupport, ReflectionInterface +final class ClassReflection extends Entity implements Normalizable, AttributesSupport, ReflectionInterface { - use Attributes, Methods, Properties; + use Attributes; + use Methods; + use Properties; private Reflection $root; @@ -33,7 +33,6 @@ private function __construct( private string $hash, private false|string $fileName, private false|string $fileHash, - private false|string $docBlock, array $attributes = [], array $properties = [], array $methods = [], @@ -45,10 +44,6 @@ private function __construct( /** * @param string|class-string $name - * @param Reflection $root - * @param null|PropertyReflection $parentProperty - * - * @return static */ public static function create( string $name, @@ -56,22 +51,14 @@ public static function create( ?PropertyReflection $parentProperty = null, ): static { if (__CLASS__ === $name) { - throw new ReflectionException( - "Cannot create instance of $name class.", - "Please do not use `ClassReflection::create` method to create instance of $name class.", - 1 - ); + throw new ReflectionException("Cannot create instance of $name class.", "Please do not use `ClassReflection::create` method to create instance of $name class.", 1); } try { $reflection = new \ReflectionClass($name); } catch (\ReflectionException $e) { $message = $e->getMessage(); - throw new ReflectionException( - "Class `$name` not found. $message", - "Check if the class exists, has correct namespace and filename, and is properly autoloaded.", - 2 - ); + throw new ReflectionException("Class `$name` not found. $message", 'Check if the class exists, has correct namespace and filename, and is properly autoloaded.', 2); } $instance = new static( @@ -82,7 +69,6 @@ public static function create( hash: md5($reflection->__toString()), fileName: $reflection->getFileName(), fileHash: $reflection->getFileName() ? md5_file($reflection->getFileName()) : false, - docBlock: $reflection->getDocComment(), ); $instance->root = $root; @@ -110,19 +96,10 @@ public static function create( } /** - * @param ReflectionId $id - * @param string|class-string $name - * @param string $shortName - * @param string $namespace - * @param string $hash - * @param false|string $fileName - * @param false|string $fileHash - * @param false|string $docBlock + * @param string|class-string $name * @param array $attributes - * @param array $properties - * @param array $methods - * - * @return static + * @param array $properties + * @param array $methods */ public static function recreate( ReflectionId $id, @@ -132,7 +109,6 @@ public static function recreate( string $hash, false|string $fileName, false|string $fileHash, - false|string $docBlock, array $attributes, array $properties, array $methods @@ -145,7 +121,6 @@ public static function recreate( $hash, $fileName, $fileHash, - $docBlock, $attributes, $properties, $methods @@ -164,7 +139,7 @@ public function root(?Reflection $root = null): Reflection return $this->root; } - throw new \InvalidArgumentException("Cannot set root property. Root property is read-only."); + throw new \InvalidArgumentException('Cannot set root property. Root property is read-only.'); } public function id(): ReflectionId @@ -202,11 +177,6 @@ public function fileHash(): false|string return $this->fileHash; } - public function docBlock(): false|string - { - return $this->docBlock; - } - public function reflection(): \Reflector { return new \ReflectionClass($this->name); @@ -222,7 +192,6 @@ public function normalize(): array 'hash' => $this->hash, 'fileName' => $this->fileName, 'fileHash' => $this->fileHash, - 'docBlock' => $this->docBlock, 'attributes' => $this->normalizeAttributes(), 'properties' => $this->normalizeProperties(), 'methods' => $this->normalizeMethods(), @@ -239,7 +208,6 @@ public static function denormalize(array $data): static $data['hash'], $data['fileName'], $data['fileHash'], - $data['docBlock'], static::denormalizeAttributes($data['attributes']), static::denormalizeProperties($data['properties']), static::denormalizeMethods($data['methods']), diff --git a/src/Reflection/Domain/Entities/Interfaces/AttributesSupport.php b/src/Reflection/Domain/Entities/Interfaces/AttributesSupport.php index 599face..1b43e1c 100644 --- a/src/Reflection/Domain/Entities/Interfaces/AttributesSupport.php +++ b/src/Reflection/Domain/Entities/Interfaces/AttributesSupport.php @@ -9,11 +9,11 @@ interface AttributesSupport { /** - * @param null|class-string $filter - * + * @param class-string|null $filter + * * @return array|AttributeReflection[] */ - public function attributes(null|string $filter = null): array; + public function attributes(?string $filter = null): array; public function addAttribute(AttributeReflection $attribute): void; diff --git a/src/Reflection/Domain/Entities/MethodReflection.php b/src/Reflection/Domain/Entities/MethodReflection.php index 0e2584f..66eda82 100644 --- a/src/Reflection/Domain/Entities/MethodReflection.php +++ b/src/Reflection/Domain/Entities/MethodReflection.php @@ -6,26 +6,28 @@ use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\AttributesSupport; use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\ReflectionInterface; -use PBaszak\UltraMapper\Reflection\Domain\Entities\traits\Attributes; -use PBaszak\UltraMapper\Reflection\Domain\Entities\traits\Parameters; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Traits\Attributes; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Traits\Parameters; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Type\TypeReflection; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionCreated; +use PBaszak\UltraMapper\Reflection\Domain\Factories\TypeReflectionFactory; use PBaszak\UltraMapper\Reflection\Domain\Identity\ReflectionId; -use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; +use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Entity; use PBaszak\UltraMapper\Shared\Infrastructure\Normalization\Normalizable; -use Reflector; -final class MethodReflection extends AggregateRoot implements Normalizable, AttributesSupport, ReflectionInterface +final class MethodReflection extends Entity implements Normalizable, AttributesSupport, ReflectionInterface { - use Attributes, Parameters; + use Attributes; + use Parameters; private ClassReflection $parent; private function __construct( private ReflectionId $id, private string $name, - private string $docBlock, array $attributes, array $parameters, + private TypeReflection $returnType, ) { $this->attributes = $attributes; $this->parameters = $parameters; @@ -36,9 +38,9 @@ public static function create(\ReflectionMethod $reflectionMethod, ClassReflecti $instance = new static( id: ReflectionId::uuid(), name: $reflectionMethod->getName(), - docBlock: $reflectionMethod->getDocComment(), attributes: [], parameters: [], + returnType: (new TypeReflectionFactory())->createForMethod($reflectionMethod), ); $instance->parent = $parent; @@ -46,33 +48,38 @@ public static function create(\ReflectionMethod $reflectionMethod, ClassReflecti new ReflectionCreated($instance->id) ); + foreach ($reflectionMethod->getAttributes() as $attribute) { + $instance->addAttribute(AttributeReflection::create($attribute, $instance)); + } + + foreach ($reflectionMethod->getParameters() as $parameter) { + $instance->addParameter(ParameterReflection::create($parameter, $instance)); + } + return $instance; } /** - * @param ReflectionId $id - * @param string $name - * @param string $docBlock - * @param array $attributes - * @param array $parameters + * @param array $attributes + * @param array $parameters */ public static function recreate( ReflectionId $id, string $name, - string $docBlock, array $attributes, array $parameters, + TypeReflection $returnType, ): static { return new static( $id, $name, - $docBlock, $attributes, $parameters, + $returnType, ); } - public function parent(null|ClassReflection $parent = null): ClassReflection + public function parent(?ClassReflection $parent = null): ClassReflection { if (!$parent) { return $this->parent; @@ -84,7 +91,7 @@ public function parent(null|ClassReflection $parent = null): ClassReflection return $this->parent; } - throw new \InvalidArgumentException("Cannot set parent property. Parent property is read-only."); + throw new \InvalidArgumentException('Cannot set parent property. Parent property is read-only.'); } public function id(): ReflectionId @@ -97,17 +104,12 @@ public function name(): string return $this->name; } - public function docBlock(): string + public function returnType(): TypeReflection { - return $this->docBlock; + return $this->returnType; } - public function parameters(): array - { - return $this->parameters; - } - - public function reflection(): Reflector + public function reflection(): \Reflector { /** @var \ReflectionClass */ $parentReflection = $this->parent->reflection(); @@ -120,9 +122,9 @@ public function normalize(): array return [ 'id' => $this->id->value, 'name' => $this->name, - 'docBlock' => $this->docBlock, 'attributes' => $this->normalizeAttributes(), 'parameters' => $this->normalizeParameters(), + 'returnType' => $this->returnType->normalize(), ]; } @@ -131,11 +133,11 @@ public static function denormalize(array $data): static $instance = static::recreate( ReflectionId::recreate($data['id']), $data['name'], - $data['docBlock'], self::denormalizeAttributes($data['attributes']), self::denormalizeParameters($data['parameters']), + $data['returnType']['type']::denormalize($data['returnType']), ); - + foreach ($instance->attributes() as $attrs) { foreach ($attrs as $attr) { $attr->parent($instance); diff --git a/src/Reflection/Domain/Entities/ParameterReflection.php b/src/Reflection/Domain/Entities/ParameterReflection.php index 4e5105e..4c8b2ae 100644 --- a/src/Reflection/Domain/Entities/ParameterReflection.php +++ b/src/Reflection/Domain/Entities/ParameterReflection.php @@ -6,13 +6,15 @@ use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\AttributesSupport; use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\ReflectionInterface; -use PBaszak\UltraMapper\Reflection\Domain\Entities\traits\Attributes; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Traits\Attributes; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Type\TypeReflection; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionCreated; +use PBaszak\UltraMapper\Reflection\Domain\Factories\TypeReflectionFactory; use PBaszak\UltraMapper\Reflection\Domain\Identity\ReflectionId; -use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; +use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Entity; use PBaszak\UltraMapper\Shared\Infrastructure\Normalization\Normalizable; -final class ParameterReflection extends AggregateRoot implements Normalizable, AttributesSupport, ReflectionInterface +final class ParameterReflection extends Entity implements Normalizable, AttributesSupport, ReflectionInterface { use Attributes; @@ -22,18 +24,17 @@ private function __construct( private ReflectionId $id, private string $name, private TypeReflection $type, - array $attributes, + array $attributes = [], ) { $this->attributes = $attributes; } - public static function create(\ReflectionParameter $reflectionMethod, MethodReflection $parent): static + public static function create(\ReflectionParameter $reflectionParameter, MethodReflection $parent): static { $instance = new static( id: ReflectionId::uuid(), - name: $reflectionMethod->getName(), - attributes: [], - parameters: [], + name: $reflectionParameter->getName(), + type: (new TypeReflectionFactory())->createForParameter($reflectionParameter), ); $instance->parent = $parent; @@ -41,15 +42,31 @@ public static function create(\ReflectionParameter $reflectionMethod, MethodRefl new ReflectionCreated($instance->id) ); + foreach ($reflectionParameter->getAttributes() as $attribute) { + $instance->addAttribute(AttributeReflection::create($attribute, $instance)); + } + return $instance; } - public static function recreate(ReflectionId $id): static - { - return new static($id); + /** + * @param array $attributes + */ + public static function recreate( + ReflectionId $id, + string $name, + TypeReflection $type, + array $attributes, + ): static { + return new static( + $id, + $name, + $type, + $attributes, + ); } - - public function parent(null|MethodReflection $parent = null): MethodReflection + + public function parent(?MethodReflection $parent = null): MethodReflection { if (!$parent) { return $this->parent; @@ -61,7 +78,15 @@ public function parent(null|MethodReflection $parent = null): MethodReflection return $this->parent; } - throw new \InvalidArgumentException("Cannot set parent property. Parent property is read-only."); + throw new \InvalidArgumentException('Cannot set parent property. Parent property is read-only.'); + } + + public function reflection(): \Reflector + { + /** @var \ReflectionMethod $ref */ + $ref = $this->parent()->reflection(); + + return $ref->getParameters()[$this->name]; } public function id(): ReflectionId @@ -73,4 +98,37 @@ public function name(): string { return $this->name; } + + public function type(): TypeReflection + { + return $this->type; + } + + public function normalize(): array + { + return [ + 'id' => $this->id->value, + 'name' => $this->name, + 'type' => $this->type->normalize(), + 'attributes' => $this->normalizeAttributes(), + ]; + } + + public static function denormalize(array $data): static + { + $instance = new static( + ReflectionId::recreate($data['id']), + $data['name'], + $data['type']['type']::denormalize($data['type']), + static::denormalizeAttributes($data['attributes']), + ); + + foreach ($instance->attributes() as $attrs) { + foreach ($attrs as $attr) { + $attr->parent($instance); + } + } + + return $instance; + } } diff --git a/src/Reflection/Domain/Entities/PropertyReflection.php b/src/Reflection/Domain/Entities/PropertyReflection.php index 87028a2..6610087 100644 --- a/src/Reflection/Domain/Entities/PropertyReflection.php +++ b/src/Reflection/Domain/Entities/PropertyReflection.php @@ -6,14 +6,15 @@ use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\AttributesSupport; use PBaszak\UltraMapper\Reflection\Domain\Entities\Interfaces\ReflectionInterface; -use PBaszak\UltraMapper\Reflection\Domain\Entities\traits\Attributes; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Traits\Attributes; +use PBaszak\UltraMapper\Reflection\Domain\Entities\Type\TypeReflection; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionCreated; +use PBaszak\UltraMapper\Reflection\Domain\Factories\TypeReflectionFactory; use PBaszak\UltraMapper\Reflection\Domain\Identity\ReflectionId; -use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; +use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Entity; use PBaszak\UltraMapper\Shared\Infrastructure\Normalization\Normalizable; -use ReflectionProperty; -final class PropertyReflection extends AggregateRoot implements Normalizable, AttributesSupport, ReflectionInterface +final class PropertyReflection extends Entity implements Normalizable, AttributesSupport, ReflectionInterface { use Attributes; @@ -23,20 +24,56 @@ final class PropertyReflection extends AggregateRoot implements Normalizable, At private function __construct( private ReflectionId $id, private string $name, + private TypeReflection $type, + array $attributes = [], ) { + $this->attributes = $attributes; } - public static function create(\ReflectionProperty $reflectionProperty, ClassReflection $parent, ?ReflectionProperty $parentProperty): static + public static function create(\ReflectionProperty $reflectionProperty, ClassReflection $parent, ?\ReflectionProperty $parentProperty): static { - + $instance = new static( + id: ReflectionId::uuid(), + name: $reflectionProperty->getName(), + type: (new TypeReflectionFactory())->createForProperty($reflectionProperty), + ); + + $instance->parent = $parent; + $instance->parentProperty = $parentProperty; + $instance->raise( + new ReflectionCreated($instance->id) + ); + + foreach ($reflectionProperty->getAttributes() as $attribute) { + $instance->addAttribute(AttributeReflection::create($attribute, $instance)); + } + + return $instance; + } + + /** + * @param array $attributes + */ + public static function recreate( + ReflectionId $id, + string $name, + TypeReflection $type, + array $attributes, + ): static { + return new static( + $id, + $name, + $type, + $attributes, + ); } - public static function recreate(ReflectionId $id): static + public function reflection(): \Reflector { - return new static($id); + return new \ReflectionProperty($this->parent->name(), $this->name); } - - public function parent(null|ClassReflection $parent = null): ClassReflection + + public function parent(?ClassReflection $parent = null): ClassReflection { if (!$parent) { return $this->parent; @@ -48,10 +85,10 @@ public function parent(null|ClassReflection $parent = null): ClassReflection return $this->parent; } - throw new \InvalidArgumentException("Cannot set parent property. Parent property is read-only."); + throw new \InvalidArgumentException('Cannot set parent property. Parent property is read-only.'); } - public function parentProperty(null|PropertyReflection $parentProperty = null): PropertyReflection + public function parentProperty(?PropertyReflection $parentProperty = null): PropertyReflection { if (!$parentProperty) { return $this->parentProperty; @@ -63,7 +100,7 @@ public function parentProperty(null|PropertyReflection $parentProperty = null): return $this->parentProperty; } - throw new \InvalidArgumentException("Cannot set parentProperty property. parentProperty property is read-only."); + throw new \InvalidArgumentException('Cannot set parentProperty property. parentProperty property is read-only.'); } public function id(): ReflectionId @@ -75,4 +112,37 @@ public function name(): string { return $this->name; } + + public function type(): TypeReflection + { + return $this->type; + } + + public function normalize(): array + { + return [ + 'id' => $this->id->value, + 'name' => $this->name, + 'type' => $this->type->normalize(), + 'attributes' => $this->normalizeAttributes(), + ]; + } + + public static function denormalize(array $data): static + { + $instance = static::recreate( + ReflectionId::recreate($data['id']), + $data['name'], + $data['type']['type']::denormalize($data['type']), + static::denormalizeAttributes($data['attributes']), + ); + + foreach ($instance->attributes() as $attrs) { + foreach ($attrs as $attr) { + $attr->parent($instance); + } + } + + return $instance; + } } diff --git a/src/Reflection/Domain/Entities/traits/Attributes.php b/src/Reflection/Domain/Entities/Traits/Attributes.php similarity index 93% rename from src/Reflection/Domain/Entities/traits/Attributes.php rename to src/Reflection/Domain/Entities/Traits/Attributes.php index 5292573..93dd6e7 100644 --- a/src/Reflection/Domain/Entities/traits/Attributes.php +++ b/src/Reflection/Domain/Entities/Traits/Attributes.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PBaszak\UltraMapper\Reflection\Domain\Entities\traits; +namespace PBaszak\UltraMapper\Reflection\Domain\Entities\Traits; use PBaszak\UltraMapper\Reflection\Domain\Entities\AttributeReflection; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionAdded; @@ -16,11 +16,11 @@ trait Attributes private array $attributes = []; /** - * @param null|class-string $filter - * + * @param class-string|null $filter + * * @return array|AttributeReflection[] */ - public function attributes(null|string $filter = null): array + public function attributes(?string $filter = null): array { if ($filter) { return $this->attributes[$filter] ?? []; diff --git a/src/Reflection/Domain/Entities/traits/Methods.php b/src/Reflection/Domain/Entities/Traits/Methods.php similarity index 91% rename from src/Reflection/Domain/Entities/traits/Methods.php rename to src/Reflection/Domain/Entities/Traits/Methods.php index 646235f..1fa4aea 100644 --- a/src/Reflection/Domain/Entities/traits/Methods.php +++ b/src/Reflection/Domain/Entities/Traits/Methods.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PBaszak\UltraMapper\Reflection\Domain\Entities\traits; +namespace PBaszak\UltraMapper\Reflection\Domain\Entities\Traits; use PBaszak\UltraMapper\Reflection\Domain\Entities\MethodReflection; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionAdded; @@ -16,11 +16,9 @@ trait Methods private array $methods = []; /** - * @param null|string $name - * * @return array|MethodReflection */ - public function methods(null|string $name = null): array|MethodReflection + public function methods(?string $name = null): array|MethodReflection { if ($name) { if (!array_key_exists($name, $this->methods)) { diff --git a/src/Reflection/Domain/Entities/traits/Parameters.php b/src/Reflection/Domain/Entities/Traits/Parameters.php similarity index 91% rename from src/Reflection/Domain/Entities/traits/Parameters.php rename to src/Reflection/Domain/Entities/Traits/Parameters.php index ec166e6..258931d 100644 --- a/src/Reflection/Domain/Entities/traits/Parameters.php +++ b/src/Reflection/Domain/Entities/Traits/Parameters.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PBaszak\UltraMapper\Reflection\Domain\Entities\traits; +namespace PBaszak\UltraMapper\Reflection\Domain\Entities\Traits; use PBaszak\UltraMapper\Reflection\Domain\Entities\ParameterReflection; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionAdded; @@ -16,11 +16,9 @@ trait Parameters private array $parameters = []; /** - * @param null|string $name - * * @return array|ParameterReflection */ - public function parameters(null|string $name = null): array|ParameterReflection + public function parameters(?string $name = null): array|ParameterReflection { if ($name) { if (!array_key_exists($name, $this->parameters)) { diff --git a/src/Reflection/Domain/Entities/traits/Properties.php b/src/Reflection/Domain/Entities/Traits/Properties.php similarity index 91% rename from src/Reflection/Domain/Entities/traits/Properties.php rename to src/Reflection/Domain/Entities/Traits/Properties.php index 9bcf58d..bb578c2 100644 --- a/src/Reflection/Domain/Entities/traits/Properties.php +++ b/src/Reflection/Domain/Entities/Traits/Properties.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PBaszak\UltraMapper\Reflection\Domain\Entities\traits; +namespace PBaszak\UltraMapper\Reflection\Domain\Entities\Traits; use PBaszak\UltraMapper\Reflection\Domain\Entities\PropertyReflection; use PBaszak\UltraMapper\Reflection\Domain\Events\ReflectionAdded; @@ -16,11 +16,9 @@ trait Properties private array $properties = []; /** - * @param null|string $name - * * @return array|PropertyReflection */ - public function properties(null|string $name = null): array|PropertyReflection + public function properties(?string $name = null): array|PropertyReflection { if ($name) { if (!array_key_exists($name, $this->properties)) { diff --git a/src/Reflection/Domain/Entities/Type/CollectionTypeReflection.php b/src/Reflection/Domain/Entities/Type/CollectionTypeReflection.php new file mode 100644 index 0000000..05320e9 --- /dev/null +++ b/src/Reflection/Domain/Entities/Type/CollectionTypeReflection.php @@ -0,0 +1,52 @@ + __CLASS__, + 'types' => [ + 'collectionType' => $this->collectionType->normalize(), + 'keyType' => $this->keyType->normalize(), + 'valueType' => $this->valueType->normalize(), + ], + ]; + } + + public static function denormalize(array $data): static + { + return static::recreate( + NamedTypeReflection::denormalize($data['collectionType']), + $data['keyType']['type']::denormalize($data['keyType']), + $data['valueType']['type']::denormalize($data['valueType']), + ); + } +} diff --git a/src/Reflection/Domain/Entities/Type/IntersectionTypeReflection.php b/src/Reflection/Domain/Entities/Type/IntersectionTypeReflection.php new file mode 100644 index 0000000..127c9fc --- /dev/null +++ b/src/Reflection/Domain/Entities/Type/IntersectionTypeReflection.php @@ -0,0 +1,53 @@ + */ + private array $types, + ) { + } + + /** + * @param array $types + */ + public static function create( + array $types, + ): static { + return new static($types); + } + + /** + * @param array $types + */ + public static function recreate( + array $types, + ): static { + return new static($types); + } + + public function normalize(): array + { + return [ + 'type' => __CLASS__, + 'types' => array_map( + fn (TypeReflection $type) => $type->normalize(), + $this->types + ), + ]; + } + + public static function denormalize(array $data): static + { + return static::recreate( + array_map( + fn (array $type) => $type['type']::denormalize($type), + $data['types'] + ) + ); + } +} diff --git a/src/Reflection/Domain/Entities/Type/NamedTypeReflection.php b/src/Reflection/Domain/Entities/Type/NamedTypeReflection.php new file mode 100644 index 0000000..5a99d27 --- /dev/null +++ b/src/Reflection/Domain/Entities/Type/NamedTypeReflection.php @@ -0,0 +1,85 @@ +isAbstract()) { + throw new \InvalidArgumentException("Class $name is not abstract."); + } + + if ($flags & self::IS_ENUM == self::IS_ENUM && !class_exists($name, false)) { + throw new \InvalidArgumentException("Enum $name does not exist."); + } + + return new static($name, $flags); + } + + /** + * @param string|class-string $name + */ + public static function recreate( + string $name, + int $flags, + ): static { + return new static($name, $flags); + } + + public function normalize(): array + { + return [ + 'type' => __CLASS__, + 'name' => $this->name, + 'flags' => [ + 'value' => $this->flags, + 'is_build_in' => $this->flags & self::IS_BUILD_IN == self::IS_BUILD_IN, + 'is_class' => $this->flags & self::IS_CLASS == self::IS_CLASS, + 'is_interface' => $this->flags & self::IS_INTERFACE == self::IS_INTERFACE, + 'is_abstract' => $this->flags & self::IS_ABSTRACT == self::IS_ABSTRACT, + 'is_enum' => $this->flags & self::IS_ENUM == self::IS_ENUM, + ], + ]; + } + + public static function denormalize(array $data): static + { + return static::recreate( + $data['name'], + $data['flags']['value'] + ); + } +} diff --git a/src/Reflection/Domain/Entities/Type/TypeReflection.php b/src/Reflection/Domain/Entities/Type/TypeReflection.php new file mode 100644 index 0000000..3563d36 --- /dev/null +++ b/src/Reflection/Domain/Entities/Type/TypeReflection.php @@ -0,0 +1,11 @@ + */ + private array $types, + ) { + } + + /** + * @param array $types + */ + public static function create( + array $types, + ): static { + return new static($types); + } + + /** + * @param array $types + */ + public static function recreate( + array $types, + ): static { + return new static($types); + } + + public function normalize(): array + { + return [ + 'type' => __CLASS__, + 'types' => array_map( + fn (TypeReflection $type) => $type->normalize(), + $this->types + ), + ]; + } + + public static function denormalize(array $data): static + { + return static::recreate( + array_map( + fn (array $type) => $type['type']::denormalize($type), + $data['types'] + ) + ); + } +} diff --git a/src/Reflection/Domain/Entities/TypeReflection.php b/src/Reflection/Domain/Entities/TypeReflection.php deleted file mode 100644 index e6d31ef..0000000 --- a/src/Reflection/Domain/Entities/TypeReflection.php +++ /dev/null @@ -1,40 +0,0 @@ -raise( - new ReflectionCreated($id) - ); - - return $reflection; - } - - public static function recreate(ReflectionId $id): static - { - return new static($id); - } - - public function id(): ReflectionId - { - return $this->id; - } -} diff --git a/src/Reflection/Domain/Events/ReflectionAdded.php b/src/Reflection/Domain/Events/ReflectionAdded.php index cdd540f..b080654 100644 --- a/src/Reflection/Domain/Events/ReflectionAdded.php +++ b/src/Reflection/Domain/Events/ReflectionAdded.php @@ -33,11 +33,7 @@ public function __construct( public readonly string $eventName, ) { if (!in_array($eventName, self::REFLECTIONS)) { - throw new ReflectionException( - 'Invalid event name.', - 'Event name must be one of the following: ' . implode(', ', self::REFLECTIONS) . '.', - 3 - ); + throw new ReflectionException('Invalid event name.', 'Event name must be one of the following: '.implode(', ', self::REFLECTIONS).'.', 3); } parent::__construct($id, $eventName, self::EVENT_VERSION); diff --git a/src/Reflection/Domain/Events/ReflectionRemoved.php b/src/Reflection/Domain/Events/ReflectionRemoved.php index 3ce46cb..7a2af5a 100644 --- a/src/Reflection/Domain/Events/ReflectionRemoved.php +++ b/src/Reflection/Domain/Events/ReflectionRemoved.php @@ -33,11 +33,7 @@ public function __construct( public readonly string $eventName, ) { if (!in_array($eventName, self::REFLECTIONS)) { - throw new ReflectionException( - 'Invalid event name.', - 'Event name must be one of the following: ' . implode(', ', self::REFLECTIONS) . '.', - 3 - ); + throw new ReflectionException('Invalid event name.', 'Event name must be one of the following: '.implode(', ', self::REFLECTIONS).'.', 3); } parent::__construct($id, $eventName, self::EVENT_VERSION); diff --git a/src/Reflection/Domain/Exception/ReflectionException.php b/src/Reflection/Domain/Exception/ReflectionException.php index f3754a5..455f74b 100644 --- a/src/Reflection/Domain/Exception/ReflectionException.php +++ b/src/Reflection/Domain/Exception/ReflectionException.php @@ -7,4 +7,5 @@ use PBaszak\UltraMapper\Shared\Application\Exception\UltraMapperException; final class ReflectionException extends UltraMapperException -{} +{ +} diff --git a/src/Reflection/Domain/Factories/TypeReflectionFactory.php b/src/Reflection/Domain/Factories/TypeReflectionFactory.php new file mode 100644 index 0000000..dedeeba --- /dev/null +++ b/src/Reflection/Domain/Factories/TypeReflectionFactory.php @@ -0,0 +1,47 @@ + + * [ + * 0 => array, + * 1 => int + * ] + */ +class TypeReflectionFactory +{ + public function createForParameter(\ReflectionParameter $reflectionParameter): TypeReflection + { + // $typeReflection = TypeReflection::create($reflectionParameter->getType()); + // $typeReflection->raise(new ReflectionCreated($typeReflection->id())); + + // return $typeReflection; + throw new \Exception('Not implemented'); + } + + public function createForProperty(\ReflectionProperty $reflectionProperty): TypeReflection + { + // $typeReflection = TypeReflection::create($reflectionProperty->getType()); + // $typeReflection->raise(new ReflectionCreated($typeReflection->id())); + + // return $typeReflection; + throw new \Exception('Not implemented'); + } + + public function createForMethod(\ReflectionMethod $reflectionMethod): TypeReflection + { + // $typeReflection = TypeReflection::create($reflectionMethod->getReturnType()); + // $typeReflection->raise(new ReflectionCreated($typeReflection->id())); + + // return $typeReflection; + throw new \Exception('Not implemented'); + } +} diff --git a/src/Reflection/Domain/Reflection.php b/src/Reflection/Domain/Reflection.php index ba6c849..330a791 100644 --- a/src/Reflection/Domain/Reflection.php +++ b/src/Reflection/Domain/Reflection.php @@ -24,8 +24,8 @@ private function __construct( } /** - * @param class-string|string $rootClass The class that is being reflected - * @param string $idSuffix It's used to create unique id for reflection + * @param class-string|string $rootClass The class that is being reflected + * @param string $idSuffix It's used to create unique id for reflection */ public static function create(string $rootClass, string $idSuffix = ''): static { @@ -34,7 +34,7 @@ public static function create(string $rootClass, string $idSuffix = ''): static } $reflection = new static( - ReflectionId::create(md5($rootClass) . $idSuffix), + ReflectionId::create(md5($rootClass).$idSuffix), $rootClass, ); @@ -48,8 +48,7 @@ public static function create(string $rootClass, string $idSuffix = ''): static } /** - * @param ReflectionId $id - * @param class-string|string $rootClass + * @param class-string|string $rootClass * @param array $classReflections */ public static function recreate( @@ -71,10 +70,10 @@ public function rootClass(): string return $this->rootClass; } - /** - * @param null|class-string|string $filter - * - * @return array | ClassReflection + /** + * @param class-string|string|null $filter + * + * @return array|ClassReflection */ public function classReflections(?string $filter = null): array|ClassReflection { @@ -90,14 +89,14 @@ public function classReflections(?string $filter = null): array|ClassReflection } /** - * @param ClassReflection $classReflection - * * @return true|ClassReflection If the class reflection already exists in the collection, it returns the existing one. * Otherwise, it returns true to indicate that the class reflection was successfully added. */ public function addClassReflection(ClassReflection $classReflection): true|ClassReflection { - foreach ($this->classReflections() as $existingClassReflection) { + /** @var array */ + $classReflections = $this->classReflections(); + foreach ($classReflections as $existingClassReflection) { if ($existingClassReflection->id() === $classReflection->id()) { return $existingClassReflection; } @@ -111,7 +110,7 @@ public function addClassReflection(ClassReflection $classReflection): true|Class public function removeClassReflection(string $classReflectionName): void { if ($this->rootClass === $classReflectionName) { - throw new \InvalidArgumentException("Cannot remove the root class reflection."); + throw new \InvalidArgumentException('Cannot remove the root class reflection.'); } $id = $this->classReflections($classReflectionName)->id(); @@ -143,7 +142,7 @@ public static function denormalize(array $data): static fn (array $classReflectionData) => ClassReflection::denormalize($classReflectionData), $data['classReflections'] ); - + $instance = static::recreate( ReflectionId::recreate($data['id']), $data['rootClass'], diff --git a/src/Shared/Domain/ObjectTypes/Entity.php b/src/Shared/Domain/ObjectTypes/Entity.php new file mode 100644 index 0000000..03344a3 --- /dev/null +++ b/src/Shared/Domain/ObjectTypes/Entity.php @@ -0,0 +1,33 @@ +events; + $this->events = []; + + return $events; + } + + final protected function raise(Event $event): void + { + $this->events[] = $event; + } +} diff --git a/tools/phpstan/fpm-baseline.neon b/tools/phpstan/fpm-baseline.neon index 364905f..55e0d5e 100644 --- a/tools/phpstan/fpm-baseline.neon +++ b/tools/phpstan/fpm-baseline.neon @@ -1,2 +1,311 @@ parameters: ignoreErrors: + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\Blueprint\\:\\:classBlueprints\\(\\) has invalid return type PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\ClassBlueprint\\.$#" + count: 1 + path: ../../src/Blueprint/Domain/Blueprint.php + + - + message: "#^Parameter \\$classBlueprints of method PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\Blueprint\\:\\:__construct\\(\\) has invalid type PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\ClassBlueprint\\.$#" + count: 1 + path: ../../src/Blueprint/Domain/Blueprint.php + + - + message: "#^Parameter \\$classBlueprints of method PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\Blueprint\\:\\:create\\(\\) has invalid type PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\ClassBlueprint\\.$#" + count: 1 + path: ../../src/Blueprint/Domain/Blueprint.php + + - + message: "#^Parameter \\$classBlueprints of method PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\Blueprint\\:\\:recreate\\(\\) has invalid type PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\ClassBlueprint\\.$#" + count: 1 + path: ../../src/Blueprint/Domain/Blueprint.php + + - + message: "#^Property PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\Blueprint\\:\\:\\$classBlueprints has unknown class PBaszak\\\\UltraMapper\\\\Blueprint\\\\Domain\\\\ClassBlueprint as its type\\.$#" + count: 1 + path: ../../src/Blueprint/Domain/Blueprint.php + + - + message: "#^Parameter \\$name of class PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\AttributeReflection constructor expects class\\-string, string given\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/AttributeReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\AttributeReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Cannot call method id\\(\\) on array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Cannot call method id\\(\\) on array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:__construct\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:__construct\\(\\) has parameter \\$methods with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:__construct\\(\\) has parameter \\$properties with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:denormalizeAttributes\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:denormalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:denormalizeMethods\\(\\) has parameter \\$methods with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:denormalizeMethods\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:denormalizeProperties\\(\\) has parameter \\$properties with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:denormalizeProperties\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:normalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:normalizeMethods\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:normalizeProperties\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" + count: 2 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Parameter \\#3 \\$parentProperty of static method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:create\\(\\) expects ReflectionProperty\\|null, PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\|null given\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Part \\$id \\(PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Identity\\\\ReflectionId\\) of encapsed string cannot be cast to string\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\:\\:\\$attributes \\(array\\\\>\\) does not accept array\\\\>\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ClassReflection.php + + - + message: "#^Access to an undefined property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:\\$shortName\\.$#" + count: 4 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\AttributeReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Cannot call method id\\(\\) on array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:__construct\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:__construct\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:denormalizeAttributes\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:denormalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:denormalizeParameters\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:denormalizeParameters\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:normalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:normalizeParameters\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Part \\$id \\(PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Identity\\\\ReflectionId\\) of encapsed string cannot be cast to string\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\MethodReflection\\:\\:\\$attributes \\(array\\\\>\\) does not accept array\\\\>\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/MethodReflection.php + + - + message: "#^Access to an undefined property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection\\:\\:\\$shortName\\.$#" + count: 2 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\AttributeReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection\\:\\:__construct\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection\\:\\:denormalizeAttributes\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection\\:\\:denormalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection\\:\\:normalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Part \\$id \\(PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Identity\\\\ReflectionId\\) of encapsed string cannot be cast to string\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ParameterReflection\\:\\:\\$attributes \\(array\\\\>\\) does not accept array\\\\>\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/ParameterReflection.php + + - + message: "#^Access to an undefined property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:\\$shortName\\.$#" + count: 2 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\AttributeReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:__construct\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:denormalizeAttributes\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:denormalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Method PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:normalizeAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Part \\$id \\(PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Identity\\\\ReflectionId\\) of encapsed string cannot be cast to string\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:\\$attributes \\(array\\\\>\\) does not accept array\\\\>\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Property PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\:\\:\\$parentProperty \\(PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\PropertyReflection\\) does not accept ReflectionProperty\\|null\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/PropertyReflection.php + + - + message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Entities/Type/NamedTypeReflection.php + + - + message: "#^Argument of an invalid type array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Reflection.php + + - + message: "#^Cannot call method id\\(\\) on array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Reflection.php + + - + message: "#^Parameter \\#2 \\$array of function array_map expects array, array\\\\|PBaszak\\\\UltraMapper\\\\Reflection\\\\Domain\\\\Entities\\\\ClassReflection given\\.$#" + count: 1 + path: ../../src/Reflection/Domain/Reflection.php