@@ -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; |
| 4 | 4 | |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | $this->ensurePathExistsInYaml($yamlAsArray, 'matrix/include'); |
| 21 | 21 | |
| 22 | 22 | $foundExisting = false; |
| 23 | - foreach ($yamlAsArray['matrix']['include'] as $entry) { |
|
| 24 | - $env = $entry['env']; |
|
| 23 | + foreach ($yamlAsArray[ 'matrix' ][ 'include' ] as $entry) { |
|
| 24 | + $env = $entry[ 'env' ]; |
|
| 25 | 25 | if ($env !== 'DUPLICATE_CODE_CHECK=1') { |
| 26 | 26 | continue; |
| 27 | 27 | } |
@@ -33,20 +33,20 @@ discard block |
||
| 33 | 33 | return; |
| 34 | 34 | } else { |
| 35 | 35 | // add a matrix entry |
| 36 | - $yamlAsArray['matrix']['include'][] = [ |
|
| 36 | + $yamlAsArray[ 'matrix' ][ 'include' ][ ] = [ |
|
| 37 | 37 | 'php' => 7.4, |
| 38 | 38 | 'env' => 'DUPLICATE_CODE_CHECK=1', |
| 39 | 39 | ]; |
| 40 | 40 | |
| 41 | 41 | // install jdscpd, node tool, for duplication detection |
| 42 | 42 | $this->ensurePathExistsInYaml($yamlAsArray, 'before_script'); |
| 43 | - $yamlAsArray['before_script'][] = 'if [[ $DUPLICATE_CODE_CHECK ]]; then sudo apt remove -y nodejs && curl ' |
|
| 43 | + $yamlAsArray[ 'before_script' ][ ] = 'if [[ $DUPLICATE_CODE_CHECK ]]; then sudo apt remove -y nodejs && curl ' |
|
| 44 | 44 | . '-sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh && sudo bash nodesource_setup.sh ' |
| 45 | 45 | . '&& sudo apt install -y build-essential nodejs && which npm && npm install [email protected] ;fi'; |
| 46 | 46 | |
| 47 | 47 | // run jscpd on src and tests dir |
| 48 | 48 | $this->ensurePathExistsInYaml($yamlAsArray, 'script'); |
| 49 | - $yamlAsArray['script'][] = 'if [[ $DUPLICATE_CODE_CHECK ]]; then node_modules/jscpd/bin/jscpd src && ' |
|
| 49 | + $yamlAsArray[ 'script' ][ ] = 'if [[ $DUPLICATE_CODE_CHECK ]]; then node_modules/jscpd/bin/jscpd src && ' |
|
| 50 | 50 | . 'node_modules/jscpd/bin/jscpd tests ; fi'; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $pathParts = \explode('/', $path); |
| 67 | 67 | $part = \array_shift($pathParts); |
| 68 | - if (!isset($yamlAsArray[$part])) { |
|
| 69 | - $yamlAsArray[$part] = []; |
|
| 68 | + if (!isset($yamlAsArray[ $part ])) { |
|
| 69 | + $yamlAsArray[ $part ] = [ ]; |
|
| 70 | 70 | } |
| 71 | 71 | $remainingPath = \implode('/', $pathParts); |
| 72 | 72 | if (\sizeof($pathParts) === 0) { |
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $this->ensurePathExistsInYaml($yamlAsArray[$part], $remainingPath); |
|
| 76 | + $this->ensurePathExistsInYaml($yamlAsArray[ $part ], $remainingPath); |
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -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 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function loadTravis() |
| 32 | 32 | { |
| 33 | - $result = []; |
|
| 33 | + $result = [ ]; |
|
| 34 | 34 | $path = \getcwd() . '/' . $this->travisFileName; |
| 35 | 35 | if (\file_exists($this->travisFileName)) { |
| 36 | 36 | $result = Yaml::parseFile($path); |