Skip to content

Commit

Permalink
Merge branch 'php-8.0/generic-scopeindent-support-nullsafe-operator' of
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Sep 9, 2020
2 parents db9089d + 07df22e commit bf1d2b2
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,8 @@ public function process(File $phpcsFile, $stackPtr)
// Don't perform strict checking on chained method calls since they
// are often covered by custom rules.
if ($checkToken !== null
&& $tokens[$checkToken]['code'] === T_OBJECT_OPERATOR
&& ($tokens[$checkToken]['code'] === T_OBJECT_OPERATOR
|| $tokens[$checkToken]['code'] === T_NULLSAFE_OBJECT_OPERATOR)
&& $exact === true
) {
$exact = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,15 @@ return [
]),
];

echo $string?->append('foo')
?->outputUsing();

// phpcs:set Generic.WhiteSpace.ScopeIndent exact true
echo $string?->append('foo')
?->outputUsing();
// phpcs:set Generic.WhiteSpace.ScopeIndent exact false

/* ADD NEW TESTS ABOVE THIS LINE AND MAKE SURE THAT THE 1 (space-based) AND 2 (tab-based) FILES ARE IN SYNC! */
?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,15 @@ return [
]),
];

echo $string?->append('foo')
?->outputUsing();

// phpcs:set Generic.WhiteSpace.ScopeIndent exact true
echo $string?->append('foo')
?->outputUsing();
// phpcs:set Generic.WhiteSpace.ScopeIndent exact false

/* ADD NEW TESTS ABOVE THIS LINE AND MAKE SURE THAT THE 1 (space-based) AND 2 (tab-based) FILES ARE IN SYNC! */
?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,15 @@ return [
]),
];

echo $string?->append('foo')
?->outputUsing();

// phpcs:set Generic.WhiteSpace.ScopeIndent exact true
echo $string?->append('foo')
?->outputUsing();
// phpcs:set Generic.WhiteSpace.ScopeIndent exact false

/* ADD NEW TESTS ABOVE THIS LINE AND MAKE SURE THAT THE 1 (space-based) AND 2 (tab-based) FILES ARE IN SYNC! */
?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,15 @@ return [
]),
];

echo $string?->append('foo')
?->outputUsing();

// phpcs:set Generic.WhiteSpace.ScopeIndent exact true
echo $string?->append('foo')
?->outputUsing();
// phpcs:set Generic.WhiteSpace.ScopeIndent exact false

/* ADD NEW TESTS ABOVE THIS LINE AND MAKE SURE THAT THE 1 (space-based) AND 2 (tab-based) FILES ARE IN SYNC! */
?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ public function getErrorList($testFile='ScopeIndentUnitTest.inc')
1340 => 1,
1342 => 1,
1345 => 1,
1464 => 1,
1465 => 1,
1466 => 1,
1467 => 1,
1473 => 1,
1474 => 1,
1475 => 1,
1476 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit bf1d2b2

Please sign in to comment.