Changed
- Don't preserve newlines after
return
,yield
,yield from
orthrow
- Preserve newlines after assignment operators, including
??=
, even when--operators-first
is givenThis addresses inconsistent behaviour where
pretty-php
moved??=
to the next line by default, and assignment operators other than=
to the next line when--operators-first
was given. Now they are always kept on the same line as the receiving variable. - Move comments if necessary for correct placement of
?
,:
,->
and?->
operators - Never demote DocBlocks to standard C-style comments
PHP recognises doc comments even when unrelated code or comments appear between them and the structural elements they document, so this "precaution" was unnecessary at best. Apologies for any confusion or frustration caused.
Fixed
-
Fix hanging indentation issue within ternary expressions (#156)
Before:
<?php foo( $bar, fn($a, $b) => $a->Foo <=> $b->Foo ?: $a->Bar <=> $b->Bar ?: $a->Baz <=> $b->Baz ?: $a->Qux <=> $b->Qux ?: $a->Quux <=> $b->Quux, );
After:
<?php foo( $bar, fn($a, $b) => $a->Foo <=> $b->Foo ?: $a->Bar <=> $b->Bar ?: $a->Baz <=> $b->Baz ?: $a->Qux <=> $b->Qux ?: $a->Quux <=> $b->Quux, );
-
Fix issue where statements are not parsed correctly if there are inline comments like:
<?php if ($foo): foo(); else /* comment */: bar(); endif;
-
Fix issue where
--timers
output does not include individual metrics