| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 20 | function listClassesInDirectories(string ...$directories): iterable |
||
| 21 | { |
||
| 22 | 2 | $sourceLocator = new AggregateSourceLocator([ |
|
| 23 | 2 | new DirectoriesSourceLocator( |
|
| 24 | 2 | $directories, |
|
|
|
|||
| 25 | 2 | (new BetterReflection())->astLocator() |
|
| 26 | ), |
||
| 27 | // ↓ required to autoload parent classes/interface from another directory than /src (e.g. /vendor) |
||
| 28 | 2 | new AutoloadSourceLocator((new BetterReflection())->astLocator()), |
|
| 29 | ]); |
||
| 30 | |||
| 31 | 2 | foreach ((new ClassReflector($sourceLocator))->getAllClasses() as $class) { |
|
| 32 | 2 | yield $class->getName(); |
|
| 33 | } |
||
| 34 | 2 | } |
|
| 35 | |||
| 47 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: