| 1 | <?php |
||
| 15 | class ConfiguredClientsStrategy implements DiscoveryStrategy |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var HttpClient |
||
| 19 | */ |
||
| 20 | private static $client; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param HttpClient $httpClient |
||
| 24 | */ |
||
| 25 | public function __construct(HttpClient $httpClient) |
||
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | */ |
||
| 35 | public static function getCandidates($type) |
||
| 43 | } |
||
| 44 |
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
SomeClassto useselfinstead: