Commit Graph

584 Commits

Author SHA1 Message Date
Nikita Popov
8982315b4e Rename Cast\Object as well
As it will very likely be soft-reserved in PHP 7.

Old alias is still available, as usual.
2015-03-21 18:57:55 +01:00
Nikita Popov
0f556c16f5 Fix a few more Scalar\String_ occurances
Totally forgot that the parser uses macros...
2015-03-21 18:54:52 +01:00
Nikita Popov
7ec277e1e1 Replace another Scalar\String occurance
Also canonicalize NameResover tests to avoid those pesky CRLF
issues.
2015-03-21 18:47:20 +01:00
Nikita Popov
1a627872f0 Rename nodes for compat with PHP 7
The old names will still be available on PHP 5.x.
2015-03-20 21:49:38 +01:00
Nikita Popov
592836c4dc Add support for T_HASHBANG (HHVM) 2015-03-14 19:53:08 +01:00
Nikita Popov
68defc2c6a Merge pull request #183 from alprs/fix-autoloader
Ensure compatibility with multiple composer autoloaders
2015-03-14 09:07:35 +01:00
Andreas Lutro
d225555830 Ensure compatibility with multiple autoloaders
Running a .phar or regular PHP executable that requires and includes its own
version of php-parser will cause a "cannot redeclare class" error if said
executable also includes the autoloader of the current working directory.
2015-03-13 23:54:32 +01:00
Nikita Popov
251e689283 Add support for spaceship operator (<=>) [PHP 7]
Added as Expr\BinaryOp\Spaceship.
2015-03-12 23:13:31 +01:00
Nikita Popov
01f4be6b4d Add support for null coalesce operator (??) [PHP 7]
Added as Expr\BinaryOp\Coalesce.
2015-03-12 22:45:56 +01:00
Nikita Popov
dc28449d81 Drop whitespace after ... varargs collection
Also drop an obsolete pretty printer test.
2015-03-12 22:19:34 +01:00
Nikita Popov
3ad0d4b310 Add support for return type declarations [PHP 7]
This adds an additional "returnType" subnode to Stmt\Function_,
Stmt\ClassMethod and Expr\Closure, as well as the corresponding
support in the name resolver and pretty printer.
2015-03-12 22:16:12 +01:00
Nikita Popov
4dbf067b4b Add a few more string interpolation tests
Originally wanted to simplify the pretty-printer output, but ...
edge cases everywhere :/
2015-03-11 20:01:26 +01:00
Nikita Popov
5567f0ab3b Add documentation TOC to readme 2015-03-10 21:32:21 +01:00
Nikita Popov
0c34706799 Add "use" builder 2015-03-10 16:05:55 +01:00
Nikita Popov
f9fc2fc9ee Add support for global namespace in NS builder
NULL argument can now be used to create a global namespace {} block.
2015-03-10 15:28:19 +01:00
Nikita Popov
a2d7e8977a Use real properties for storing subnodes
Instead of storing subnodes in a subNodes dictionary, they are
now stored as simple properties. This requires declarating the
properties, assigning them in the constructor, overriding
the getSubNodeNames() method and passing NULL to the first argument
of the NodeAbstract constructor.

[Deprecated: It's still possible to use the old mode of operation
for custom nodes by passing an array of subnodes to the constructor.]

The only behavior difference this should cause is that getSubNodeNames()
will always return the original subnode names and skip any additional
properties that were dynamically added. E.g. this means that the
"namespacedName" node added by the NameResolver visitor is not treated
as a subnode, but as a dynamic property instead.

This change improves performance and memory usage.
2015-03-09 08:54:20 +01:00
Thomas Ruiz
73cace360d Implicit public should not generate as explicit public 2015-03-08 20:21:01 +01:00
Nikita Popov
c96636d192 Revert "Create .gitattributes with basic export-ignores"
This reverts commit 0dd2b9a74c.

Not having tests available causes issues for downstream
distributors. See issue #178.
2015-03-08 19:38:13 +01:00
Nikita Popov
d56ff5a351 Fix lexer tests for HHVM
HHVM does not throw warnings from token_get_all()
for invalid chars and unterminated comments. This
is not really integral functionality, so I'm okay
to just skip it to get a passing HHVM build.
2015-02-26 19:19:40 +01:00
Nikita Popov
3028bc8081 And make it work on PHP 5 as well... 2015-02-26 16:40:21 +01:00
Nikita Popov
91295a0790 Make tests compatible with PHP 7
When parsing on PHP 7 we will no longer be able to deal with
code that contains invalid octal literals. Currently we'll fatal,
after engine exceptions land we'll throw an exception instead.
2015-02-26 16:26:29 +01:00
Nikita Popov
d600c60779 Add PHP 7 to travis build 2015-02-26 15:25:34 +01:00
Hugo Fonseca
e3bc5b564d Added php shebang 2015-02-24 21:43:12 +01:00
Nikita Popov
53eac36a3f Merge pull request #175 from staabm/patch-1
prevent a unnecessary concat
2015-02-13 18:03:18 +01:00
Markus Staab
ce5c76d79b prevent a unnecessary concat
analog to b7ffdbbb92
2015-02-13 16:02:54 +01:00
Nikita Popov
b7ffdbbb92 Optimize node dumper
For very deeply nested node trees this extra concatenation makes a
huge difference...
2015-02-13 15:20:25 +01:00
Nikita Popov
8f1eacdab7 Increase recommended xdebug.max_nesting_level
Looks like 2000 is not quite enough for some cases...
2015-02-13 15:04:00 +01:00
Tom Rochette
1366e833a1 Move getMethods() to new ClassLike node
Class_, Interface_ and Trait_ extend the ClassLike node, which
provides the getMethods() method.
2015-01-31 22:59:38 +01:00
Nikita Popov
6930feac43 Add some tests for pretty printing expressions 2015-01-18 19:57:09 +01:00
Nikita Popov
54275ad181 Merge pull request #167 from GrahamCampbell/patch-1
Fixed branch alias
2015-01-18 12:54:05 +01:00
Graham Campbell
21ca7eaf1b Fixed branch alias 2015-01-18 11:46:36 +00:00
Nikita Popov
a86779198f Fix branch alias (maybe?) 2015-01-18 12:41:16 +01:00
Nikita Popov
ac05ef6f95 Release PHP-Parser 1.1 2015-01-18 12:29:59 +01:00
Nikita Popov
74251fca9f Update changelog 2015-01-18 00:11:19 +01:00
Nikita Popov
0a445c7656 Test lexer returning invalid token 2015-01-18 00:11:10 +01:00
Nikita Popov
a710f32a6a Make Node\Expr\BinOp an abstract class
Only the children should be used ...
2015-01-18 00:10:02 +01:00
Nikita Popov
9689763e20 Cover both DONT_TRAVERSE_CHILDREN cases 2015-01-18 00:10:01 +01:00
Nikita Popov
1a63a915f2 Merge pull request #163 from rmruano/gitattributes
Create .gitattributes with basic export-ignores
2015-01-11 22:34:05 +01:00
Nikita Popov
4071c4645d Add NodeTraverser::DONT_TRAVERSE_CHILDREN support 2015-01-11 22:13:58 +01:00
Nikita Popov
f56db26d8b Doc fixes 2015-01-11 21:39:02 +01:00
Rubén Moraleda
0dd2b9a74c Create .gitattributes with basic export-ignores 2015-01-09 21:19:19 +01:00
Nikita Popov
4cd2b95a23 Fix 5.3 build and some small cleanups 2014-12-19 18:54:56 +01:00
Nikita Popov
7ab88416ac Enforce Name|string for names in builders
While array (with name components) could technically be allowed (as
they are supported by the Name node itself), more likely than not
an array would due to incorrect usage of the API (e.g. array instead
of variadics).
2014-12-19 18:50:16 +01:00
Nikita Popov
ba625063e7 Support fully-qualified and ns-relative names in builders 2014-12-19 18:48:21 +01:00
Nikita Popov
b4b93ccb21 Add integration test for builders 2014-12-19 18:35:19 +01:00
Stepan Anchugov
01643e06d3 Add namespace builder 2014-12-19 18:19:33 +01:00
Nikita Popov
4387454fe0 Add trait builder (for completeness...) 2014-12-19 17:59:23 +01:00
Nikita Popov
55fdbc6dbc Extract common builder methods to abstract classes
Declaration for fns/classes in general and FunctionLike for
functions/methods in particular.
2014-12-19 17:47:51 +01:00
Nikita Popov
e69c9ee38c Fix attribute assigment test with crlf newlines 2014-12-19 17:28:22 +01:00
Nikita Popov
894c3f787d Add test for attribute assignment by parser
Weird that this wasn't tested yet...
2014-12-19 00:37:38 +01:00