1 | <?php declare(strict_types=1); |
||
28 | class ComposerCommandProvider implements CommandProvider |
||
29 | { |
||
30 | /** |
||
31 | * @var BaseCommand[] |
||
32 | */ |
||
33 | private static $commands = []; |
||
34 | |||
35 | 1 | /** |
|
36 | * @inheritdoc |
||
37 | 1 | */ |
|
38 | public function getCommands() |
||
42 | |||
43 | /** |
||
44 | * @param BaseCommand[] $commands |
||
45 | * |
||
46 | * @return void |
||
47 | 1 | * |
|
48 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
49 | 1 | */ |
|
50 | public static function setCommands(array $commands): void |
||
56 | |||
57 | /** |
||
58 | * @param array $commands |
||
59 | 1 | * |
|
60 | * @return bool |
||
61 | 1 | */ |
|
62 | private static function areCommands(array $commands): bool |
||
72 | } |
||
73 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: