@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private static function getMainReadme(string $projectRootDirectory): string |
| 30 | 30 | { |
| 31 | - $path = $projectRootDirectory . '/README.md'; |
|
| 31 | + $path = $projectRootDirectory.'/README.md'; |
|
| 32 | 32 | if (!is_file($path)) { |
| 33 | 33 | throw new \RuntimeException( |
| 34 | 34 | "\n\nYou have no README.md file in your project" |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | private static function getDocsFiles(string $projectRootDirectory): array |
| 49 | 49 | { |
| 50 | 50 | $files = []; |
| 51 | - $dir = $projectRootDirectory . '/docs'; |
|
| 51 | + $dir = $projectRootDirectory.'/docs'; |
|
| 52 | 52 | if (!is_dir($dir)) { |
| 53 | 53 | return $files; |
| 54 | 54 | } |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | $start = \rtrim($projectRootDirectory, '/'); |
| 121 | 121 | if ($path[0] !== '/' || 0 === \strpos($path, './')) { |
| 122 | 122 | $relativeSubdirs = \preg_replace( |
| 123 | - '%^' . $projectRootDirectory . '%', |
|
| 123 | + '%^'.$projectRootDirectory.'%', |
|
| 124 | 124 | '', |
| 125 | 125 | \dirname($file) |
| 126 | 126 | ); |
| 127 | - $start .= '/' . \rtrim($relativeSubdirs, '/'); |
|
| 127 | + $start .= '/'.\rtrim($relativeSubdirs, '/'); |
|
| 128 | 128 | } |
| 129 | - $realpath = \realpath($start . '/' . $path); |
|
| 129 | + $realpath = \realpath($start.'/'.$path); |
|
| 130 | 130 | if (false === $realpath) { |
| 131 | 131 | $errors[] = \sprintf("\nBad link for \"%s\" to \"%s\"\n", $link[1], $link[2]); |
| 132 | 132 | $return = 1; |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | $files = static::getFiles($projectRootDirectory); |
| 149 | 149 | foreach ($files as $file) { |
| 150 | 150 | $relativeFile = str_replace($projectRootDirectory, '', $file); |
| 151 | - $title = "\n$relativeFile\n" . str_repeat('-', strlen($relativeFile)) . "\n"; |
|
| 151 | + $title = "\n$relativeFile\n".str_repeat('-', strlen($relativeFile))."\n"; |
|
| 152 | 152 | $errors = []; |
| 153 | 153 | $links = static::getLinks($file); |
| 154 | 154 | foreach ($links as $link) { |
| 155 | 155 | static::checkLink($projectRootDirectory, $link, $file, $errors, $return); |
| 156 | 156 | } |
| 157 | 157 | if ([] !== $errors) { |
| 158 | - echo $title . implode('', $errors); |
|
| 158 | + echo $title.implode('', $errors); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | ], |
| 186 | 186 | ], |
| 187 | 187 | ]); |
| 188 | - $result = null; |
|
| 188 | + $result = null; |
|
| 189 | 189 | try { |
| 190 | 190 | $headers = get_headers($href, 0, $context); |
| 191 | 191 | foreach ($headers as $header) { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $href, |
| 206 | 206 | var_export($result, true) |
| 207 | 207 | ); |
| 208 | - $return = 1; |
|
| 208 | + $return = 1; |
|
| 209 | 209 | #$time = round(microtime(true) - $start, 2); |
| 210 | 210 | #fwrite(STDERR, "\n".'Failed ('.$time.' seconds): '.$href); |
| 211 | 211 | } |
@@ -38,14 +38,14 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public static function getComposerJsonDecoded(string $path = null): array |
| 40 | 40 | { |
| 41 | - $path = $path ?? self::getProjectRootDirectory() . '/composer.json'; |
|
| 41 | + $path = $path ?? self::getProjectRootDirectory().'/composer.json'; |
|
| 42 | 42 | $contents = (string)\file_get_contents($path); |
| 43 | 43 | if ('' === $contents) { |
| 44 | 44 | throw new \RuntimeException('composer.json is empty'); |
| 45 | 45 | } |
| 46 | 46 | $decoded = \json_decode($contents, true); |
| 47 | 47 | if (JSON_ERROR_NONE !== \json_last_error()) { |
| 48 | - throw new \RuntimeException('Failed loading composer.json: ' . \json_last_error_msg()); |
|
| 48 | + throw new \RuntimeException('Failed loading composer.json: '.\json_last_error_msg()); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | return $decoded; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $this->currentTestResult = new \EdmondsCommerce\PHPQA\PHPUnit\TestDox\TestResult( |
| 100 | - function (string $color, string $buffer) { |
|
| 100 | + function(string $color, string $buffer) { |
|
| 101 | 101 | return $this->formatWithColor($color, $buffer); |
| 102 | 102 | }, |
| 103 | 103 | $className, |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | if (null === $this->currentTestResult) { |
| 132 | 132 | throw new \RuntimeException( |
| 133 | - 'Error in ' . __METHOD__ . ': ' |
|
| 134 | - . $t->getMessage() . "\n\n" . $t->getTraceAsString(), |
|
| 133 | + 'Error in '.__METHOD__.': ' |
|
| 134 | + . $t->getMessage()."\n\n".$t->getTraceAsString(), |
|
| 135 | 135 | $t->getCode(), |
| 136 | 136 | $t |
| 137 | 137 | ); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | protected function printHeader(): void |
| 206 | 206 | { |
| 207 | - $this->write("\n" . Timer::resourceUsage() . "\n\n"); |
|
| 207 | + $this->write("\n".Timer::resourceUsage()."\n\n"); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests): void |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ): void { |
| 75 | 75 | $this->testSuccesful = false; |
| 76 | 76 | $this->symbol = $symbol; |
| 77 | - $this->additionalInformation .= "\n" . $additionalInformation; |
|
| 77 | + $this->additionalInformation .= "\n".$additionalInformation; |
|
| 78 | 78 | $this->additionalInformationVerbose = $additionalInformationVerbose; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ), |
| 95 | 95 | $this->symbol, |
| 96 | 96 | $this->testMethod, |
| 97 | - $verbose ? ' ' . $this->getFormattedRuntime() : '', |
|
| 97 | + $verbose ? ' '.$this->getFormattedRuntime() : '', |
|
| 98 | 98 | $this->getFormattedAdditionalInformation($verbose) |
| 99 | 99 | ); |
| 100 | 100 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | \implode( |
| 139 | 139 | "\n", |
| 140 | 140 | \array_map( |
| 141 | - function (string $text) { |
|
| 141 | + function(string $text) { |
|
| 142 | 142 | return \sprintf(' │ %s', $text); |
| 143 | 143 | }, |
| 144 | 144 | \explode("\n", $this->additionalInformation) |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | if (null === $class || null === $name) { |
| 78 | 78 | throw new \RuntimeException( |
| 79 | - 'Failed finding the class and/or name in the attributes:' . $attributes->__toString() |
|
| 79 | + 'Failed finding the class and/or name in the attributes:'.$attributes->__toString() |
|
| 80 | 80 | ); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if (false === $sXml) { |
| 113 | 113 | $message = "Failed loading XML\n"; |
| 114 | 114 | foreach (libxml_get_errors() as $error) { |
| 115 | - $message .= "\n\t" . $error->message; |
|
| 115 | + $message .= "\n\t".$error->message; |
|
| 116 | 116 | } |
| 117 | 117 | throw new \RuntimeException($message); |
| 118 | 118 | } |
@@ -126,6 +126,6 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | private function getDefaultFilePath(): string |
| 128 | 128 | { |
| 129 | - return Helper::getProjectRootDirectory() . '/var/qa/phpunit.junit.log.xml'; |
|
| 129 | + return Helper::getProjectRootDirectory().'/var/qa/phpunit.junit.log.xml'; |
|
| 130 | 130 | } |
| 131 | 131 | } |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | if (!is_dir($pathToTestsDirectory)) { |
| 45 | 45 | throw new \InvalidArgumentException( |
| 46 | - '$pathToTestsDirectory "' . $pathToTestsDirectory . '" does not exist"' |
|
| 46 | + '$pathToTestsDirectory "'.$pathToTestsDirectory.'" does not exist"' |
|
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | - $this->largePath = $pathToTestsDirectory . '/Large'; |
|
| 50 | - $this->mediumPath = $pathToTestsDirectory . '/Medium'; |
|
| 51 | - $this->smallPath = $pathToTestsDirectory . '/Small'; |
|
| 49 | + $this->largePath = $pathToTestsDirectory.'/Large'; |
|
| 50 | + $this->mediumPath = $pathToTestsDirectory.'/Medium'; |
|
| 51 | + $this->smallPath = $pathToTestsDirectory.'/Small'; |
|
| 52 | 52 | $this->checkLarge(); |
| 53 | 53 | $this->checkMedium(); |
| 54 | 54 | $this->checkSmall(); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $matches = []; |
|
| 105 | + $matches = []; |
|
| 106 | 106 | preg_match_all( |
| 107 | 107 | <<<REGEXP |
| 108 | 108 | %(?<docblock>/\*(?:[^*]|\n|(?:\*(?:[^/]|\n)))*\*/|\n)\s+?public\s+?function\s+?(?<method>.+?)\(% |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | foreach ($matches['method'] as $key => $method) { |
| 120 | 120 | $docblock = $matches['docblock'][$key]; |
| 121 | 121 | /* Found the annotation - continue */ |
| 122 | - if (false !== \strpos($docblock, '@' . $annotation)) { |
|
| 122 | + if (false !== \strpos($docblock, '@'.$annotation)) { |
|
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | 125 | /* No @test annotation found & method not beginning test = not a test, so continue */ |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | continue; |
| 128 | 128 | } |
| 129 | 129 | $this->errors[$fileInfo->getFilename()][] = |
| 130 | - 'Failed finding @' . $annotation . ' for method: ' . $method; |
|
| 130 | + 'Failed finding @'.$annotation.' for method: '.$method; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | return false; |
| 157 | 157 | } |
| 158 | 158 | $docBlock = array_shift($matches['docblock']); |
| 159 | - return strpos($docBlock, '@' . $annotation) !== false; |
|
| 159 | + return strpos($docBlock, '@'.$annotation) !== false; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
@@ -178,7 +178,7 @@ |
||
| 178 | 178 | $invalidPathMessage = "Namespace root '$namespaceRoot'\ncontains a path '$path'\nwhich doesn't exist\n"; |
| 179 | 179 | if (stripos($absPathRoot, "Magento") !== false) { |
| 180 | 180 | $invalidPathMessage .= 'Magento\'s composer includes this by default, ' |
| 181 | - . 'it should be removed from the psr-4 section'; |
|
| 181 | + . 'it should be removed from the psr-4 section'; |
|
| 182 | 182 | } |
| 183 | 183 | $this->missingPaths[$path] = $invalidPathMessage; |
| 184 | 184 | } |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | ); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - return rtrim($namespaceRoot . $relativeNs, '\\'); |
|
| 119 | + return rtrim($namespaceRoot.$relativeNs, '\\'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | private function getActualNamespace(\SplFileInfo $fileInfo): string |
| 123 | 123 | { |
| 124 | 124 | $contents = \file_get_contents($fileInfo->getPathname()); |
| 125 | 125 | if (false === $contents) { |
| 126 | - throw new \RuntimeException('Failed getting file contents for ' . $fileInfo->getPathname()); |
|
| 126 | + throw new \RuntimeException('Failed getting file contents for '.$fileInfo->getPathname()); |
|
| 127 | 127 | } |
| 128 | 128 | \preg_match('%namespace\s+?([^;]+)%', $contents, $matches); |
| 129 | 129 | if ([] === $matches) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $realPath, |
| 147 | 147 | \RecursiveDirectoryIterator::SKIP_DOTS |
| 148 | 148 | ); |
| 149 | - $iterator = new \RecursiveIteratorIterator( |
|
| 149 | + $iterator = new \RecursiveIteratorIterator( |
|
| 150 | 150 | $directoryIterator, |
| 151 | 151 | \RecursiveIteratorIterator::SELF_FIRST |
| 152 | 152 | ); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $paths = [$paths]; |
| 203 | 203 | } |
| 204 | 204 | foreach ($paths as $path) { |
| 205 | - $absPathRoot = $this->pathToProjectRoot . '/' . $path; |
|
| 205 | + $absPathRoot = $this->pathToProjectRoot.'/'.$path; |
|
| 206 | 206 | $realAbsPathRoot = \realpath($absPathRoot); |
| 207 | 207 | if (false === $realAbsPathRoot) { |
| 208 | 208 | $this->addMissingPathError($path, $namespaceRoot, $absPathRoot); |