1 | <?php |
||
21 | abstract class Core |
||
22 | { |
||
23 | /** |
||
24 | * Defines list of bootloaders to be used for core initialisation and all system components. |
||
25 | */ |
||
26 | protected const SYSTEM = [CoreBootloader::class]; |
||
27 | |||
28 | /** |
||
29 | * List of bootloaders to be called on application initialization (before `serve` method). |
||
30 | * This constant must be redefined in child application. |
||
31 | */ |
||
32 | protected const LOAD = []; |
||
33 | |||
34 | /** @var Container */ |
||
35 | protected $container; |
||
36 | |||
37 | /** @var BootloadManager */ |
||
38 | protected $bootloader; |
||
39 | |||
40 | /** @var DispatcherInterface[] */ |
||
41 | private $dispatchers = []; |
||
42 | |||
43 | /** |
||
44 | * @param Container $container |
||
45 | * @param array $directories |
||
46 | */ |
||
47 | public function __construct(Container $container, array $directories) |
||
62 | |||
63 | /** |
||
64 | * Add new dispatcher. This method must only be called before method `serve` |
||
65 | * will be invoked. |
||
66 | * |
||
67 | * @param DispatcherInterface $dispatcher |
||
68 | */ |
||
69 | public function addDispatcher(DispatcherInterface $dispatcher) |
||
73 | |||
74 | /** |
||
75 | * Start application and serve user requests using selected dispatcher or throw |
||
76 | * an exception. |
||
77 | * |
||
78 | * @throws FrameworkException |
||
79 | */ |
||
80 | public function serve() |
||
91 | |||
92 | /** |
||
93 | * Bootstrap application. Must be executed before start method. |
||
94 | */ |
||
95 | abstract protected function bootstrap(); |
||
96 | |||
97 | /** |
||
98 | * Normalizes directory list and adds all required alises. |
||
99 | * |
||
100 | * @param array $directories |
||
101 | * @return array |
||
102 | */ |
||
103 | protected function mapDirectories(array $directories): array |
||
126 | |||
127 | /** |
||
128 | * Bootload all registered classes using BootloadManager. |
||
129 | * |
||
130 | * @return self |
||
131 | */ |
||
132 | private function bootload(): self |
||
137 | |||
138 | /** |
||
139 | * Initiate application core. |
||
140 | * |
||
141 | * @param array $directories Spiral directories should include root, libraries and application |
||
142 | * directories. |
||
143 | * @param EnvironmentInterface $environment Application specific environment if any. |
||
144 | * @param bool $handleErrors Enable global error handling. |
||
145 | * @return self |
||
146 | */ |
||
147 | public static function init( |
||
172 | } |
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: