@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | public static function configureContainer(LimoncelloContainerInterface $container): void |
39 | 39 | { |
40 | 40 | $container[ModelSchemeInfoInterface::class] = |
41 | - function (PsrContainerInterface $container): ModelSchemeInfoInterface { |
|
41 | + function(PsrContainerInterface $container): ModelSchemeInfoInterface { |
|
42 | 42 | $settings = $container->get(SettingsProviderInterface::class)->get(DataSettings::class); |
43 | 43 | $data = $settings[DataSettings::KEY_MODELS_SCHEME_INFO]; |
44 | 44 | |
45 | 45 | return (new ModelSchemeInfo())->setData($data); |
46 | 46 | }; |
47 | 47 | |
48 | - $container[Connection::class] = function (PsrContainerInterface $container): Connection { |
|
48 | + $container[Connection::class] = function(PsrContainerInterface $container): Connection { |
|
49 | 49 | $settings = $container->get(SettingsProviderInterface::class)->get(DoctrineSettings::class); |
50 | 50 | $params = array_filter([ |
51 | 51 | 'driver' => $settings[DoctrineSettings::KEY_DRIVER] ?? null, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'memory' => $settings[DoctrineSettings::KEY_MEMORY] ?? null, |
59 | 59 | 'path' => $settings[DoctrineSettings::KEY_PATH] ?? 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] ?? []; |
@@ -73,7 +73,7 @@ |
||
73 | 73 | */ |
74 | 74 | private function handle(Throwable $exception, SapiInterface $sapi, ContainerInterface $container): void |
75 | 75 | { |
76 | - $message = 'Internal Server Error'; |
|
76 | + $message = 'Internal Server Error'; |
|
77 | 77 | |
78 | 78 | $this->logException($exception, $container, $message); |
79 | 79 |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return [ |
101 | 101 | [ |
102 | 102 | static::OPTION_NAME => static::OPT_PATH, |
103 | - static::OPTION_DESCRIPTION => 'Path to a list of migrations or seeds. ' . |
|
103 | + static::OPTION_DESCRIPTION => 'Path to a list of migrations or seeds. '. |
|
104 | 104 | 'If not given a path from settings will be used.', |
105 | 105 | static::OPTION_SHORTCUT => 'i', |
106 | 106 | static::OPTION_MODE => static::OPTION_MODE__REQUIRED, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->createSeedRunner($path, $seedInit)->run($container); |
149 | 149 | break; |
150 | 150 | default: |
151 | - $inOut->writeError("Unsupported action `$action`." . PHP_EOL); |
|
151 | + $inOut->writeError("Unsupported action `$action`.".PHP_EOL); |
|
152 | 152 | break; |
153 | 153 | } |
154 | 154 | } |
@@ -96,7 +96,7 @@ discard block |
||
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, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | foreach ($relationships[RelationshipTypes::BELONGS_TO] as $relName => list($rClass, $fKey, $rRel)) { |
113 | 113 | /** @var string $rClass */ |
114 | 114 | $modelSchemes->registerBelongsToOneRelationship($modelClass, $relName, $fKey, $rClass, $rRel); |
115 | - $registered[(string)$modelClass][$relName] = true; |
|
115 | + $registered[(string) $modelClass][$relName] = true; |
|
116 | 116 | $registered[$rClass][$rRel] = true; |
117 | 117 | |
118 | 118 | // Sanity check. Every `belongs_to` should be paired with `has_many` on the other side. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $rRelationships[RelationshipTypes::HAS_MANY][$rRel] === [$modelClass, $fKey, $relName]); |
124 | 124 | /** @var string $modelClass */ |
125 | 125 | |
126 | - assert($isRelationshipOk, "`belongsTo` relationship `$relName` of class $modelClass " . |
|
126 | + assert($isRelationshipOk, "`belongsTo` relationship `$relName` of class $modelClass ". |
|
127 | 127 | "should be paired with `hasMany` relationship."); |
128 | 128 | } |
129 | 129 | } |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | (isset($rRelationships[RelationshipTypes::BELONGS_TO][$rRel]) === true && |
138 | 138 | $rRelationships[RelationshipTypes::BELONGS_TO][$rRel] === [$modelClass, $fKey, $relName]); |
139 | 139 | /** @var string $modelClass */ |
140 | - assert($isRelationshipOk, "`hasMany` relationship `$relName` of class $modelClass " . |
|
140 | + assert($isRelationshipOk, "`hasMany` relationship `$relName` of class $modelClass ". |
|
141 | 141 | "should be paired with `belongsTo` relationship."); |
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | 145 | if (array_key_exists(RelationshipTypes::BELONGS_TO_MANY, $relationships) === true) { |
146 | 146 | foreach ($relationships[RelationshipTypes::BELONGS_TO_MANY] as $relName => $data) { |
147 | - if (isset($registered[(string)$modelClass][$relName]) === true) { |
|
147 | + if (isset($registered[(string) $modelClass][$relName]) === true) { |
|
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | /** @var string $rClass */ |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $rClass, |
159 | 159 | $rRel |
160 | 160 | ); |
161 | - $registered[(string)$modelClass][$relName] = true; |
|
161 | + $registered[(string) $modelClass][$relName] = true; |
|
162 | 162 | $registered[$rClass][$rRel] = true; |
163 | 163 | } |
164 | 164 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public static function configureContainer(LimoncelloContainerInterface $container): void |
39 | 39 | { |
40 | 40 | $container[CommandStorageInterface::class] = |
41 | - function (PsrContainerInterface $container): CommandStorageInterface { |
|
41 | + function(PsrContainerInterface $container): CommandStorageInterface { |
|
42 | 42 | $creator = new class |
43 | 43 | { |
44 | 44 | use ClassIsTrait; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $providerClasses = $settings[S::KEY_PROVIDER_CLASSES]; |
80 | 80 | $commandsFolder = $settings[S::KEY_COMMANDS_FOLDER]; |
81 | 81 | $commandsFileMask = $settings[S::KEY_COMMANDS_FILE_MASK] ?? '*.php'; |
82 | - $commandsPath = $commandsFolder . DIRECTORY_SEPARATOR . $commandsFileMask; |
|
82 | + $commandsPath = $commandsFolder.DIRECTORY_SEPARATOR.$commandsFileMask; |
|
83 | 83 | |
84 | 84 | $storage = $creator->createCommandStorage($commandsPath, $providerClasses); |
85 | 85 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $routeConfigurators = []; |
99 | 99 | if (empty($method) === false && empty($path) === false) { |
100 | - list(, , , , , $routeConfigurators) = $this->initRouter($coreSettings)->match($method, $path); |
|
100 | + list(,,,,, $routeConfigurators) = $this->initRouter($coreSettings)->match($method, $path); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // configure container |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function createThrowableHandler(SapiInterface $sapi, PsrContainerInterface $container): Closure |
212 | 212 | { |
213 | - return function (Throwable $throwable) use ($sapi, $container) { |
|
213 | + return function(Throwable $throwable) use ($sapi, $container) { |
|
214 | 214 | $handler = $this->createExceptionHandler($container); |
215 | 215 | $handler->handleThrowable($throwable, $sapi, $container); |
216 | 216 | }; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | protected function createErrorHandler(SapiInterface $sapi, PsrContainerInterface $container): Closure |
226 | 226 | { |
227 | - return function ($severity, $message, $fileName, $lineNumber) use ($sapi, $container) { |
|
227 | + return function($severity, $message, $fileName, $lineNumber) use ($sapi, $container) { |
|
228 | 228 | $errorException = new ErrorException($message, 0, $severity, $fileName, $lineNumber); |
229 | 229 | $handler = $this->createThrowableHandler($sapi, $container); |
230 | 230 | $handler($errorException); |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | */ |
240 | 240 | protected function createFatalErrorHandler(PsrContainerInterface $container): Closure |
241 | 241 | { |
242 | - return function () use ($container) { |
|
242 | + return function() use ($container) { |
|
243 | 243 | $error = $this->getLastError(); |
244 | - if ($error !== null && ((int)$error['type'] & (E_ERROR | E_COMPILE_ERROR))) { |
|
244 | + if ($error !== null && ((int) $error['type'] & (E_ERROR | E_COMPILE_ERROR))) { |
|
245 | 245 | $handler = $this->createExceptionHandler($container); |
246 | 246 | $handler->handleFatal($error, $container); |
247 | 247 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return array|null |
255 | 255 | */ |
256 | - protected function getLastError(): ?array |
|
256 | + protected function getLastError(): ? array |
|
257 | 257 | { |
258 | 258 | return error_get_last(); |
259 | 259 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if ($reflectionMethod->isPublic() === true && |
105 | 105 | $reflectionMethod->isStatic() === true && |
106 | 106 | $reflectionMethod->hasReturnType() === true && |
107 | - (string)$reflectionMethod->getReturnType() === 'bool' && |
|
107 | + (string) $reflectionMethod->getReturnType() === 'bool' && |
|
108 | 108 | $reflectionMethod->getNumberOfParameters() === 1 && |
109 | 109 | $reflectionMethod->getParameters()[0]->getClass()->implementsInterface(ContextInterface::class) === true |
110 | 110 | ) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | $policy = (new Policy($rules, RuleAlgorithm::firstApplicable())) |
156 | - ->setName($policiesName . ' -> ' . RequestProperties::REQ_RESOURCE_TYPE . "=`$resourcesType`") |
|
156 | + ->setName($policiesName.' -> '.RequestProperties::REQ_RESOURCE_TYPE."=`$resourcesType`") |
|
157 | 157 | ->setTarget($this->target(RequestProperties::REQ_RESOURCE_TYPE, $resourcesType)); |
158 | 158 | |
159 | 159 | return $policy; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->executeClear($container, $inOut); |
114 | 114 | break; |
115 | 115 | default: |
116 | - $inOut->writeError("Unsupported action `$action`." . PHP_EOL); |
|
116 | + $inOut->writeError("Unsupported action `$action`.".PHP_EOL); |
|
117 | 117 | break; |
118 | 118 | } |
119 | 119 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | throw new ConfigurationException(); |
139 | 139 | } |
140 | 140 | |
141 | - $path = $cacheDir . DIRECTORY_SEPARATOR . $class . '.php'; |
|
141 | + $path = $cacheDir.DIRECTORY_SEPARATOR.$class.'.php'; |
|
142 | 142 | |
143 | 143 | $this->getFileSystem($container)->delete($path); |
144 | 144 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $settingsData = $settingsProvider->serialize(); |
168 | 168 | $content = $this->composeContent($settingsData, $namespace, $class, $method); |
169 | 169 | |
170 | - $path = $cacheDir . DIRECTORY_SEPARATOR . $class . '.php'; |
|
170 | + $path = $cacheDir.DIRECTORY_SEPARATOR.$class.'.php'; |
|
171 | 171 | $this->getFileSystem($container)->write($path, $content); |
172 | 172 | } |
173 | 173 | |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | |
236 | 236 | assert( |
237 | 237 | $data !== null, |
238 | - 'It seems the data are not exportable. It is likely to be caused by class instances ' . |
|
239 | - 'that do not implement ` __set_state` magic method required by `var_export`. ' . |
|
238 | + 'It seems the data are not exportable. It is likely to be caused by class instances '. |
|
239 | + 'that do not implement ` __set_state` magic method required by `var_export`. '. |
|
240 | 240 | 'See http://php.net/manual/en/language.oop5.magic.php#object.set-state for more details.' |
241 | 241 | ); |
242 | 242 |