Commit Graph

25 Commits

Author SHA1 Message Date
Nikita Popov
805078e0a9 Add missing type hints 2015-03-28 18:14:24 +01:00
Nikita Popov
dce19b074b Strict type compliance
Were this library to be fully annotated with scalar types and
return types where possible and were strict types to be enabled
for all files, the test suite would now pass.
2015-03-24 11:19:17 +01:00
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
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
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
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
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
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
a710f32a6a Make Node\Expr\BinOp an abstract class
Only the children should be used ...
2015-01-18 00:10:02 +01:00
nikic
e26e63e9b0 Error on final or abstract properties 2014-11-13 20:25:52 +01:00
nikic
0f69f12b94 Use "public" visibility when not explicitly given
Fixes issue #143
2014-11-13 20:21:21 +01:00
Arne Blankerts
6fad8ff32a Make NameResolver resolve trait alias and precedence names 2014-11-03 16:06:43 +01:00
nikic
3d40e2217d Annotate some APIs as @internal 2014-09-30 20:26:06 +02:00
nikic
6d1f77132c Move Stmt\Namespace_::postprocess() to parser 2014-04-21 12:30:55 +02:00
Nikita Popov
c341ab2ecf Make autoloader for new names PSR-0 compliant 2014-04-02 09:44:45 +02:00
nikic
3b7829b011 Add support for function and constant import (PHP 5.6) 2014-03-26 22:33:45 +01:00
nikic
cda6f575f0 Add support for pow operator (PHP 5.6) 2014-03-26 19:18:16 +01:00
nikic
b5bcfa1168 Add support for argument unpacking (PHP 5.6) 2014-03-26 18:42:46 +01:00
nikic
96f1151ab2 Add support for variadic parameters (PHP 5.6) 2014-03-26 18:23:30 +01:00
nikic
f5be0d30f7 Guarantee that subnodes are always in the right order 2014-03-22 14:49:56 +01:00
nikic
70077039b4 Add Scalar\MagicConst->getName()
Return magic constant name, e.g. __CLASS__.

Resolves #95.
2014-02-21 18:16:18 +01:00
nikic
1c8481bff6 Merge branch '0.9'
Conflicts:
	lib/PhpParser/Lexer.php
	lib/PhpParser/Node/Stmt/Class.php
	lib/PhpParser/Node/Stmt/ClassMethod.php
	lib/PhpParser/Node/Stmt/Interface.php
	lib/PhpParser/Node/Stmt/Namespace.php
	lib/PhpParser/Node/Stmt/UseUse.php
	lib/PhpParser/Parser.php
2014-02-12 20:23:12 +01:00
nikic
f82862ec9c Port library to use namespaces, with BC for old names 2014-02-06 20:29:35 +01:00