1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * This file is part of the box project. |
||
7 | * |
||
8 | * (c) Kevin Herrera <[email protected]> |
||
9 | * Théo Fidry <[email protected]> |
||
10 | * |
||
11 | * This source file is subject to the MIT license that is bundled |
||
12 | * with this source code in the file LICENSE. |
||
13 | */ |
||
14 | |||
15 | namespace KevinGH\Box\Console; |
||
16 | |||
17 | use KevinGH\Box\Configuration\NoConfigurationFound; |
||
18 | use KevinGH\Box\NotInstantiable; |
||
19 | use function file_exists; |
||
20 | use function realpath; |
||
21 | |||
22 | /** |
||
23 | * @private |
||
24 | */ |
||
25 | final class ConfigurationLocator |
||
26 | { |
||
27 | use NotInstantiable; |
||
28 | |||
29 | private const FILE_NAME = 'box.json'; |
||
30 | |||
31 | /** |
||
32 | * @var list<non-empty-string> |
||
0 ignored issues
–
show
|
|||
33 | */ |
||
34 | private static array $candidates; |
||
35 | |||
36 | public static function findDefaultPath(): string |
||
37 | { |
||
38 | if (!isset(self::$candidates)) { |
||
39 | self::$candidates = [ |
||
0 ignored issues
–
show
It seems like
array(self::FILE_NAME, self::FILE_NAME . '.dist') of type array<integer,string> is incompatible with the declared type KevinGH\Box\Console\list of property $candidates .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
40 | self::FILE_NAME, |
||
41 | self::FILE_NAME.'.dist', |
||
42 | ]; |
||
43 | } |
||
44 | |||
45 | foreach (self::$candidates as $candidate) { |
||
46 | if (file_exists($candidate)) { |
||
47 | return realpath($candidate); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | throw new NoConfigurationFound(); |
||
52 | } |
||
53 | } |
||
54 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths