@@ -98,6 +98,7 @@ |
||
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Gets Namespace from the project if it exists, otherwise returns a new namepace |
101 | + * @param string $name |
|
101 | 102 | */ |
102 | 103 | private function getNamespaceByName(Project $project, $name): Namespace_ |
103 | 104 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | foreach ($project->getFiles() as $file) { |
92 | 92 | foreach ($file->getNamespaces() as $namespaceFqsen) { |
93 | - $namespace = $this->getNamespaceByName($project, (string) $namespaceFqsen); |
|
93 | + $namespace = $this->getNamespaceByName($project, (string)$namespaceFqsen); |
|
94 | 94 | $this->buildNamespace($file, $namespace); |
95 | 95 | } |
96 | 96 | } |
@@ -118,31 +118,31 @@ discard block |
||
118 | 118 | private function buildNamespace(File $file, Namespace_ $namespace): void |
119 | 119 | { |
120 | 120 | foreach ($file->getClasses() as $class) { |
121 | - if ($namespace->getFqsen() . '\\' . $class->getName() === (string) $class->getFqsen()) { |
|
121 | + if ($namespace->getFqsen().'\\'.$class->getName() === (string)$class->getFqsen()) { |
|
122 | 122 | $namespace->addClass($class->getFqsen()); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | 126 | foreach ($file->getInterfaces() as $interface) { |
127 | - if ($namespace->getFqsen() . '\\' . $interface->getName() === (string) $interface->getFqsen()) { |
|
127 | + if ($namespace->getFqsen().'\\'.$interface->getName() === (string)$interface->getFqsen()) { |
|
128 | 128 | $namespace->addInterface($interface->getFqsen()); |
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | 132 | foreach ($file->getFunctions() as $function) { |
133 | - if ($namespace->getFqsen() . '\\' . $function->getName() . '()' === (string) $function->getFqsen()) { |
|
133 | + if ($namespace->getFqsen().'\\'.$function->getName().'()' === (string)$function->getFqsen()) { |
|
134 | 134 | $namespace->addFunction($function->getFqsen()); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | 138 | foreach ($file->getConstants() as $constant) { |
139 | - if ($namespace->getFqsen() . '::' . $constant->getName() === (string) $constant->getFqsen()) { |
|
139 | + if ($namespace->getFqsen().'::'.$constant->getName() === (string)$constant->getFqsen()) { |
|
140 | 140 | $namespace->addConstant($constant->getFqsen()); |
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | 144 | foreach ($file->getTraits() as $trait) { |
145 | - if ($namespace->getFqsen() . '\\' . $trait->getName() === (string) $trait->getFqsen()) { |
|
145 | + if ($namespace->getFqsen().'\\'.$trait->getName() === (string)$trait->getFqsen()) { |
|
146 | 146 | $namespace->addTrait($trait->getFqsen()); |
147 | 147 | } |
148 | 148 | } |
@@ -14,7 +14,6 @@ |
||
14 | 14 | |
15 | 15 | use Mockery as m; |
16 | 16 | use phpDocumentor\Reflection\File\LocalFile; |
17 | -use phpDocumentor\Reflection\Php\Factory\File; |
|
18 | 17 | use phpDocumentor\Reflection\Php\ProjectFactory; |
19 | 18 | use PHPUnit\Framework\TestCase; |
20 | 19 |
@@ -111,6 +111,7 @@ |
||
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Resets the state of the object to an empty state. |
114 | + * @param string $namespace |
|
114 | 115 | */ |
115 | 116 | private function resetState(?string $namespace = null): void |
116 | 117 | { |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | { |
78 | 78 | switch (get_class($node)) { |
79 | 79 | case Namespace_::class: |
80 | - $this->resetState('\\' . $node->name . '\\'); |
|
80 | + $this->resetState('\\'.$node->name.'\\'); |
|
81 | 81 | $node->fqsen = new Fqsen($this->buildName()); |
82 | 82 | break; |
83 | 83 | case Class_::class: |
84 | 84 | case Trait_::class: |
85 | 85 | case Interface_::class: |
86 | - $this->parts->push((string) $node->name); |
|
86 | + $this->parts->push((string)$node->name); |
|
87 | 87 | |
88 | 88 | if (empty($node->name)) { |
89 | 89 | return NodeTraverser::DONT_TRAVERSE_CHILDREN; |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | $node->fqsen = new Fqsen($this->buildName()); |
93 | 93 | break; |
94 | 94 | case Function_::class: |
95 | - $this->parts->push($node->name . '()'); |
|
95 | + $this->parts->push($node->name.'()'); |
|
96 | 96 | $node->fqsen = new Fqsen($this->buildName()); |
97 | 97 | break; |
98 | 98 | case ClassMethod::class: |
99 | - $this->parts->push('::' . $node->name . '()'); |
|
99 | + $this->parts->push('::'.$node->name.'()'); |
|
100 | 100 | $node->fqsen = new Fqsen($this->buildName()); |
101 | 101 | break; |
102 | 102 | case ClassConst::class: |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $node->fqsen = new Fqsen($this->buildName()); |
108 | 108 | break; |
109 | 109 | case PropertyProperty::class: |
110 | - $this->parts->push('::$' . $node->name); |
|
110 | + $this->parts->push('::$'.$node->name); |
|
111 | 111 | $node->fqsen = new Fqsen($this->buildName()); |
112 | 112 | break; |
113 | 113 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | ); |
35 | 35 | } |
36 | 36 | |
37 | - $lastCallable = function ($command) use ($middleware, $lastCallable) { |
|
37 | + $lastCallable = function($command) use ($middleware, $lastCallable) { |
|
38 | 38 | return $middleware->execute($command, $lastCallable); |
39 | 39 | }; |
40 | 40 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $classElement = new ClassElement( |
63 | 63 | $object->fqsen, |
64 | 64 | $docBlock, |
65 | - $object->extends ? new Fqsen('\\' . $object->extends) : null, |
|
65 | + $object->extends ? new Fqsen('\\'.$object->extends) : null, |
|
66 | 66 | $object->isAbstract(), |
67 | 67 | $object->isFinal(), |
68 | 68 | new Location($object->getLine()) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (isset($object->implements)) { |
72 | 72 | foreach ($object->implements as $interfaceClassName) { |
73 | 73 | $classElement->addInterface( |
74 | - new Fqsen('\\' . $interfaceClassName->toString()) |
|
74 | + new Fqsen('\\'.$interfaceClassName->toString()) |
|
75 | 75 | ); |
76 | 76 | } |
77 | 77 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | switch (get_class($stmt)) { |
82 | 82 | case TraitUse::class: |
83 | 83 | foreach ($stmt->traits as $use) { |
84 | - $classElement->addUsedTrait(new Fqsen('\\' . $use->toString())); |
|
84 | + $classElement->addUsedTrait(new Fqsen('\\'.$use->toString())); |
|
85 | 85 | } |
86 | 86 | break; |
87 | 87 | case PropertyNode::class: |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); |
59 | 59 | $parents = []; |
60 | 60 | foreach ($object->extends as $extend) { |
61 | - $parents['\\' . (string) $extend] = new Fqsen('\\' . (string) $extend); |
|
61 | + $parents['\\'.(string)$extend] = new Fqsen('\\'.(string)$extend); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $interface = new InterfaceElement($object->fqsen, $parents, $docBlock, new Location($object->getLine())); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | break; |
73 | 73 | case TraitUse::class: |
74 | 74 | foreach ($stmt->traits as $use) { |
75 | - $trait->addUsedTrait(new Fqsen('\\' . $use->toString())); |
|
75 | + $trait->addUsedTrait(new Fqsen('\\'.$use->toString())); |
|
76 | 76 | } |
77 | 77 | break; |
78 | 78 | } |
@@ -56,9 +56,9 @@ |
||
56 | 56 | if ($object->getReturnType() !== null) { |
57 | 57 | $typeResolver = new TypeResolver(); |
58 | 58 | if ($object->getReturnType() instanceof NullableType) { |
59 | - $typeString = '?' . $object->getReturnType()->type; |
|
59 | + $typeString = '?'.$object->getReturnType()->type; |
|
60 | 60 | } else { |
61 | - $typeString = (string) $object->getReturnType(); |
|
61 | + $typeString = (string)$object->getReturnType(); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $returnType = $typeResolver->resolve($typeString, $context); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function addInterface(Fqsen $interface): void |
134 | 134 | { |
135 | - $this->implements[(string) $interface] = $interface; |
|
135 | + $this->implements[(string)$interface] = $interface; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function addConstant(Constant $constant): void |
152 | 152 | { |
153 | - $this->constants[(string) $constant->getFqsen()] = $constant; |
|
153 | + $this->constants[(string)$constant->getFqsen()] = $constant; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function addMethod(Method $method): void |
170 | 170 | { |
171 | - $this->methods[(string) $method->getFqsen()] = $method; |
|
171 | + $this->methods[(string)$method->getFqsen()] = $method; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function addProperty(Property $property): void |
188 | 188 | { |
189 | - $this->properties[(string) $property->getFqsen()] = $property; |
|
189 | + $this->properties[(string)$property->getFqsen()] = $property; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function addUsedTrait(Fqsen $fqsen): void |
206 | 206 | { |
207 | - $this->usedTraits[(string) $fqsen] = $fqsen; |
|
207 | + $this->usedTraits[(string)$fqsen] = $fqsen; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |