1 | <?php |
||
9 | class ApiVersionFeaturesProvider |
||
10 | { |
||
11 | /** |
||
12 | * @var ApiVersionProvider |
||
13 | */ |
||
14 | protected $apiVersionProvider; |
||
15 | |||
16 | /** |
||
17 | * @var Definition[] |
||
18 | */ |
||
19 | protected $features; |
||
20 | |||
21 | /** |
||
22 | * @param ApiVersionProvider $apiVersionProvider |
||
23 | */ |
||
24 | 10 | public function __construct(ApiVersionProvider $apiVersionProvider) |
|
30 | |||
31 | /** |
||
32 | * @param string $name |
||
33 | * @param null|string $since |
||
34 | * @param null|string $until |
||
35 | * |
||
36 | * @throws \InvalidArgumentException When feature with given name already exists |
||
37 | */ |
||
38 | 1 | public function addFeature(string $name, ?string $since, ?string $until): void |
|
50 | |||
51 | /** |
||
52 | * @param iterable $features [string featureName => array featureRange ['since' => numeric|nll, 'until' => numeric|null] ] |
||
53 | * |
||
54 | * @throws \InvalidArgumentException When feature with given name already exists |
||
55 | */ |
||
56 | 10 | public function addFeatures(iterable $features): void |
|
72 | |||
73 | /** |
||
74 | * @param string $name |
||
75 | * |
||
76 | * @return null|Definition |
||
77 | */ |
||
78 | 1 | public function getFeature(string $name): ?Definition |
|
82 | |||
83 | /** |
||
84 | * @return Definition[] |
||
85 | */ |
||
86 | 1 | public function getAllKnownFeatures(): array |
|
90 | |||
91 | /** |
||
92 | * @param Definition $definition |
||
93 | * |
||
94 | * @throws \RuntimeException When API version is not set |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function isFeatureAvailable(Definition $definition): bool |
||
102 | |||
103 | /** |
||
104 | * @throws \RuntimeException When API version is not set |
||
105 | * |
||
106 | * @return Definition[] |
||
107 | */ |
||
108 | 3 | public function getAvailableFeatures(): array |
|
126 | |||
127 | /** |
||
128 | * @param null|string $string |
||
129 | * |
||
130 | * @throws \InvalidArgumentException When $string is not version compatible |
||
131 | */ |
||
132 | 10 | protected function assertVersionCompatibleString(?string $string): void |
|
140 | } |
||
141 |
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: