@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Suilven\PHPTravisEnhancer; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Suilven\PHPTravisEnhancer\IFace; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Suilven\PHPTravisEnhancer\Helper; |
| 4 | 4 | |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $pathParts = \explode('/', $path); |
| 36 | 36 | $part = \array_shift($pathParts); |
| 37 | - if (!isset($yamlAsArray[$part])) { |
|
| 38 | - $yamlAsArray[$part] = []; |
|
| 37 | + if (!isset($yamlAsArray[ $part ])) { |
|
| 38 | + $yamlAsArray[ $part ] = [ ]; |
|
| 39 | 39 | } |
| 40 | 40 | $remainingPath = \implode('/', $pathParts); |
| 41 | 41 | if (\sizeof($pathParts) === 0) { |
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $this->ensurePathExistsInYaml($yamlAsArray[$part], $remainingPath); |
|
| 45 | + $this->ensurePathExistsInYaml($yamlAsArray[ $part ], $remainingPath); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | public function checkForExistingInEnv(array $yamlAsArray, string $flag): bool |
| 59 | 59 | { |
| 60 | 60 | $foundExisting = false; |
| 61 | - foreach ($yamlAsArray['matrix']['include'] as $entry) { |
|
| 62 | - $env = $entry['env']; |
|
| 61 | + foreach ($yamlAsArray[ 'matrix' ][ 'include' ] as $entry) { |
|
| 62 | + $env = $entry[ 'env' ]; |
|
| 63 | 63 | if ($env !== ($flag . '=1')) { |
| 64 | 64 | continue; |
| 65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function loadTravis(): array |
| 81 | 81 | { |
| 82 | - $result = []; |
|
| 82 | + $result = [ ]; |
|
| 83 | 83 | $path = \getcwd() . '/' . $this->travisFileName; |
| 84 | 84 | if (\file_exists($this->travisFileName)) { |
| 85 | 85 | $result = Yaml::parseFile($path); |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Suilven\PHPTravisEnhancer; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Suilven\PHPTravisEnhancer; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Suilven\PHPTravisEnhancer\Abstraction; |
| 4 | 4 | |
@@ -30,26 +30,26 @@ discard block |
||
| 30 | 30 | $foundExisting = $helper->checkForExistingInEnv($yamlAsArray, $this->getFlag()); |
| 31 | 31 | if (!$foundExisting) { |
| 32 | 32 | // add a matrix entry |
| 33 | - $yamlAsArray['matrix']['include'][] = [ |
|
| 33 | + $yamlAsArray[ 'matrix' ][ 'include' ][ ] = [ |
|
| 34 | 34 | 'php' => 7.4, |
| 35 | 35 | 'env' => $this->getFlag() . '=1', |
| 36 | 36 | ]; |
| 37 | 37 | |
| 38 | 38 | /** @var string $prefix the bash prefix to check for the flag being set */ |
| 39 | - $prefix = 'if [[ $' . $this->getFlag() .' ]]; then '; |
|
| 39 | + $prefix = 'if [[ $' . $this->getFlag() . ' ]]; then '; |
|
| 40 | 40 | |
| 41 | 41 | $beforeScript = $this->getBeforeScript(); |
| 42 | 42 | if (isset($beforeScript)) { |
| 43 | 43 | // install jdscpd, node tool, for duplication detection |
| 44 | 44 | $helper->ensurePathExistsInYaml($yamlAsArray, 'before_script'); |
| 45 | - $yamlAsArray['before_script'][] = $prefix . $beforeScript . ' ;fi'; |
|
| 45 | + $yamlAsArray[ 'before_script' ][ ] = $prefix . $beforeScript . ' ;fi'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $script = $this->getScript(); |
| 49 | 49 | if (isset($script)) { |
| 50 | 50 | // run jscpd on src and tests dir |
| 51 | 51 | $helper->ensurePathExistsInYaml($yamlAsArray, 'script'); |
| 52 | - $yamlAsArray['script'][] = $prefix . $script . ' ; fi'; |
|
| 52 | + $yamlAsArray[ 'script' ][ ] = $prefix . $script . ' ; fi'; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |