@@ -117,6 +117,7 @@ |
||
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Resets the state of the object to an empty state. |
120 | + * @param string $namespace |
|
120 | 121 | */ |
121 | 122 | private function resetState(?string $namespace = null) : void |
122 | 123 | { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | switch (get_class($node)) { |
80 | 80 | case Namespace_::class: |
81 | - $this->resetState('\\' . $node->name . '\\'); |
|
81 | + $this->resetState('\\'.$node->name.'\\'); |
|
82 | 82 | $node->fqsen = new Fqsen($this->buildName()); |
83 | 83 | break; |
84 | 84 | case Class_::class: |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | return NodeTraverser::DONT_TRAVERSE_CHILDREN; |
89 | 89 | } |
90 | 90 | |
91 | - $this->parts->push((string) $node->name); |
|
91 | + $this->parts->push((string)$node->name); |
|
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 | return NodeTraverser::DONT_TRAVERSE_CHILDREN; |
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 | return NodeTraverser::DONT_TRAVERSE_CHILDREN; |
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 | } |
@@ -134,6 +134,6 @@ discard block |
||
134 | 134 | $name .= $part; |
135 | 135 | } |
136 | 136 | |
137 | - return rtrim((string) $name, '\\'); |
|
137 | + return rtrim((string)$name, '\\'); |
|
138 | 138 | } |
139 | 139 | } |
@@ -20,7 +20,6 @@ |
||
20 | 20 | use phpDocumentor\Reflection\Php\Factory\File\CreateCommand; |
21 | 21 | use phpDocumentor\Reflection\Php\File as FileElement; |
22 | 22 | use phpDocumentor\Reflection\Php\NodesFactory; |
23 | -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; |
|
24 | 23 | use phpDocumentor\Reflection\Php\StrategyContainer; |
25 | 24 | use phpDocumentor\Reflection\Types\Context; |
26 | 25 | use phpDocumentor\Reflection\Types\NamespaceNodeToContext; |
@@ -101,6 +101,7 @@ |
||
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Gets Namespace from the project if it exists, otherwise returns a new namepace |
104 | + * @param string $name |
|
104 | 105 | */ |
105 | 106 | private function getNamespaceByName(Project $project, $name) : Namespace_ |
106 | 107 | { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | foreach ($project->getFiles() as $file) { |
95 | 95 | foreach ($file->getNamespaces() as $namespaceFqsen) { |
96 | - $namespace = $this->getNamespaceByName($project, (string) $namespaceFqsen); |
|
96 | + $namespace = $this->getNamespaceByName($project, (string)$namespaceFqsen); |
|
97 | 97 | $this->buildNamespace($file, $namespace); |
98 | 98 | } |
99 | 99 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | private function buildNamespace(File $file, Namespace_ $namespace) : void |
122 | 122 | { |
123 | 123 | foreach ($file->getClasses() as $class) { |
124 | - if ($namespace->getFqsen() . '\\' . $class->getName() !== (string) $class->getFqsen()) { |
|
124 | + if ($namespace->getFqsen().'\\'.$class->getName() !== (string)$class->getFqsen()) { |
|
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | foreach ($file->getInterfaces() as $interface) { |
132 | - if ($namespace->getFqsen() . '\\' . $interface->getName() !== (string) $interface->getFqsen()) { |
|
132 | + if ($namespace->getFqsen().'\\'.$interface->getName() !== (string)$interface->getFqsen()) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | foreach ($file->getFunctions() as $function) { |
140 | - if ($namespace->getFqsen() . '\\' . $function->getName() . '()' !== (string) $function->getFqsen()) { |
|
140 | + if ($namespace->getFqsen().'\\'.$function->getName().'()' !== (string)$function->getFqsen()) { |
|
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | foreach ($file->getConstants() as $constant) { |
148 | - if ($namespace->getFqsen() . '::' . $constant->getName() !== (string) $constant->getFqsen()) { |
|
148 | + if ($namespace->getFqsen().'::'.$constant->getName() !== (string)$constant->getFqsen()) { |
|
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | foreach ($file->getTraits() as $trait) { |
156 | - if ($namespace->getFqsen() . '\\' . $trait->getName() !== (string) $trait->getFqsen()) { |
|
156 | + if ($namespace->getFqsen().'\\'.$trait->getName() !== (string)$trait->getFqsen()) { |
|
157 | 157 | continue; |
158 | 158 | } |
159 | 159 |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array |
35 | 35 | { |
36 | 36 | // flatten(flatten(map(stuff))) |
37 | - return array_merge([], ...array_merge([], ...array_map(static function ($use) : array { |
|
37 | + return array_merge([], ...array_merge([], ...array_map(static function($use) : array { |
|
38 | 38 | /** @var $use Use_|GroupUse */ |
39 | 39 | |
40 | - return array_map(static function (UseUse $useUse) use ($use) : array { |
|
40 | + return array_map(static function(UseUse $useUse) use ($use) : array { |
|
41 | 41 | if ($use instanceof GroupUse) { |
42 | 42 | return [ |
43 | - (string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString(), |
|
43 | + (string)$useUse->getAlias() => $use->prefix->toString().'\\'.$useUse->name->toString(), |
|
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
47 | - return [(string) $useUse->getAlias() => $useUse->name->toString()]; |
|
47 | + return [(string)$useUse->getAlias() => $useUse->name->toString()]; |
|
48 | 48 | }, $use->uses); |
49 | 49 | }, $this->classAlikeUses($namespace)))); |
50 | 50 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | return array_filter( |
58 | 58 | $namespace->stmts ?? [], |
59 | - static function (Node $node) : bool { |
|
59 | + static function(Node $node) : bool { |
|
60 | 60 | return ( |
61 | 61 | $node instanceof Use_ |
62 | 62 | || $node instanceof GroupUse |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function getContents() : string |
48 | 48 | { |
49 | - return (string) file_get_contents($this->path); |
|
49 | + return (string)file_get_contents($this->path); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -38,7 +38,7 @@ |
||
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
41 | - $lastCallable = static function ($command) use ($middleware, $lastCallable) { |
|
41 | + $lastCallable = static function($command) use ($middleware, $lastCallable) { |
|
42 | 42 | return $middleware->execute($command, $lastCallable); |
43 | 43 | }; |
44 | 44 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function addNamespace(Fqsen $fqsen) : void |
105 | 105 | { |
106 | - $this->namespaces[(string) $fqsen] = $fqsen; |
|
106 | + $this->namespaces[(string)$fqsen] = $fqsen; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function addConstant(Constant $constant) : void |
138 | 138 | { |
139 | - $this->constants[(string) $constant->getFqsen()] = $constant; |
|
139 | + $this->constants[(string)$constant->getFqsen()] = $constant; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function addFunction(Function_ $function) : void |
156 | 156 | { |
157 | - $this->functions[(string) $function->getFqsen()] = $function; |
|
157 | + $this->functions[(string)$function->getFqsen()] = $function; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function addClass(Class_ $class) : void |
174 | 174 | { |
175 | - $this->classes[(string) $class->getFqsen()] = $class; |
|
175 | + $this->classes[(string)$class->getFqsen()] = $class; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function addInterface(Interface_ $interface) : void |
192 | 192 | { |
193 | - $this->interfaces[(string) $interface->getFqsen()] = $interface; |
|
193 | + $this->interfaces[(string)$interface->getFqsen()] = $interface; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function addTrait(Trait_ $trait) : void |
210 | 210 | { |
211 | - $this->traits[(string) $trait->getFqsen()] = $trait; |
|
211 | + $this->traits[(string)$trait->getFqsen()] = $trait; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function addInterface(Fqsen $interface) : void |
122 | 122 | { |
123 | - $this->implements[(string) $interface] = $interface; |
|
123 | + $this->implements[(string)$interface] = $interface; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function addConstant(Constant $constant) : void |
140 | 140 | { |
141 | - $this->constants[(string) $constant->getFqsen()] = $constant; |
|
141 | + $this->constants[(string)$constant->getFqsen()] = $constant; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function addMethod(Method $method) : void |
158 | 158 | { |
159 | - $this->methods[(string) $method->getFqsen()] = $method; |
|
159 | + $this->methods[(string)$method->getFqsen()] = $method; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function addProperty(Property $property) : void |
176 | 176 | { |
177 | - $this->properties[(string) $property->getFqsen()] = $property; |
|
177 | + $this->properties[(string)$property->getFqsen()] = $property; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function addUsedTrait(Fqsen $fqsen) : void |
194 | 194 | { |
195 | - $this->usedTraits[(string) $fqsen] = $fqsen; |
|
195 | + $this->usedTraits[(string)$fqsen] = $fqsen; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addMethod(Method $method) : void |
74 | 74 | { |
75 | - $this->methods[(string) $method->getFqsen()] = $method; |
|
75 | + $this->methods[(string)$method->getFqsen()] = $method; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function addProperty(Property $property) : void |
92 | 92 | { |
93 | - $this->properties[(string) $property->getFqsen()] = $property; |
|
93 | + $this->properties[(string)$property->getFqsen()] = $property; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function addUsedTrait(Fqsen $fqsen) : void |
131 | 131 | { |
132 | - $this->usedTraits[(string) $fqsen] = $fqsen; |
|
132 | + $this->usedTraits[(string)$fqsen] = $fqsen; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | public function getLocation() : Location |