@@ -30,13 +30,13 @@ |
||
| 30 | 30 | * Returns the type"s parent-attribute, if it has one. |
| 31 | 31 | * @return null|AttributeInterface |
| 32 | 32 | */ |
| 33 | - public function getParentAttribute(): ?AttributeInterface; |
|
| 33 | + public function getParentAttribute(): ? AttributeInterface; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Returns the type"s parent-type, if it has one. |
| 37 | 37 | * @return null|EntityTypeInterface |
| 38 | 38 | */ |
| 39 | - public function getParent(): ?EntityTypeInterface; |
|
| 39 | + public function getParent(): ? EntityTypeInterface; |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Tells if an entity-type has a parent-type, hence is a nested-type. |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function __construct(array $attributes = []) |
| 15 | 15 | { |
| 16 | - $this->init(array_reduce($attributes, function (array $carry, AttributeInterface $attribute) { |
|
| 16 | + $this->init(array_reduce($attributes, function(array $carry, AttributeInterface $attribute) { |
|
| 17 | 17 | $carry[$attribute->getName()] = $attribute; // enforce consistent attribute keys |
| 18 | 18 | return $carry; |
| 19 | 19 | }, []), AttributeInterface::class); |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | public function byClassNames(array $classNames = []): self |
| 28 | 28 | { |
| 29 | 29 | $clonedMap = clone $this; |
| 30 | - (function (string ...$classNames) use ($clonedMap): void { |
|
| 30 | + (function(string ...$classNames) use ($clonedMap): void { |
|
| 31 | 31 | $clonedMap->compositeMap = $clonedMap->compositeMap->filter( |
| 32 | - function (string $name, AttributeInterface $attribute) use ($classNames): bool { |
|
| 32 | + function(string $name, AttributeInterface $attribute) use ($classNames): bool { |
|
| 33 | 33 | return in_array(get_class($attribute), $classNames); |
| 34 | 34 | } |
| 35 | 35 | ); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * {@inheritdoc} |
| 81 | 81 | */ |
| 82 | - public function getParentAttribute(): ?AttributeInterface |
|
| 82 | + public function getParentAttribute(): ? AttributeInterface |
|
| 83 | 83 | { |
| 84 | 84 | return $this->parentAttribute; |
| 85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * {@inheritdoc} |
| 89 | 89 | */ |
| 90 | - public function getParent(): ?EntityTypeInterface |
|
| 90 | + public function getParent(): ? EntityTypeInterface |
|
| 91 | 91 | { |
| 92 | 92 | return $this->hasParent() ? $this->getParentAttribute()->getEntityType() : null; |
| 93 | 93 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | private function makeEntityList(array $values, TypedEntityInterface $parentEntity = null): NestedEntityList |
| 35 | 35 | { |
| 36 | 36 | return new NestedEntityList( |
| 37 | - array_map(function (array $entityValues) use ($parentEntity) { |
|
| 37 | + array_map(function(array $entityValues) use ($parentEntity) { |
|
| 38 | 38 | return parent::makeValue($entityValues, $parentEntity); |
| 39 | 39 | }, $values) |
| 40 | 40 | ); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function __construct(array $entityTypes = []) |
| 15 | 15 | { |
| 16 | - $this->init(array_reduce($entityTypes, function (array $carry, EntityTypeInterface $entityType) { |
|
| 16 | + $this->init(array_reduce($entityTypes, function(array $carry, EntityTypeInterface $entityType) { |
|
| 17 | 17 | $carry[$entityType->getPrefix()] = $entityType; // enforce consistent attribute keys |
| 18 | 18 | return $carry; |
| 19 | 19 | }, []), EntityTypeInterface::class); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param string $name |
| 24 | 24 | * @return null|EntityTypeInterface |
| 25 | 25 | */ |
| 26 | - public function byName(string $name): ?EntityTypeInterface |
|
| 26 | + public function byName(string $name): ? EntityTypeInterface |
|
| 27 | 27 | { |
| 28 | 28 | foreach ($this as $type) { |
| 29 | 29 | if ($type->getName() === $name) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param string $className |
| 38 | 38 | * @return null|EntityTypeInterface |
| 39 | 39 | */ |
| 40 | - public function byClassName(string $className): ?EntityTypeInterface |
|
| 40 | + public function byClassName(string $className): ? EntityTypeInterface |
|
| 41 | 41 | { |
| 42 | 42 | foreach ($this as $type) { |
| 43 | 43 | if (get_class($type) === $className) { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $currentAttribute = $attribute->getParent(); |
| 25 | 25 | $currentType = $attribute->getEntityType(); |
| 26 | 26 | $pathLeaf = new TypePathPart($attribute->getName()); |
| 27 | - $typePath = new TypePath([ $pathLeaf ]); |
|
| 27 | + $typePath = new TypePath([$pathLeaf]); |
|
| 28 | 28 | while ($currentAttribute) { |
| 29 | 29 | $pathPart = new TypePathPart($currentAttribute->getName(), $currentType->getPrefix()); |
| 30 | 30 | $typePath = $typePath->push($pathPart); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | public function __construct(iterable $pathParts = null) |
| 43 | 43 | { |
| 44 | 44 | $this->internalVector = new Vector( |
| 45 | - (function (TypePathPart ...$pathParts): array { |
|
| 45 | + (function(TypePathPart ...$pathParts): array { |
|
| 46 | 46 | return $pathParts; |
| 47 | 47 | })(...$pathParts ?? []) |
| 48 | 48 | ); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function __toString(): string |
| 92 | 92 | { |
| 93 | - $flattenPath = function (string $path, TypePathPart $pathPart): string { |
|
| 93 | + $flattenPath = function(string $path, TypePathPart $pathPart): string { |
|
| 94 | 94 | return empty($path) ? (string)$pathPart : "$path-$pathPart"; |
| 95 | 95 | }; |
| 96 | 96 | return $this->internalVector->reduce($flattenPath, ""); |
@@ -41,16 +41,16 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public static function create(): TypePathParser |
| 43 | 43 | { |
| 44 | - $mapToken = function (string $token): array { |
|
| 44 | + $mapToken = function(string $token): array { |
|
| 45 | 45 | switch ($token) { |
| 46 | 46 | case ".": |
| 47 | - return [ self::T_COMPONENT_SEP, $token ]; |
|
| 47 | + return [self::T_COMPONENT_SEP, $token]; |
|
| 48 | 48 | case "-": |
| 49 | - return [ self::T_PART_SEP, $token ]; |
|
| 49 | + return [self::T_PART_SEP, $token]; |
|
| 50 | 50 | default: |
| 51 | 51 | return preg_match("/[a-z_]+/", $token) |
| 52 | - ? [ self::T_TYPE, $token ] |
|
| 53 | - : [ self::T_UNKNOWN, $token ]; |
|
| 52 | + ? [self::T_TYPE, $token] |
|
| 53 | + : [self::T_UNKNOWN, $token]; |
|
| 54 | 54 | } |
| 55 | 55 | }; |
| 56 | 56 | $lexer = new SimpleLexer(self::TOKEN_REGEX, self::TOKEN_MAP, $mapToken); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * @return null|TypePathPart |
| 84 | 84 | */ |
| 85 | - private function consumePathPart(): ?TypePathPart |
|
| 85 | + private function consumePathPart(): ? TypePathPart |
|
| 86 | 86 | { |
| 87 | 87 | if ($this->lexer->isNext(self::T_PART_SEP)) { |
| 88 | 88 | $this->match(self::T_PART_SEP); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | /** |
| 37 | 37 | * {@inheritdoc} |
| 38 | 38 | */ |
| 39 | - public function getParent(): ?AttributeInterface |
|
| 39 | + public function getParent(): ? AttributeInterface |
|
| 40 | 40 | { |
| 41 | 41 | return $this->getEntityType()->getParentAttribute(); |
| 42 | 42 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * Returns the attribute"s parent, if it has one. |
| 45 | 45 | * @return null|AttributeInterface |
| 46 | 46 | */ |
| 47 | - public function getParent(): ?AttributeInterface; |
|
| 47 | + public function getParent(): ? AttributeInterface; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Return information reflecting the attribute's value e.g. VO class or allowed nested-types |