1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-27 04:14:44 +01:00
Commit Graph

480 Commits

Author SHA1 Message Date
Nikita Popov
ff2d85dc6b Add constFetch() and classConstFetch() builders 2018-03-03 22:14:42 +01:00
Nikita Popov
b998d1e9b5 Add funcCall(), methodCall() and staticCall() builders 2018-03-03 15:40:51 +01:00
Nikita Popov
6aba7624ed Add replacement sanity check in traverser 2018-03-03 13:22:36 +01:00
Nikita Popov
ad9c42b66a Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php5.php
	lib/PhpParser/Parser/Php7.php
2018-01-30 23:07:11 +01:00
Nikita Popov
08215e7646 Fix duplicate switch comment assignment
Fixes #469.
2018-01-30 23:06:20 +01:00
Nikita Popov
a513ccabb7 Improve constant evaluation and add docs
Split into evaluateDirectly() and evaluateSilently(), to be able
to treat errors more gracefully. Add documentation for constant
evaluation.
2018-01-27 17:47:45 +01:00
Nikita Popov
6a273c9fbd Remove Autoloader class 2018-01-25 23:13:53 +01:00
Nikita Popov
1cdb280a30 Merge branch '3.x' 2018-01-25 22:28:08 +01:00
Nikita Popov
d01fafcb40 Handle +(++$x) and -(--$x) as well 2018-01-25 22:27:37 +01:00
Nikita Popov
b85b6b3519 Merge branch '3.x'
Conflicts:
	lib/PhpParser/PrettyPrinter/Standard.php
2018-01-25 22:18:32 +01:00
Nikita Popov
94c715d97e Fix pretty printing of -(-$x) and +(+$x)
Fixes #459.
2018-01-25 22:17:35 +01:00
Nikita Popov
4dacbb8d39 FPPP: Fix indentation on list insertion
Use indentation of last list element, instead of indentation
before the insertion point.

Fixes #466.
2018-01-25 22:08:40 +01:00
Gabriel Caruso
edafeb85c4 [CS] Order uses A -> Z 2018-01-13 16:08:27 +01:00
Gabriel Caruso
68d07c4662 [CS] New line in the end of file 2018-01-13 16:08:26 +01:00
Gabriel Caruso
8fae99aafe [CS] Remove spaces 2018-01-13 16:08:25 +01:00
Nikita Popov
c7ada124d0 [CS] Use ::class notation instead of string
Conflicts:
	test/PhpParser/ParserFactoryTest.php
	test/PhpParser/ParserTest.php
2018-01-13 16:08:17 +01:00
Gabriel Caruso
e0a2043089 [CS] Space before casting 2018-01-13 16:03:57 +01:00
Gabriel Caruso
7f72c84122 [CS] Open class brackets in new line 2018-01-13 16:03:55 +01:00
Nikita Popov
5285df8f22 [CS] Use elseif instead of else if
Conflicts:
	lib/PhpParser/TokenStream.php
2018-01-13 16:03:36 +01:00
Nikita Popov
92b39e3d1f Fix nNextFreeElement for arrays with trailing comma
Ugh.
2017-12-26 21:17:36 +01:00
Nikita Popov
1c7fd314d1 FPPP: Add heuristic for multi-line lists 2017-12-26 21:14:36 +01:00
Nikita Popov
8d3cb5f57b FPPP: Fallback if we must insert a block 2017-12-26 15:41:38 +01:00
Nikita Popov
de82a40d04 FPPP: Add broken InlineHTML test cases 2017-12-26 15:08:30 +01:00
Nikita Popov
a86151f24f FPPP: Fix fallback for inline HTML 2017-12-26 15:08:29 +01:00
Gabriel Caruso
83b958763f Refactoring tests 2017-12-15 21:42:34 +01:00
Gabriel Caruso
4dbb02c57b Use Null Coalesce Operator 2017-12-15 21:41:41 +01:00
Nikita Popov
4fcdac40d1 FPPP: Fix insertion of multiple elems at start 2017-12-02 15:10:15 +01:00
Nikita Popov
04feb90d79 Rename abc1.test to basic.test
And split off fixup.test.
2017-12-01 23:15:50 +01:00
Nikita Popov
dc3ace55c3 FPPP: Support insert at start of list node (#446) 2017-12-01 22:09:51 +01:00
Nikita Popov
e5453f0d46 Extract pSingleQuotedString as an extension point
And add some more string formatting tests.
2017-12-01 18:31:21 +01:00
Nikita Popov
b507fa43da Ensure names are not empty 2017-12-01 18:13:55 +01:00
Nikita Popov
336a49b428 FPPP: Fix comment indentation (#443) 2017-11-13 13:27:27 +01:00
Nikita Popov
4392a7b164 Fix PHP5 static call fixup
Variable nodes directly store the variable name as a string, they
don't use VarLikeIdentifier. So remove this wrapper if it exists.
2017-11-11 12:23:14 +01:00
Nikita Popov
457fe049a8 Ensure nodes have full complement of location info 2017-11-04 18:13:00 +01:00
Nikita Popov
6a2e1ae440 FPPP: Graceful handling of comment changes 2017-11-04 17:56:11 +01:00
Nikita Popov
47c973b3aa Store start token position in comments 2017-11-04 17:45:14 +01:00
Nikita Popov
56bc8ebb9b FPPP: Add support for removal from list nodes 2017-11-04 17:23:17 +01:00
Nikita Popov
fd6e8d7ea8 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Builder/Namespace_.php
	lib/PhpParser/Node/Stmt/ClassMethod.php
	test/PhpParser/Builder/NamespaceTest.php
2017-11-04 12:45:04 +01:00
Nikita Popov
0ba710affa Add setDocComment() to namespace build (#437) 2017-11-04 12:43:02 +01:00
TomasVotruba
b58157f024 add strict_types to tests + fix explode type 2017-11-03 13:24:19 +01:00
Nikita Popov
b241a121a3 Fix trait alias to semi-reserved name parsing
This was missing the explicit construction of an Identifier node.
2017-10-29 14:15:48 +01:00
Nikita Popov
5900d78cc9 FPPP: Support anonymous classes (#432)
This is a huge hack... We temporarily create a new node with the
correct structure and use that for printing.

I think it would be better to always use a separate node type for
NewAnonClass, rather than using a combination of New and Class,
but this would require some larger changes, as this node type would
have to be both Expr and ClassLike, which is not possible right now,
as the latter is a class rather than an interface...
2017-10-29 12:26:12 +01:00
Nikita Popov
776275361a FPPP: Support modifier changes (#428)
I decided against introducing a node type for this. In the end it
would require special handling anyway.
2017-10-25 22:27:29 +02:00
Nikita Popov
f5de7f9894 FPPP: Check that nodes are nodes in pArray() 2017-10-18 15:42:01 +02:00
Nikita Popov
bbec051e51 FPPP: Consolidate indentation levels
A bit annoying that we have to keep $this->nl always synchronized.
2017-10-06 18:21:08 +02:00
Nikita Popov
f071b66013 Print comments of inserted statements 2017-10-06 17:58:56 +02:00
Nikita Popov
57bc42517b Move IdentifierTest where it belongs
Ooops...
2017-10-06 15:07:35 +02:00
Nikita Popov
bb2ac91115 Move leading space out of pStmt_Else
Same as previous commit. Also add support for pStmt_If->else
insertion.
2017-10-06 14:56:59 +02:00
Nikita Popov
310155832a FPPP: Support insertion into list subnodes
With some rough edges...
2017-10-06 14:43:41 +02:00
Nikita Popov
ed8a744cd5 FPPP: Switch pArray() to use node list diffing 2017-10-06 12:02:00 +02:00