| 1 | <?php |
||
| 8 | abstract class BaseExample |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The Random.org API bridge. |
||
| 12 | * |
||
| 13 | * @var \drupol\Yaroc\RandomOrgAPI |
||
| 14 | */ |
||
| 15 | private $randomOrgAPI; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * BaseExample constructor. |
||
| 19 | */ |
||
| 20 | public function __construct() |
||
| 21 | { |
||
| 22 | $key = '00000000-0000-0000-0000-000000000000'; |
||
| 23 | if (file_exists('./apikey') && $fileKey = file_get_contents('./apikey')) { |
||
| 24 | $key = $fileKey; |
||
| 25 | } |
||
| 26 | |||
| 27 | $this->randomOrgAPI = (new RandomOrgAPI([]))->withApiKey($key); |
||
|
|
|||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get the Random.org API bridge. |
||
| 32 | * |
||
| 33 | * @return \drupol\Yaroc\RandomOrgAPI |
||
| 34 | */ |
||
| 35 | public function getRandomOrgAPI() |
||
| 39 | |||
| 40 | public function getHttpClient() |
||
| 44 | } |
||
| 45 |
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: