History log of /PHP-Parser/ (Results 176 – 200 of 1690)
Revision (<<< Hide revision tags) (Show revision tags >>>)Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
3bd38c5b25-Feb-2023 Nikita Popov

Properly support prefix operator precedence printing

The pretty printer is supposed to produce a minimal-parentheses
printing for expressions. However, for prefix operators, we were

Properly support prefix operator precedence printing

The pretty printer is supposed to produce a minimal-parentheses
printing for expressions. However, for prefix operators, we were
failing to do so in ways that are practically meaningful, e.g.
$a = yield from $b produced redundant parentheses around the
yield from.

For prefix operators, the precedence of the direct parent operator
is not actually relevant: What matters is the precedence of any
infix operator whose LHS it appears on. For example, $a . include $b
does not require parentheses, but (include $a) . $b does.

To handle this, keep separate track of the parent operator
precedence, and a special LHS precedence which is used for unary
operator printing only. Because the LHS precedence may not come
from the direct parent, we have to pass it down the call stack.
And if we do that, we may as well do the same for the parent
precedence.

This also fixes an integration test failure with php-src, because
arrow function precedence was previously not respected (and would
be ugly to respect without this change).

show more ...

e9416a0e26-Feb-2023 Nikita Popov

Support fixup for dynamic class const name

This is new in PHP 8.3.

7b4a8c1e26-Feb-2023 Nikita Popov

Properly handle static deref LHS

The rules for static and array/object deref are slightly different:
The former does not allow constants.

ee3c80f926-Feb-2023 Nikita Popov

Add .idea and .php-cs-fixer.cache to .gitignore

9476cff326-Feb-2023 Nikita Popov

Doc string end label may have leading whitespace

When detecting whether the string contains the end label, allow
leading whitespace in front of it. This is legal since the
introducti

Doc string end label may have leading whitespace

When detecting whether the string contains the end label, allow
leading whitespace in front of it. This is legal since the
introduction of flexible doc strings.

show more ...

6a88bdb026-Feb-2023 Nikita Popov

Support new variables in fixup

1eb6b56526-Feb-2023 Nikita Popov

Properly handle new/instanceof operand restrictions

Fixes #912.

d24745dd26-Feb-2023 Nikita Popov

Respect precedence during clone pretty printing

Clone is the prefix operator with the highest operator precedence,
but was not treated as an operator at all.

cd3c0c1126-Feb-2023 Nikita Popov

Remove __halt_compiler from semi reserved keyword list

Apparently PHP does not allow use of __halt_compiler as a
semi-reserved keyword.

f6ddde6426-Feb-2023 Nikita Popov

Perform end label check on escaped string

Escaping might convert a label character into an escape sequence
if it is not valid UTF-8.

47626c7426-Feb-2023 Nikita Popov

Handle interpolated variable after end label

Interpolated variables start with non-label characters, and as
such also count as end label terminators since PHP 7.3.

ce3337b026-Feb-2023 Nikita Popov

Update allowed characters after doc string label

With the introduction of flexible doc strings, the ending label
is no longer required to be followed by a semicolon or newline.
We ne

Update allowed characters after doc string label

With the introduction of flexible doc strings, the ending label
is no longer required to be followed by a semicolon or newline.
We need to prevent doc string printing if the label is followed
by any non-label character.

show more ...

d83562e626-Feb-2023 Nikita Popov

Print INF as 1.0E+1000

This makes pretty printing round trip to another Float literal,
rather than a constant lookup. The 1e1000 form in particular is
chosen because that seems to be

Print INF as 1.0E+1000

This makes pretty printing round trip to another Float literal,
rather than a constant lookup. The 1e1000 form in particular is
chosen because that seems to be the typical form used in various
tests.

show more ...

55cc60c226-Feb-2023 Nikita Popov

Add tools directory to export-ignore

2df8878f29-Jan-2023 Nikita Popov

[PHP 8.3] Support dynamic class const fetch

RFC: https://wiki.php.net/rfc/dynamic_class_constant_fetch

8ad4129414-Dec-2022 Markus Staab

Declare list types (#907)

Closes #905

4c4af21d14-Dec-2022 Markus Staab

Rewrote overly magic code to make it readable (#906)

New code inspired by https://github.com/nikic/PHP-Parser/blob/950bf8f1d1865cfd0d248e13a3455db0be1d870c/lib/PhpParser/Builder/Trait_.php#

Rewrote overly magic code to make it readable (#906)

New code inspired by https://github.com/nikic/PHP-Parser/blob/950bf8f1d1865cfd0d248e13a3455db0be1d870c/lib/PhpParser/Builder/Trait_.php#L43

show more ...

21a3e8ca14-Dec-2022 Nikita Popov

Fix attrGroups/attributes confusion in EnumCase builder

Found by staabm in #907.

950bf8f112-Nov-2022 Nikita Popov

Adjust tests to work on 32-bit

Fixes #662.

4ce9781212-Nov-2022 Nikita Popov

Fix parsing of large hex floats containing "e"

These ended up taking the code path for normal floats and being
cast to zero.

f077f76530-Oct-2022 Nikita Popov

Add some unit tests for PhpVersion

b0edd4c421-Sep-2022 Nikita Popov

Bail out on PHP tags in removed code

If dropping a node would drop PHP tags, bail out of formatting
preservation. This will lose formatting, but at least produce
legal code.

Bail out on PHP tags in removed code

If dropping a node would drop PHP tags, bail out of formatting
preservation. This will lose formatting, but at least produce
legal code.

Closes GH-884.

show more ...

bad10e1621-Sep-2022 Nikita Popov

Add more tests for formatting preservation with InlineHTML

It's all broken...

4bcdf74b21-Sep-2022 Nikita Popov

Add support for perserving formatting for static modifier change

Closes GH-891.

46558ed919-Sep-2022 Abdul Malik Ikhsan

Show missing format preservation when adding static modifier to closure

12345678910>>...68