|
4 | 4 |
|
5 | 5 | use Nette\DI\Config\Adapter; |
6 | 6 | use Nette\DI\Config\Helpers; |
7 | | -use Nette\DI\Definitions\Reference; |
8 | 7 | use Nette\DI\Definitions\Statement; |
9 | 8 | use Nette\DI\InvalidConfigurationException; |
10 | 9 | use Nette\Neon\Entity; |
|
14 | 13 | use PHPStan\File\FileHelper; |
15 | 14 | use PHPStan\File\FileReader; |
16 | 15 | use function array_values; |
17 | | -use function array_walk_recursive; |
18 | 16 | use function count; |
19 | 17 | use function dirname; |
20 | 18 | use function implode; |
@@ -155,58 +153,6 @@ public function process(array $arr, string $fileKey, string $file): array |
155 | 153 | return $res; |
156 | 154 | } |
157 | 155 |
|
158 | | - /** |
159 | | - * @param mixed[] $data |
160 | | - */ |
161 | | - public function dump(array $data): string |
162 | | - { |
163 | | - array_walk_recursive( |
164 | | - $data, |
165 | | - static function (&$val): void { |
166 | | - if (!($val instanceof Statement)) { |
167 | | - return; |
168 | | - } |
169 | | - |
170 | | - $val = self::statementToEntity($val); |
171 | | - }, |
172 | | - ); |
173 | | - return "# generated by Nette\n\n" . Neon::encode($data, Neon::BLOCK); |
174 | | - } |
175 | | - |
176 | | - private static function statementToEntity(Statement $val): Entity |
177 | | - { |
178 | | - array_walk_recursive( |
179 | | - $val->arguments, |
180 | | - static function (&$val): void { |
181 | | - if ($val instanceof Statement) { |
182 | | - $val = self::statementToEntity($val); |
183 | | - } elseif ($val instanceof Reference) { |
184 | | - $val = '@' . $val->getValue(); |
185 | | - } |
186 | | - }, |
187 | | - ); |
188 | | - |
189 | | - $entity = $val->getEntity(); |
190 | | - if ($entity instanceof Reference) { |
191 | | - $entity = '@' . $entity->getValue(); |
192 | | - } elseif (is_array($entity)) { |
193 | | - if ($entity[0] instanceof Statement) { |
194 | | - return new Entity( |
195 | | - Neon::CHAIN, |
196 | | - [ |
197 | | - self::statementToEntity($entity[0]), |
198 | | - new Entity('::' . $entity[1], $val->arguments), |
199 | | - ], |
200 | | - ); |
201 | | - } elseif ($entity[0] instanceof Reference) { |
202 | | - $entity = '@' . $entity[0]->getValue() . '::' . $entity[1]; |
203 | | - } elseif (is_string($entity[0])) { |
204 | | - $entity = $entity[0] . '::' . $entity[1]; |
205 | | - } |
206 | | - } |
207 | | - return new Entity($entity, $val->arguments); |
208 | | - } |
209 | | - |
210 | 156 | private function createFileHelperByFile(string $file): FileHelper |
211 | 157 | { |
212 | 158 | $dir = dirname($file); |
|
0 commit comments