@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | $allowed = $option->getAllowedValues(); |
56 | 56 | |
57 | 57 | if (null !== $allowed) { |
58 | - $allowed = array_filter($allowed, static function ($value) { |
|
58 | + $allowed = array_filter($allowed, static function($value) { |
|
59 | 59 | return !($value instanceof \Closure); |
60 | 60 | }); |
61 | 61 | |
62 | - usort($allowed, static function ($valueA, $valueB) { |
|
62 | + usort($allowed, static function($valueA, $valueB) { |
|
63 | 63 | if ($valueA instanceof AllowedValueSubset) { |
64 | 64 | return -1; |
65 | 65 | } |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | |
112 | 112 | foreach ($value as $k => $v) { |
113 | 113 | if ($isHash) { |
114 | - $str .= static::scalarToString($k).' => '; |
|
114 | + $str .= static::scalarToString($k) . ' => '; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $str .= \is_array($v) |
118 | - ? static::arrayToString($v).', ' |
|
119 | - : static::scalarToString($v).', ' |
|
118 | + ? static::arrayToString($v) . ', ' |
|
119 | + : static::scalarToString($v) . ', ' |
|
120 | 120 | ; |
121 | 121 | } |
122 | 122 | |
123 | - return substr($str, 0, -2).']'; |
|
123 | + return substr($str, 0, -2) . ']'; |
|
124 | 124 | } |
125 | 125 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $currentVersion = $this->getApplication()->getVersion(); |
114 | 114 | Preg::match('/^v?(?<major>\d+)\./', $currentVersion, $matches); |
115 | - $currentMajor = (int) $matches['major']; |
|
115 | + $currentMajor = (int)$matches['major']; |
|
116 | 116 | |
117 | 117 | try { |
118 | 118 | $latestVersion = $this->versionChecker->getLatestVersion(); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | return 1; |
161 | 161 | } |
162 | 162 | |
163 | - $tempFilename = \dirname($localFilename).'/'.basename($localFilename, '.phar').'-tmp.phar'; |
|
163 | + $tempFilename = \dirname($localFilename) . '/' . basename($localFilename, '.phar') . '-tmp.phar'; |
|
164 | 164 | $remoteFilename = $this->toolInfo->getPharDownloadUri($remoteTag); |
165 | 165 | |
166 | 166 | if (false === @copy($remoteFilename, $tempFilename)) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | '%s "%s" not found.%s', |
129 | 129 | ucfirst($e->getType()), |
130 | 130 | $name, |
131 | - null === $alternative ? '' : ' Did you mean "'.$alternative.'"?' |
|
131 | + null === $alternative ? '' : ' Did you mean "' . $alternative . '"?' |
|
132 | 132 | )); |
133 | 133 | } |
134 | 134 | |
@@ -190,32 +190,32 @@ discard block |
||
190 | 190 | $output->writeln(sprintf('Fixer is configurable using following option%s:', 1 === \count($options) ? '' : 's')); |
191 | 191 | |
192 | 192 | foreach ($options as $option) { |
193 | - $line = '* <info>'.OutputFormatter::escape($option->getName()).'</info>'; |
|
193 | + $line = '* <info>' . OutputFormatter::escape($option->getName()) . '</info>'; |
|
194 | 194 | $allowed = HelpCommand::getDisplayableAllowedValues($option); |
195 | 195 | |
196 | 196 | if (null !== $allowed) { |
197 | 197 | foreach ($allowed as &$value) { |
198 | 198 | if ($value instanceof AllowedValueSubset) { |
199 | - $value = 'a subset of <comment>'.HelpCommand::toString($value->getAllowedValues()).'</comment>'; |
|
199 | + $value = 'a subset of <comment>' . HelpCommand::toString($value->getAllowedValues()) . '</comment>'; |
|
200 | 200 | } else { |
201 | - $value = '<comment>'.HelpCommand::toString($value).'</comment>'; |
|
201 | + $value = '<comment>' . HelpCommand::toString($value) . '</comment>'; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } else { |
205 | 205 | $allowed = array_map( |
206 | - static function (string $type) { |
|
207 | - return '<comment>'.$type.'</comment>'; |
|
206 | + static function(string $type) { |
|
207 | + return '<comment>' . $type . '</comment>'; |
|
208 | 208 | }, |
209 | 209 | $option->getAllowedTypes() |
210 | 210 | ); |
211 | 211 | } |
212 | 212 | |
213 | 213 | if (null !== $allowed) { |
214 | - $line .= ' ('.implode(', ', $allowed).')'; |
|
214 | + $line .= ' (' . implode(', ', $allowed) . ')'; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $description = Preg::replace('/(`.+?`)/', '<info>$1</info>', OutputFormatter::escape($option->getDescription())); |
218 | - $line .= ': '.lcfirst(Preg::replace('/\.$/', '', $description)).'; '; |
|
218 | + $line .= ': ' . lcfirst(Preg::replace('/\.$/', '', $description)) . '; '; |
|
219 | 219 | |
220 | 220 | if ($option->hasDefault()) { |
221 | 221 | $line .= sprintf( |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | if ($option instanceof DeprecatedFixerOption) { |
230 | - $line .= '. <error>DEPRECATED</error>: '.Preg::replace( |
|
230 | + $line .= '. <error>DEPRECATED</error>: ' . Preg::replace( |
|
231 | 231 | '/(`.+?`)/', |
232 | 232 | '<info>$1</info>', |
233 | 233 | OutputFormatter::escape(lcfirst($option->getDeprecationMessage())) |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | if ($option instanceof AliasedFixerOption) { |
238 | - $line .= '; <error>DEPRECATED</error> alias: <comment>'.$option->getAlias().'</comment>'; |
|
238 | + $line .= '; <error>DEPRECATED</error> alias: <comment>' . $option->getAlias() . '</comment>'; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | $output->writeln($line); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** @var CodeSampleInterface[] $codeSamples */ |
248 | - $codeSamples = array_filter($definition->getCodeSamples(), static function (CodeSampleInterface $codeSample) { |
|
248 | + $codeSamples = array_filter($definition->getCodeSamples(), static function(CodeSampleInterface $codeSample) { |
|
249 | 249 | if ($codeSample instanceof VersionSpecificCodeSampleInterface) { |
250 | 250 | return $codeSample->isSuitableFor(\PHP_VERSION_ID); |
251 | 251 | } |
@@ -418,11 +418,11 @@ discard block |
||
418 | 418 | { |
419 | 419 | return Preg::replaceCallback( |
420 | 420 | '/(`[^<]+<[^>]+>`_)/', |
421 | - static function (array $matches) { |
|
421 | + static function(array $matches) { |
|
422 | 422 | return Preg::replaceCallback( |
423 | 423 | '/`(.*)<(.*)>`_/', |
424 | - static function (array $matches) { |
|
425 | - return $matches[1].'('.$matches[2].')'; |
|
424 | + static function(array $matches) { |
|
425 | + return $matches[1] . '(' . $matches[2] . ')'; |
|
426 | 426 | }, |
427 | 427 | $matches[1] |
428 | 428 | ); |
@@ -272,7 +272,7 @@ |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | $configFile = $resolver->getConfigFile(); |
275 | - $stdErr->writeln(sprintf('Loaded config <comment>%s</comment>%s.', $resolver->getConfig()->getName(), null === $configFile ? '' : ' from "'.$configFile.'"')); |
|
275 | + $stdErr->writeln(sprintf('Loaded config <comment>%s</comment>%s.', $resolver->getConfig()->getName(), null === $configFile ? '' : ' from "' . $configFile . '"')); |
|
276 | 276 | |
277 | 277 | if ($resolver->getUsingCache()) { |
278 | 278 | $cacheFile = $resolver->getCacheFile(); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | $this->retrieveAvailableVersions(); |
63 | 63 | |
64 | - $semverConstraint = '^'.$majorVersion; |
|
64 | + $semverConstraint = '^' . $majorVersion; |
|
65 | 65 | |
66 | 66 | foreach ($this->availableVersions as $availableVersion) { |
67 | 67 | if (Semver::satisfies($availableVersion, $semverConstraint)) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | public static function getMajorVersion(): int |
69 | 69 | { |
70 | - return (int) explode('.', self::VERSION)[0]; |
|
70 | + return (int)explode('.', self::VERSION)[0]; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | $commit = '@git-commit@'; |
128 | 128 | |
129 | - if ('@'.'git-commit@' !== $commit) { // @phpstan-ignore-line as `$commit` is replaced during phar building |
|
130 | - $version .= ' ('.substr($commit, 0, 7).')'; |
|
129 | + if ('@' . 'git-commit@' !== $commit) { // @phpstan-ignore-line as `$commit` is replaced during phar building |
|
130 | + $version .= ' (' . substr($commit, 0, 7) . ')'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $version; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | $absolutePath = $filesystem->isAbsolutePath($path) |
309 | 309 | ? $path |
310 | - : $this->cwd.\DIRECTORY_SEPARATOR.$path; |
|
310 | + : $this->cwd . \DIRECTORY_SEPARATOR . $path; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | $this->directory = new Directory(\dirname($absolutePath)); |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | |
331 | 331 | if (false === $this->getRiskyAllowed()) { |
332 | 332 | $riskyFixers = array_map( |
333 | - static function (FixerInterface $fixer) { |
|
333 | + static function(FixerInterface $fixer) { |
|
334 | 334 | return $fixer->getName(); |
335 | 335 | }, |
336 | 336 | array_filter( |
337 | 337 | $this->fixers, |
338 | - static function (FixerInterface $fixer) { |
|
338 | + static function(FixerInterface $fixer) { |
|
339 | 339 | return $fixer->isRisky(); |
340 | 340 | } |
341 | 341 | ) |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $this->path = $this->options['path']; |
375 | 375 | } else { |
376 | 376 | $this->path = array_map( |
377 | - static function (string $rawPath) use ($cwd, $filesystem) { |
|
377 | + static function(string $rawPath) use ($cwd, $filesystem) { |
|
378 | 378 | $path = trim($rawPath); |
379 | 379 | |
380 | 380 | if ('' === $path) { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | |
384 | 384 | $absolutePath = $filesystem->isAbsolutePath($path) |
385 | 385 | ? $path |
386 | - : $cwd.\DIRECTORY_SEPARATOR.$path; |
|
386 | + : $cwd . \DIRECTORY_SEPARATOR . $path; |
|
387 | 387 | |
388 | 388 | if (!file_exists($absolutePath)) { |
389 | 389 | throw new InvalidConfigurationException(sprintf( |
@@ -559,17 +559,17 @@ discard block |
||
559 | 559 | } |
560 | 560 | |
561 | 561 | $candidates = [ |
562 | - $configDir.\DIRECTORY_SEPARATOR.'.php-cs-fixer.php', |
|
563 | - $configDir.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php', |
|
564 | - $configDir.\DIRECTORY_SEPARATOR.'.php_cs', // old v2 config, present here only to throw nice error message later |
|
565 | - $configDir.\DIRECTORY_SEPARATOR.'.php_cs.dist', // old v2 config, present here only to throw nice error message later |
|
562 | + $configDir . \DIRECTORY_SEPARATOR . '.php-cs-fixer.php', |
|
563 | + $configDir . \DIRECTORY_SEPARATOR . '.php-cs-fixer.dist.php', |
|
564 | + $configDir . \DIRECTORY_SEPARATOR . '.php_cs', // old v2 config, present here only to throw nice error message later |
|
565 | + $configDir . \DIRECTORY_SEPARATOR . '.php_cs.dist', // old v2 config, present here only to throw nice error message later |
|
566 | 566 | ]; |
567 | 567 | |
568 | 568 | if ($configDir !== $this->cwd) { |
569 | - $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php-cs-fixer.php'; |
|
570 | - $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php'; |
|
571 | - $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php_cs'; // old v2 config, present here only to throw nice error message later |
|
572 | - $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php_cs.dist'; // old v2 config, present here only to throw nice error message later |
|
569 | + $candidates[] = $this->cwd . \DIRECTORY_SEPARATOR . '.php-cs-fixer.php'; |
|
570 | + $candidates[] = $this->cwd . \DIRECTORY_SEPARATOR . '.php-cs-fixer.dist.php'; |
|
571 | + $candidates[] = $this->cwd . \DIRECTORY_SEPARATOR . '.php_cs'; // old v2 config, present here only to throw nice error message later |
|
572 | + $candidates[] = $this->cwd . \DIRECTORY_SEPARATOR . '.php_cs.dist'; // old v2 config, present here only to throw nice error message later |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | return $candidates; |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | $fixers = $this->createFixerFactory()->getFixers(); |
693 | 693 | |
694 | 694 | /** @var string[] $availableFixers */ |
695 | - $availableFixers = array_map(static function (FixerInterface $fixer) { |
|
695 | + $availableFixers = array_map(static function(FixerInterface $fixer) { |
|
696 | 696 | return $fixer->getName(); |
697 | 697 | }, $fixers); |
698 | 698 | |
@@ -710,11 +710,11 @@ discard block |
||
710 | 710 | $message .= sprintf( |
711 | 711 | '"%s"%s, ', |
712 | 712 | $unknownFixer, |
713 | - null === $alternative ? '' : ' (did you mean "'.$alternative.'"?)' |
|
713 | + null === $alternative ? '' : ' (did you mean "' . $alternative . '"?)' |
|
714 | 714 | ); |
715 | 715 | } |
716 | 716 | |
717 | - throw new InvalidConfigurationException(substr($message, 0, -2).'.'); |
|
717 | + throw new InvalidConfigurationException(substr($message, 0, -2) . '.'); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | foreach ($fixers as $fixer) { |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | $isIntersectionPathMode = self::PATH_MODE_INTERSECTION === $this->options['path-mode']; |
759 | 759 | |
760 | 760 | $paths = array_filter(array_map( |
761 | - static function (string $path) { |
|
761 | + static function(string $path) { |
|
762 | 762 | return realpath($path); |
763 | 763 | }, |
764 | 764 | $this->getPath() |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | if (is_file($path)) { |
782 | 782 | $pathsByType['file'][] = $path; |
783 | 783 | } else { |
784 | - $pathsByType['dir'][] = $path.\DIRECTORY_SEPARATOR; |
|
784 | + $pathsByType['dir'][] = $path . \DIRECTORY_SEPARATOR; |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | |
803 | 803 | return new \CallbackFilterIterator( |
804 | 804 | new \IteratorIterator($nestedFinder), |
805 | - static function (\SplFileInfo $current) use ($pathsByType) { |
|
805 | + static function(\SplFileInfo $current) use ($pathsByType) { |
|
806 | 806 | $currentRealPath = $current->getRealPath(); |
807 | 807 | |
808 | 808 | if (\in_array($currentRealPath, $pathsByType['file'], true)) { |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | $reportSummary->shouldAddAppliedFixers() |
93 | 93 | ); |
94 | 94 | $testsuite->appendChild($testcase); |
95 | - $assertionsCount += (int) $testcase->getAttribute('assertions'); |
|
95 | + $assertionsCount += (int)$testcase->getAttribute('assertions'); |
|
96 | 96 | } |
97 | 97 | |
98 | - $testsuite->setAttribute('tests', (string) \count($reportSummary->getChanged())); |
|
99 | - $testsuite->setAttribute('assertions', (string) $assertionsCount); |
|
100 | - $testsuite->setAttribute('failures', (string) $assertionsCount); |
|
98 | + $testsuite->setAttribute('tests', (string)\count($reportSummary->getChanged())); |
|
99 | + $testsuite->setAttribute('assertions', (string)$assertionsCount); |
|
100 | + $testsuite->setAttribute('failures', (string)$assertionsCount); |
|
101 | 101 | $testsuite->setAttribute('errors', '0'); |
102 | 102 | } |
103 | 103 | |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | { |
106 | 106 | $appliedFixersCount = \count($fixResult['appliedFixers']); |
107 | 107 | |
108 | - $testName = str_replace('.', '_DOT_', Preg::replace('@\.'.pathinfo($file, PATHINFO_EXTENSION).'$@', '', $file)); |
|
108 | + $testName = str_replace('.', '_DOT_', Preg::replace('@\.' . pathinfo($file, PATHINFO_EXTENSION) . '$@', '', $file)); |
|
109 | 109 | |
110 | 110 | $testcase = $dom->createElement('testcase'); |
111 | 111 | $testcase->setAttribute('name', $testName); |
112 | 112 | $testcase->setAttribute('file', $file); |
113 | - $testcase->setAttribute('assertions', (string) $appliedFixersCount); |
|
113 | + $testcase->setAttribute('assertions', (string)$appliedFixersCount); |
|
114 | 114 | |
115 | 115 | $failure = $dom->createElement('failure'); |
116 | 116 | $failure->setAttribute('type', 'code_style'); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | if (!empty($fixResult['diff'])) { |
130 | - $failureContent .= "\nDiff:\n---------------\n\n".$fixResult['diff']; |
|
130 | + $failureContent .= "\nDiff:\n---------------\n\n" . $fixResult['diff']; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | $failure->appendChild($dom->createCDATASection(trim($failureContent))); |
@@ -63,8 +63,8 @@ |
||
63 | 63 | { |
64 | 64 | $error = $dom->createElement('error'); |
65 | 65 | $error->setAttribute('severity', 'warning'); |
66 | - $error->setAttribute('source', 'PHP-CS-Fixer.'.$appliedFixer); |
|
67 | - $error->setAttribute('message', 'Found violation(s) of type: '.$appliedFixer); |
|
66 | + $error->setAttribute('source', 'PHP-CS-Fixer.' . $appliedFixer); |
|
67 | + $error->setAttribute('message', 'Found violation(s) of type: ' . $appliedFixer); |
|
68 | 68 | |
69 | 69 | return $error; |
70 | 70 | } |