@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | class Config extends BaseObject |
| 18 | 18 | { |
| 19 | - public array $files = []; |
|
| 19 | + public array $files = [ ]; |
|
| 20 | 20 | protected array $_config; |
| 21 | 21 | protected array $_components; |
| 22 | 22 | |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | public function getComponents(): array |
| 27 | 27 | { |
| 28 | 28 | if ($this->_components === null) { |
| 29 | - $this->_components = []; |
|
| 29 | + $this->_components = [ ]; |
|
| 30 | 30 | |
| 31 | 31 | if ($config = $this->readConfig()) { |
| 32 | 32 | foreach ($this->files as $current) { |
| 33 | - if (isset($config[$current]['components'])) { |
|
| 33 | + if (isset($config[ $current ][ 'components' ])) { |
|
| 34 | 34 | /** @var mixed[] $components */ |
| 35 | - $components = $config[$current]['components']; |
|
| 35 | + $components = $config[ $current ][ 'components' ]; |
|
| 36 | 36 | |
| 37 | 37 | if (is_array($components)) { |
| 38 | 38 | foreach ($components as $name => $component) { |
| 39 | 39 | if (($class = $this->findClass($component)) !== false) { |
| 40 | - $this->_components[$name][$class] = $class; |
|
| 40 | + $this->_components[ $name ][ $class ] = $class; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | protected function readConfig(): array |
| 56 | 56 | { |
| 57 | 57 | if ($this->_config === null) { |
| 58 | - $this->_config = []; |
|
| 58 | + $this->_config = [ ]; |
|
| 59 | 59 | |
| 60 | 60 | foreach ($this->files as $file) { |
| 61 | 61 | $path = Yii::getAlias($file); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if (is_file($path)) { |
| 65 | 65 | try { |
| 66 | 66 | /** @noinspection PhpIncludeInspection */ |
| 67 | - $this->_config[$file] = require $path; |
|
| 67 | + $this->_config[ $file ] = require $path; |
|
| 68 | 68 | } catch (Throwable) { |
| 69 | 69 | # Ignore |
| 70 | 70 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return string|false |
| 82 | 82 | */ |
| 83 | - protected function findClass(mixed $section): bool|string |
|
| 83 | + protected function findClass(mixed $section): bool | string |
|
| 84 | 84 | { |
| 85 | 85 | try { |
| 86 | 86 | if ($section instanceof Closure) { |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | return $section; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (is_array($section) && isset($section['class'])) { |
|
| 99 | - return $section['class']; |
|
| 98 | + if (is_array($section) && isset($section[ 'class' ])) { |
|
| 99 | + return $section[ 'class' ]; |
|
| 100 | 100 | } |
| 101 | 101 | } catch (Throwable) { |
| 102 | 102 | # Ignore |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'ide-components' => Controller::class, |
| 21 | 21 | ]; |
| 22 | 22 | public string $result; |
| 23 | - public array $config = []; |
|
| 23 | + public array $config = [ ]; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @inheritdoc |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | if (is_array($this->controllerMap)) { |
| 44 | 44 | foreach ($this->controllerMap as $name => $controller) { |
| 45 | 45 | if (is_subclass_of($controller, \yii\console\Controller::class)) { |
| 46 | - $app->controllerMap[$name] = $controller; |
|
| 46 | + $app->controllerMap[ $name ] = $controller; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | ], |
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | - public function detect(): bool|string |
|
| 39 | + public function detect(): bool | string |
|
| 40 | 40 | { |
| 41 | 41 | $application = $this->getApplication(); |
| 42 | 42 | |
| 43 | - if (isset($this->ids[$application->id])) { |
|
| 44 | - return $this->ids[$application->id]; |
|
| 43 | + if (isset($this->ids[ $application->id ])) { |
|
| 44 | + return $this->ids[ $application->id ]; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return false; |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | public function getConfig(): array |
| 51 | 51 | { |
| 52 | 52 | if ($type = $this->detect()) { |
| 53 | - return isset($this->configs[$type]) ? $this->configs[$type] : []; |
|
| 53 | + return isset($this->configs[ $type ]) ? $this->configs[ $type ] : [ ]; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - return []; |
|
| 56 | + return [ ]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | protected function getApplication(): Application |
| 60 | 60 | { |
| 61 | - if (!$this->app instanceof Application) { |
|
| 61 | + if ( ! $this->app instanceof Application) { |
|
| 62 | 62 | $this->app = Yii::$app; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function optionAliases(): array |
| 44 | 44 | { |
| 45 | - return []; |
|
| 45 | + return [ ]; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function showDescription(): void |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | $configList = $this->getDetector()->getConfig(); |
| 135 | 135 | } else { |
| 136 | 136 | if (null === $this->config) { |
| 137 | - if (isset($component->config[0])) { |
|
| 137 | + if (isset($component->config[ 0 ])) { |
|
| 138 | 138 | $configList = $component->config; |
| 139 | 139 | } else { |
| 140 | 140 | throw new InvalidCallException('Default config list not found in component config data'); |
| 141 | 141 | } |
| 142 | 142 | } else { |
| 143 | - if (isset($component->config[$this->config])) { |
|
| 144 | - $configList = $component->config[$this->config]; |
|
| 143 | + if (isset($component->config[ $this->config ])) { |
|
| 144 | + $configList = $component->config[ $this->config ]; |
|
| 145 | 145 | } else { |
| 146 | 146 | throw new InvalidCallException(sprintf('Scope "%s" not found in component config data', $this->config)); |
| 147 | 147 | } |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | class Builder extends BaseObject |
| 14 | 14 | { |
| 15 | 15 | public string $template; |
| 16 | - public array $components = []; |
|
| 16 | + public array $components = [ ]; |
|
| 17 | 17 | |
| 18 | - public function build(string|false $file = null): bool|string |
|
| 18 | + public function build(string | false $file = null): bool | string |
|
| 19 | 19 | { |
| 20 | - $prepared = preg_replace_callback('/%.*%/U', function ($m) { |
|
| 21 | - if ($m[0] === '%phpdoc%') { |
|
| 20 | + $prepared = preg_replace_callback('/%.*%/U', function($m) { |
|
| 21 | + if ($m[ 0 ] === '%phpdoc%') { |
|
| 22 | 22 | $string = '/**'; |
| 23 | 23 | |
| 24 | 24 | foreach ($this->components as $name => $classes) { |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | return $string; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - return $m[0]; |
|
| 32 | + return $m[ 0 ]; |
|
| 33 | 33 | }, $this->template); |
| 34 | 34 | |
| 35 | 35 | if ($file === null) { |
| 36 | 36 | return $prepared; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - return (bool)file_put_contents($file, $prepared); |
|
| 39 | + return (bool) file_put_contents($file, $prepared); |
|
| 40 | 40 | } |
| 41 | 41 | } |