1 | <?php |
||
7 | class AssetType implements \JsonSerializable, AssetTypeInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private $name; |
||
13 | |||
14 | /** |
||
15 | * @var Asset[] |
||
16 | */ |
||
17 | private $assets = []; |
||
18 | |||
19 | private $sorted = false; |
||
20 | |||
21 | public function __construct(string $name) |
||
25 | |||
26 | /** |
||
27 | * Registers an asset operation. |
||
28 | * Note: it is expected that asset operations will be added in the order of package dependencies. |
||
29 | * Order of assets with same priority will be preserved. |
||
30 | * |
||
31 | * @param AssetOperation $operation |
||
32 | */ |
||
33 | public function addAssetOperation(AssetOperation $operation) |
||
46 | |||
47 | /** |
||
48 | * Sort assets by priority. |
||
49 | */ |
||
50 | private function sortAssets() |
||
63 | |||
64 | /** |
||
65 | * Similar to a usort except that if 2 priorities are equal, order is preserved. |
||
66 | * Shamelessly copied from http://php.net/manual/fr/function.usort.php#38827 |
||
67 | * |
||
68 | * @param $array |
||
69 | * @param string $cmp_function |
||
70 | */ |
||
71 | private function stableSort(&$array, $cmp_function = 'strcmp') |
||
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | public function getName(): string |
||
115 | |||
116 | /** |
||
117 | * @return Asset[] |
||
118 | */ |
||
119 | public function getAssets() : array |
||
124 | |||
125 | /** |
||
126 | * Shortcut to get an array of values of the assets. |
||
127 | * |
||
128 | * @return string[] |
||
129 | */ |
||
130 | public function getValues() : array |
||
136 | |||
137 | /** |
||
138 | * Specify data which should be serialized to JSON |
||
139 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
140 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
141 | * which is a value of any type other than a resource. |
||
142 | * @since 5.4.0 |
||
143 | */ |
||
144 | public function jsonSerialize() |
||
150 | } |
||
151 |
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..