@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | /** |
135 | 135 | * @param string $policiesName |
136 | 136 | * @param string $class |
137 | - * @param array $methods |
|
137 | + * @param string[] $methods |
|
138 | 138 | * @param string|null $resourcesType |
139 | 139 | * |
140 | 140 | * @return PolicyInterface |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | /** |
180 | 180 | * @param string|int $key |
181 | - * @param string|int|null $value |
|
181 | + * @param null|string $value |
|
182 | 182 | * |
183 | 183 | * @return TargetInterface |
184 | 184 | */ |
@@ -69,7 +69,7 @@ |
||
69 | 69 | { |
70 | 70 | is_dir($folderPath) === true ?: $this->throwEx(new FileSystemException()); |
71 | 71 | |
72 | - $iterator = call_user_func(function () use ($folderPath) { |
|
72 | + $iterator = call_user_func(function() use ($folderPath) { |
|
73 | 73 | foreach (new DirectoryIterator($folderPath) as $directoryIterator) { |
74 | 74 | /** @var DirectoryIterator $directoryIterator */ |
75 | 75 | if ($directoryIterator->isDot() === false) { |
@@ -171,7 +171,7 @@ |
||
171 | 171 | $nextIndex = 0; |
172 | 172 | $hashMap = []; // hash => index |
173 | 173 | $settingsData = []; // index => instance data |
174 | - $getIndex = function (SettingsInterface $instance) use (&$nextIndex, &$hashMap, &$settingsData): int { |
|
174 | + $getIndex = function(SettingsInterface $instance) use (&$nextIndex, &$hashMap, &$settingsData): int { |
|
175 | 175 | $hash = spl_object_hash($instance); |
176 | 176 | if (array_key_exists($hash, $hashMap) === true) { |
177 | 177 | $index = $hashMap[$hash]; |
@@ -54,7 +54,7 @@ |
||
54 | 54 | private function checkDoNotHaveRequiredParametersOnCreate(string $className): bool |
55 | 55 | { |
56 | 56 | try { |
57 | - $reflection = new ReflectionClass($className); |
|
57 | + $reflection = new ReflectionClass($className); |
|
58 | 58 | if ($reflection->isInstantiable() === false) { |
59 | 59 | throw new InvalidSettingsClassException($className); |
60 | 60 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public static function configureContainer(LimoncelloContainerInterface $container) |
33 | 33 | { |
34 | - $container[FileSystemInterface::class] = function () { |
|
34 | + $container[FileSystemInterface::class] = function() { |
|
35 | 35 | return new FileSystem(); |
36 | 36 | }; |
37 | 37 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function configureContainer(LimoncelloContainerInterface $container) |
39 | 39 | { |
40 | - $container[ModelSchemeInfoInterface::class] = function (PsrContainerInterface $container) { |
|
40 | + $container[ModelSchemeInfoInterface::class] = function(PsrContainerInterface $container) { |
|
41 | 41 | $settings = $container->get(SettingsProviderInterface::class)->get(DataSettings::class); |
42 | 42 | $data = $settings[DataSettings::KEY_MODELS_SCHEME_INFO]; |
43 | 43 | $schemes = new ModelSchemeInfo(); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $schemes; |
47 | 47 | }; |
48 | 48 | |
49 | - $container[Connection::class] = function (PsrContainerInterface $container) { |
|
49 | + $container[Connection::class] = function(PsrContainerInterface $container) { |
|
50 | 50 | $settings = $container->get(SettingsProviderInterface::class)->get(DoctrineSettings::class); |
51 | 51 | $params = array_filter([ |
52 | 52 | 'driver' => $settings[DoctrineSettings::KEY_DRIVER] ?? null, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'url' => $settings[DoctrineSettings::KEY_URL] ?? null, |
59 | 59 | 'memory' => $settings[DoctrineSettings::KEY_MEMORY] ?? null, |
60 | 60 | 'charset' => $settings[DoctrineSettings::KEY_CHARSET] ?? 'UTF8', |
61 | - ], function ($value) { |
|
61 | + ], function($value) { |
|
62 | 62 | return $value !== null; |
63 | 63 | }); |
64 | 64 | $extra = $settings[DoctrineSettings::KEY_EXTRA] ?? []; |
@@ -96,7 +96,7 @@ |
||
96 | 96 | |
97 | 97 | $registered = []; |
98 | 98 | $modelSchemes = new ModelSchemeInfo(); |
99 | - $registerModel = function ($modelClass) use ($modelSchemes, &$registered, $requireReverseRel) { |
|
99 | + $registerModel = function($modelClass) use ($modelSchemes, &$registered, $requireReverseRel) { |
|
100 | 100 | /** @var ModelInterface $modelClass */ |
101 | 101 | $modelSchemes->registerClass( |
102 | 102 | $modelClass, |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function configureContainer(LimoncelloContainerInterface $container) |
42 | 42 | { |
43 | - $container[AnalyzerInterface::class] = function (PsrContainerInterface $container) { |
|
43 | + $container[AnalyzerInterface::class] = function(PsrContainerInterface $container) { |
|
44 | 44 | $settingsProvider = $container->get(SettingsProviderInterface::class); |
45 | 45 | $appSettings = $settingsProvider->get(A::class); |
46 | 46 | $corsSettings = $settingsProvider->get(C::class); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return $analyzer; |
55 | 55 | }; |
56 | 56 | |
57 | - $container[CorsStorageInterface::class] = function () { |
|
57 | + $container[CorsStorageInterface::class] = function() { |
|
58 | 58 | return new CorsStorage(); |
59 | 59 | }; |
60 | 60 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $routeConfigurators = []; |
95 | 95 | if (empty($method) === false && empty($path) === false) { |
96 | - list(, , , , , $routeConfigurators) = $this->initRouter($coreSettings)->match($method, $path); |
|
96 | + list(,,,,, $routeConfigurators) = $this->initRouter($coreSettings)->match($method, $path); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // configure container |
@@ -164,21 +164,21 @@ discard block |
||
164 | 164 | { |
165 | 165 | error_reporting(E_ALL); |
166 | 166 | |
167 | - $createHandler = function () use ($container) { |
|
167 | + $createHandler = function() use ($container) { |
|
168 | 168 | $has = $container->has(ExceptionHandlerInterface::class); |
169 | 169 | $handler = $has === true ? $container->get(ExceptionHandlerInterface::class) : new DefaultHandler(); |
170 | 170 | |
171 | 171 | return $handler; |
172 | 172 | }; |
173 | 173 | |
174 | - $throwableHandler = function (Throwable $throwable) use ($sapi, $container, $createHandler) { |
|
174 | + $throwableHandler = function(Throwable $throwable) use ($sapi, $container, $createHandler) { |
|
175 | 175 | /** @var ExceptionHandlerInterface $handler */ |
176 | 176 | /** @noinspection PhpParamsInspection */ |
177 | 177 | $handler = $createHandler(); |
178 | 178 | $handler->handleThrowable($throwable, $sapi, $container); |
179 | 179 | }; |
180 | 180 | |
181 | - $exceptionHandler = function (Exception $exception) use ($sapi, $container, $createHandler) { |
|
181 | + $exceptionHandler = function(Exception $exception) use ($sapi, $container, $createHandler) { |
|
182 | 182 | /** @var ExceptionHandlerInterface $handler */ |
183 | 183 | /** @noinspection PhpParamsInspection */ |
184 | 184 | $handler = $createHandler(); |
@@ -187,14 +187,14 @@ discard block |
||
187 | 187 | |
188 | 188 | set_exception_handler(PHP_MAJOR_VERSION >= 7 ? $throwableHandler : $exceptionHandler); |
189 | 189 | |
190 | - set_error_handler(function ($severity, $message, $fileName, $lineNumber) use ($exceptionHandler) { |
|
190 | + set_error_handler(function($severity, $message, $fileName, $lineNumber) use ($exceptionHandler) { |
|
191 | 191 | $errorException = new ErrorException($message, 0, $severity, $fileName, $lineNumber); |
192 | 192 | $exceptionHandler($errorException); |
193 | 193 | throw $errorException; |
194 | 194 | }); |
195 | 195 | |
196 | 196 | // handle fatal error |
197 | - register_shutdown_function(function () use ($container, $createHandler) { |
|
197 | + register_shutdown_function(function() use ($container, $createHandler) { |
|
198 | 198 | $error = error_get_last(); |
199 | 199 | if ($error !== null && ((int)$error['type'] & (E_ERROR | E_COMPILE_ERROR))) { |
200 | 200 | /** @var ExceptionHandlerInterface $handler */ |