Skip to content

Commit 4537dea

Browse files
committed
Merge branch '2.15' into 2.16
* 2.15: Priority issues FunctionsAnalyzer - better isGlobalFunctionCall detection # Conflicts: # src/Fixer/Phpdoc/PhpdocScalarFixer.php # src/Fixer/Phpdoc/PhpdocTypesFixer.php
2 parents cfa7d2e + b67c5fd commit 4537dea

35 files changed

+861
-120
lines changed

src/Console/Command/HelpCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use PhpCsFixer\Console\Application;
1717
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
1818
use PhpCsFixer\Fixer\ConfigurationDefinitionFixerInterface;
19-
use PhpCsFixer\Fixer\DefinedFixerInterface;
2019
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
2120
use PhpCsFixer\Fixer\FixerInterface;
2221
use PhpCsFixer\FixerConfiguration\AliasedFixerOption;
@@ -473,11 +472,7 @@ static function (FixerInterface $a, FixerInterface $b) {
473472
foreach ($fixers as $i => $fixer) {
474473
$sets = $getSetsWithRule($fixer->getName());
475474

476-
if ($fixer instanceof DefinedFixerInterface) {
477-
$description = $fixer->getDefinition()->getSummary();
478-
} else {
479-
$description = '[n/a]';
480-
}
475+
$description = $fixer->getDefinition()->getSummary();
481476

482477
if ($fixer instanceof DeprecatedFixerInterface) {
483478
$successors = $fixer->getSuccessorsNames();

src/Fixer/ClassNotation/OrderedClassElementsFixer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ final class OrderedClassElementsFixer extends AbstractFixer implements Configura
3030
{
3131
/** @internal */
3232
const SORT_ALPHA = 'alpha';
33+
3334
/** @internal */
3435
const SORT_NONE = 'none';
3536

@@ -345,8 +346,6 @@ private function getElements(Tokens $tokens, $startIndex)
345346
$elements[] = $element;
346347
$startIndex = $element['end'] + 1;
347348
}
348-
349-
return [];
350349
}
351350

352351
/**

src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ public function getPriority()
7676
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
7777
{
7878
for ($index = $tokens->count() - 1; 0 <= $index; --$index) {
79-
$token = $tokens[$index];
80-
81-
if (!$token->equals([T_STRING, 'dirname'], false)) {
82-
continue;
83-
}
84-
8579
$dirnameInfo = $this->getDirnameInfo($tokens, $index);
8680

8781
if (!$dirnameInfo) {

src/Fixer/FunctionNotation/ImplodeCallFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
7575
{
7676
$functionsAnalyzer = new FunctionsAnalyzer();
7777

78-
foreach ($tokens as $index => $token) {
78+
for ($index = \count($tokens) - 1; $index > 0; --$index) {
7979
if (!$tokens[$index]->equals([T_STRING, 'implode'], false)) {
8080
continue;
8181
}

src/Fixer/PhpTag/NoClosingTagFixer.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ public function isCandidate(Tokens $tokens)
4949
*/
5050
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
5151
{
52-
if (\count($tokens) < 2 || !$tokens->isMonolithicPhp()) {
53-
return;
54-
}
55-
56-
if (!$tokens->isTokenKindFound(T_CLOSE_TAG)) {
52+
if (\count($tokens) < 2 || !$tokens->isMonolithicPhp() || !$tokens->isTokenKindFound(T_CLOSE_TAG)) {
5753
return;
5854
}
5955

src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ function foo ($bar) {}
4646
/**
4747
* {@inheritdoc}
4848
*
49-
* Must run before PhpdocAlignFixer.
50-
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
49+
* Must run before PhpdocAlignFixer, PhpdocTypesFixer, PhpdocTypesOrderFixer.
50+
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocToCommentFixer.
5151
*/
5252
public function getPriority()
5353
{
54-
return 0;
54+
return 17;
5555
}
5656

5757
/**

src/Fixer/Phpdoc/PhpdocScalarFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function sample($a, $b, $c)
6565
/**
6666
* {@inheritdoc}
6767
*
68-
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocAnnotationWithoutDotFixer, PhpdocInlineTagFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
68+
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocInlineTagFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
6969
* Must run after PhpdocTypesFixer.
7070
*/
7171
public function getPriority()

src/Fixer/Phpdoc/PhpdocTypesFixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public function getDefinition()
105105
/**
106106
* {@inheritdoc}
107107
*
108-
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocAnnotationWithoutDotFixer, PhpdocInlineTagFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
109-
* Must run after PhpdocIndentFixer.
108+
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocInlineTagFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
109+
* Must run after PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer.
110110
*/
111111
public function getPriority()
112112
{

src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getDefinition()
8888
* {@inheritdoc}
8989
*
9090
* Must run before PhpdocAlignFixer.
91-
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
91+
* Must run after CommentToPhpdocFixer, PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
9292
*/
9393
public function getPriority()
9494
{

src/Report/ReporterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function create()
3232

3333
public function registerBuiltInReporters()
3434
{
35-
/** @var string[] $builtInReporters */
35+
/** @var null|string[] $builtInReporters */
3636
static $builtInReporters;
3737

3838
if (null === $builtInReporters) {

0 commit comments

Comments
 (0)