Skip to content

Commit

Permalink
Merge remote-tracking branch 'o/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Mar 21, 2024
2 parents 7662d69 + f9d2511 commit 7d28e30
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ CHANGELOG for PHP CS Fixer

This file contains changelogs for stable releases only.

Changelog for v3.52.1
---------------------

* fix: StatementIndentationFixer - do not crash on ternary operator in class property (#7899)
* fix: `PhpCsFixer\Tokenizer\Tokens::setSize` return type (#7900)

Changelog for v3.52.0
---------------------

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
final class Application extends BaseApplication
{
public const NAME = 'PHP CS Fixer';
public const VERSION = '3.52.1-DEV';
public const VERSION = '3.52.2-DEV';
public const VERSION_CODENAME = '15 Keys';

private ToolInfo $toolInfo;
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Whitespace/StatementIndentationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
} elseif ($token->equals(':')) {
if (isset($caseBlockStarts[$index])) {
[$endIndex, $endIndexInclusive] = $this->findCaseBlockEnd($tokens, $index);
} else {
} elseif ($this->alternativeSyntaxAnalyzer->belongsToAlternativeSyntax($tokens, $index)) {
$endIndex = $this->alternativeSyntaxAnalyzer->findAlternativeSyntaxBlockEnd($tokens, $alternativeBlockStarts[$index]);
}
} elseif ($token->isGivenKind(CT::T_DESTRUCTURING_SQUARE_BRACE_OPEN)) {
Expand Down
1 change: 1 addition & 0 deletions src/Tokenizer/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ public static function getBlockEdgeDefinitions(): array
*
* @param int $size
*/
#[\ReturnTypeWillChange]
public function setSize($size): bool
{
if ($this->getSize() !== $size) {
Expand Down
10 changes: 10 additions & 0 deletions tests/Fixer/Whitespace/StatementIndentationFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,16 @@ class Foo
1,
];',
];

yield 'ternary operator in property' => [
<<<'PHP'
<?php
class Foo
{
public int $bar = BAZ ? -1 : 1;
}
PHP
];
}

/**
Expand Down

0 comments on commit 7d28e30

Please sign in to comment.