@@ -23,8 +23,8 @@ |
||
23 | 23 | * |
24 | 24 | * @return string |
25 | 25 | */ |
26 | - private function getVisibility(ClassMethod|ClassConst|Property $node): string { |
|
27 | - return match (true) { |
|
26 | + private function getVisibility(ClassMethod | ClassConst | Property $node): string { |
|
27 | + return match(true) { |
|
28 | 28 | $node->isPrivate() => AbstractPhpMember::VISIBILITY_PRIVATE, |
29 | 29 | $node->isProtected() => AbstractPhpMember::VISIBILITY_PROTECTED, |
30 | 30 | default => AbstractPhpMember::VISIBILITY_PUBLIC |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | private function parseValue(ValueInterface $obj, Node $node): void { |
43 | 43 | $value = $node instanceof Const_ ? $node->value : $node->default; |
44 | 44 | if ($value !== null) { |
45 | - $this->isPrimitive($value) ? $obj->setValue($this->getPrimitiveValue($value)) : |
|
46 | - $obj->setExpression($this->getExpression($value)); |
|
45 | + $this->isPrimitive($value) ? $obj->setValue($this->getPrimitiveValue($value)) : $obj->setExpression($this->getExpression($value)); |
|
47 | 46 | } |
48 | 47 | } |
49 | 48 | |
@@ -125,7 +124,7 @@ discard block |
||
125 | 124 | * @return mixed |
126 | 125 | */ |
127 | 126 | private function getExpression(Node $node): mixed { |
128 | - return match (true) { |
|
127 | + return match(true) { |
|
129 | 128 | $node instanceof ConstFetch => $this->constMap[$node->name->parts[0]] ?? $node->name->parts[0], |
130 | 129 | $node instanceof ClassConstFetch => (!$node->class instanceof Node\Name ?: $node->class->parts[0]) . '::' . $node->name, |
131 | 130 | $node instanceof MagicConst => $node->getName(), |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->struct = $struct; |
42 | 42 | } |
43 | 43 | |
44 | - public function parseDocblock(AbstractPhpStruct|AbstractPhpMember|PhpConstant $model, ?Doc $doc = null): void { |
|
44 | + public function parseDocblock(AbstractPhpStruct | AbstractPhpMember | PhpConstant $model, ?Doc $doc = null): void { |
|
45 | 45 | if ($doc !== null) { |
46 | 46 | $model->setDocblock($doc->getReformattedText()); |
47 | 47 | $docblock = $model->getDocblock(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | public function visitUseStatement(UseUse $node): void { |
73 | - $this->struct->addUseStatement(implode('\\', $node->name->parts), (string) $node->alias?->name); |
|
73 | + $this->struct->addUseStatement(implode('\\', $node->name->parts), (string) $node->alias ? ->name); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function visitClass(Class_ $node): void { |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | |
28 | 28 | trait TypeParserPart { |
29 | 29 | public function parseType( |
30 | - PhpMethod|PhpProperty|PhpParameter $object, ClassMethod|Property|Param $node, Docblock $docblock |
|
30 | + PhpMethod | PhpProperty | PhpParameter $object, ClassMethod | Property | Param $node, Docblock $docblock |
|
31 | 31 | ): void { |
32 | 32 | $nodeType = $node instanceof ClassMethod ? $node->returnType : $node->type; |
33 | 33 | |
34 | - $type = match (true) { |
|
34 | + $type = match(true) { |
|
35 | 35 | is_string($nodeType) => $nodeType, |
36 | 36 | $nodeType === null => '', |
37 | 37 | $nodeType instanceof Name, $nodeType instanceof Identifier => $this->getNameOrIdentifier($nodeType), |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | |
42 | 42 | $object->setType($type); |
43 | 43 | |
44 | - $tag = match (true) { |
|
44 | + $tag = match(true) { |
|
45 | 45 | $object instanceof PhpMethod => $docblock->getTags('return')->get(0), |
46 | 46 | $object instanceof PhpProperty => $docblock->getTags('var')->get(0), |
47 | 47 | $object instanceof PhpParameter => $docblock->getTags('param')->find($object->getName(), |
48 | - fn (ParamTag $element, string $name): bool => $element->getVariable() === $name |
|
48 | + fn(ParamTag $element, string $name): bool => $element->getVariable() === $name |
|
49 | 49 | ) |
50 | 50 | }; |
51 | 51 | $this->setTypeFromTag($object, $tag); |
52 | 52 | } |
53 | 53 | |
54 | - private function getNullableType(PhpMethod|PhpProperty|PhpParameter $object, NullableType $type): string { |
|
54 | + private function getNullableType(PhpMethod | PhpProperty | PhpParameter $object, NullableType $type): string { |
|
55 | 55 | $object->setNullable(true); |
56 | 56 | |
57 | 57 | return $this->getNameOrIdentifier($type->type); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | return implode('|', array_map([$this, 'getNameOrIdentifier'], $types)); |
62 | 62 | } |
63 | 63 | |
64 | - private function getNameOrIdentifier(Identifier|Name $type): string { |
|
65 | - return match (true) { |
|
64 | + private function getNameOrIdentifier(Identifier | Name $type): string { |
|
65 | + return match(true) { |
|
66 | 66 | $type instanceof Name => ($type->isFullyQualified() ? '\\' : '') . implode('\\', $type->parts), |
67 | 67 | $type instanceof Identifier => $type->name, |
68 | 68 | }; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param PhpMethod|PhpProperty|PhpParameter|PhpConstant $object |
76 | 76 | * @param ReturnTag|VarTag|ParamTag|null $tag |
77 | 77 | */ |
78 | - private function setTypeFromTag(PhpMethod|PhpProperty|PhpParameter|PhpConstant $object, null|ReturnTag|VarTag|ParamTag $tag) { |
|
78 | + private function setTypeFromTag(PhpMethod | PhpProperty | PhpParameter | PhpConstant $object, null | ReturnTag | VarTag | ParamTag $tag) { |
|
79 | 79 | if ($tag !== null) { |
80 | 80 | if ($object->getType() === '') { |
81 | 81 | $object->setType($tag->getType()); |