Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generics support #7

Merged
merged 90 commits into from
Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
1f416d9
Target PHP-Parser 5.0
nikic Jun 4, 2022
5466ee3
Drop support for running on PHP 7.0
nikic Jun 4, 2022
2d58992
Fix incorrect doc type
nikic Jun 4, 2022
e70541f
Merge branch '4.x'
nikic Jun 4, 2022
9c5eb3c
Add some missing type annotations
nikic Jun 4, 2022
87387ca
Remove space before return type in pretty printer
nikic Jun 4, 2022
6c0b63d
Change print order of modifiers
Jan 25, 2022
27fe7a6
Include space after closure use
nikic Jun 4, 2022
5af93ee
Use nullable type instead of null default
nikic Jun 4, 2022
7c445bb
Remove space before return type in insertionMap (#841)
TomasVotruba Jun 4, 2022
aff98bb
Use PHP 8.0 token representation
nikic Jun 4, 2022
fe9db37
Perform token position adjustment during emulator patching
nikic Jun 5, 2022
472e163
Use extends instead of class_alias
nikic Jun 5, 2022
bdd131d
Add missing strict_types=1 directive to parser
nikic Jun 5, 2022
b6d11da
Add space after "use" during empty list insertion as well
nikic Jun 5, 2022
b4902ce
optimization haveTokenImmediatelyAfter performance
Nyamort Jun 10, 2022
d3d1297
Remove PHP 5 parser
nikic Jun 6, 2022
55f29b1
Improve ParserFactory version targeting
nikic Jun 12, 2022
3fd30f6
Remove deprecated param builder method
nikic Jun 12, 2022
23be1f9
Update doc references
nikic Jun 12, 2022
b0469d1
Rename Expr\ClosureUse -> ClosureUse
nikic Jun 12, 2022
e3ff8cf
Add support for true type
nikic Jun 19, 2022
71ed641
Handle true/false/null types in builder APIs
nikic Jun 19, 2022
6e0eec8
Move definition of compatibility tokens into separate file
nikic Jun 19, 2022
c878d71
Move token mapping from lexer to parser
nikic Jun 19, 2022
a38a60b
Move Tokens::T_* to Php7::T_*
nikic Jun 19, 2022
0ea134a
Add PHP 8 parser with correct concatenation precedence
nikic Jun 19, 2022
5aae65e
Add Parser::getLexer() method
nikic Jun 19, 2022
0086a26
Short scalar cast
MathiasReker Jul 4, 2022
572af7f
No unused imports
MathiasReker Jul 4, 2022
653757b
Nullable type declaration for default null value
MathiasReker Jul 4, 2022
4021a63
No superfluous elseif
MathiasReker Jul 4, 2022
de4ac93
Single blank line at eof
MathiasReker Jul 4, 2022
a3f2bb6
Add __serialize/__unserialize to ClassMethod::$magicNames
WinterSilence Jul 21, 2022
050342b
Add visibility modifiers to constants
MathiasReker Jul 4, 2022
1e89658
Add PhpVersion class
nikic Jul 23, 2022
a73c8ee
Add a phpVersion option to the pretty printer
nikic Jul 23, 2022
7bf6348
Remove inc/dec from precedence map
nikic Jul 23, 2022
59145a4
Treat assignments as unary operators
nikic Jul 23, 2022
84813dc
Avoid repeatedly downloading archive in run-php-src.sh
nikic Jul 23, 2022
c218db3
Add additional test case for assignment precedence
nikic Jul 23, 2022
646b490
Don't force newline after doc string when targeting PHP >= 7.3
nikic Jul 24, 2022
cf0cd60
Improve heuristic for escaping in single quoted strings
nikic Jul 24, 2022
e61bb11
Add additional upgrading notes for pretty printer
nikic Jul 24, 2022
9ef528f
ParserAbstract: remove undefined class in `use`
WinterSilence Aug 7, 2022
c55c7a2
Add json and ctype as required extensions in composer.json (#864)
WinterSilence Aug 7, 2022
1f504d2
Don't trim in Comment::getReformattedText()
nikic Aug 7, 2022
34d8681
Mark NodeVisitorAbstract as abstract class
nikic Aug 7, 2022
ea9d6b2
Always use pMaybeMultiline() for function parameters
WinterSilence Jul 21, 2022
652fb0c
Print trailing comma in param list if supported
nikic Aug 7, 2022
9b2a01a
Add support for DNF types (#862)
Girgias Aug 7, 2022
0201a7e
[docs] Add generic types to NodeFinder to allow returning exact type …
TomasVotruba Aug 8, 2022
f828b76
Fix typo
krsriq Aug 20, 2022
53b907d
Fix length bounds check in Name::slice()
nikic Aug 28, 2022
68fc1ba
Always use List_ node for array destructuring
nikic Aug 28, 2022
f62b2bf
Introduce separate Modifiers class
nikic Aug 28, 2022
dd63ddb
Add php-cs-fixer config and reformat
nikic Aug 28, 2022
a2753c8
Require strict_types in php-cs-fixer config
nikic Aug 28, 2022
a5033e3
Format tests as well
nikic Aug 29, 2022
3c3bcd3
Also format the grammar directory
nikic Aug 29, 2022
09c6048
Add CONTRIBUTING.md
nikic Aug 29, 2022
9857581
Add array/callable to BUILTIN_TYPE_VERSIONS
WinterSilence Aug 29, 2022
892b07c
Add some test coverage for Token class
nikic Aug 29, 2022
bf39f6a
Update grammar/README.md (#877)
WinterSilence Aug 30, 2022
0933986
Make sure Array nodes can not contain null
nikic Sep 1, 2022
8be56af
Rename Expr\ArrayItem to ArrayItem
nikic Sep 2, 2022
035c1c7
Rename Stmt\StaticVar to StaticVar
nikic Sep 2, 2022
9dca6f1
Add test for StaticVar rename
nikic Sep 2, 2022
a2608f0
Support empty list insertion for attributes
nikic Sep 3, 2022
f5b56a5
Remove MODIFIER_ prefix from node dumps
nikic Sep 3, 2022
2b562b7
Update default of ClassMethod::$flags in docs
nikic Sep 3, 2022
66b20bd
Rename Scalar\DNumber to Scalar\Float_
nikic Sep 3, 2022
23835d2
Rename Scalar\LNumber to Scalar\Int_
nikic Sep 3, 2022
f4ec6a1
Rename Scalar\EncapsedStringPart to InterpolatedStringPart
nikic Sep 3, 2022
11caa3b
Add compat shim for EncapsedStringPart
nikic Sep 3, 2022
a44faa6
Rename Scalar\Encapsed to Scalar\InterpolatedString
nikic Sep 3, 2022
c42290a
Support REMOVE_NODE from enterNode()
nikic Sep 3, 2022
a3b0541
Support array return from enterNode()
nikic Sep 3, 2022
03ccfa3
Rename Stmt\DeclareDeclare to DeclareItem
nikic Sep 3, 2022
e1345f0
Rename Stmt\PropertyProperty to PropertyItem
nikic Sep 3, 2022
4917c71
Rename Stmt\UseUse to UseItem
nikic Sep 3, 2022
5f3ad31
Fix ArrayItem entries in pretty printer maps
nikic Sep 3, 2022
8ed7672
Switch modifierChangeMap to use class name
nikic Sep 3, 2022
c585a2d
Switch list insertion maps to use class name
nikic Sep 3, 2022
a772853
Fix formatting preservation for match
nikic Sep 3, 2022
9a230cd
Update changelog
nikic Sep 3, 2022
44c6a97
Fix empty list insertion of multiple attributes
nikic Sep 4, 2022
ed31795
nikic/PHP-Parser v4.15.0
mrsuh Sep 4, 2022
03dd225
Merge branch 'master' of github.com:nikic/PHP-Parser into generics-su…
mrsuh Sep 4, 2022
6affec9
nikic/PHP-Parser v4.15.1
mrsuh Sep 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix ArrayItem entries in pretty printer maps
The tests were written in such a way that the regression was not
caught.
  • Loading branch information
nikic committed Sep 3, 2022
commit 5f3ad31501db987252525f8ea58cc7a2f0886995
4 changes: 2 additions & 2 deletions lib/PhpParser/PrettyPrinterAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ protected function initializeRemovalMap() {
$stripEquals = ['left' => '='];
$this->removalMap = [
'Expr_ArrayDimFetch->dim' => $stripBoth,
'Expr_ArrayItem->key' => $stripDoubleArrow,
'ArrayItem->key' => $stripDoubleArrow,
'Expr_ArrowFunction->returnType' => $stripColon,
'Expr_Closure->returnType' => $stripColon,
'Expr_Exit->expr' => $stripBoth,
Expand Down Expand Up @@ -1293,7 +1293,7 @@ protected function initializeInsertionMap() {
// [$find, $beforeToken, $extraLeft, $extraRight]
$this->insertionMap = [
'Expr_ArrayDimFetch->dim' => ['[', false, null, null],
'Expr_ArrayItem->key' => [null, false, null, ' => '],
'ArrayItem->key' => [null, false, null, ' => '],
'Expr_ArrowFunction->returnType' => [')', false, ': ', null],
'Expr_Closure->returnType' => [')', false, ': ', null],
'Expr_Ternary->if' => ['?', false, ' ', ' '],
Expand Down
6 changes: 3 additions & 3 deletions test/code/formatPreservation/insertionOfNullable.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $foo
];

[
$value
& $value
];

function
Expand Down Expand Up @@ -107,7 +107,7 @@ $foo
];

[
'X' => $value
'X' => & $value
];

function
Expand Down Expand Up @@ -191,4 +191,4 @@ try
}
catch (Exception $e)
{
}
}
6 changes: 3 additions & 3 deletions test/code/formatPreservation/removalViaNull.test
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $foo
? $bar :
$baz;
[ $a => $b
, $c => $d];
, $c => & $d];

yield
$foo
Expand Down Expand Up @@ -149,7 +149,7 @@ $foo
?:
$baz;
[ $a => $b
, $d];
, & $d];

yield
$bar;
Expand Down Expand Up @@ -209,4 +209,4 @@ try
}
catch (Exception)
{
}
}