Nikita Popov
574665b45b
PHP 7.1: list() with keys
...
Expr\List will now contain ArrayItems instead of plain variables.
I'm reusing ArrayItem, because code handling list() must also handle
arrays, and this allows both to go through the same code path.
This also renames Expr\List->vars to ->items.
TODO: Should Expr\List be dropped in favor of Expr\Array with an
extra flag?
2016-07-09 21:55:55 +02:00
Nikita Popov
1edf72c040
PHP 7: Support nullable types
...
Using a new NullableType node.
2016-07-06 18:36:18 +02:00
Nikita Popov
5ea2a76d80
PHP 7.1: Class constant visibility support
2016-07-05 23:01:06 +02:00
Nikita Popov
90eb1165d1
Switch Exit kind attribute to flag
...
To be consistent with everything else.
2016-04-19 14:51:05 +02:00
Nikita Popov
e7869b9f14
Forbid invalid octals in PHP 7 mode
2016-04-18 13:59:18 +02:00
Nikita Popov
588e6a4d4c
Add string kinds and doc string labels
...
Scalar\String_ and Scalar\Encapsed now have an additional "kind"
attribute, which may be one of:
* String_::KIND_SINGLE_QUOTED
* String_::KIND_DOUBLE_QUOTED
* String_::KIND_NOWDOC
* String_::KIND_HEREDOC
Additionally, if the string kind is one of the latter two, an
attribute "docLabel" is provided, which contains the doc string
label (STR in <<<STR) that was originally used.
The pretty printer will try to take the original kind of the string,
as well as the used doc string label into account.
2016-04-07 12:09:00 +09:00
Nikita Popov
9ac3592190
Handle uppercase B"" prefix
2016-04-02 21:15:49 +09:00
Nikita Popov
fc36239be5
Remove internal LNumber::parse() method
...
Combine it into ::fromString(), as they both do the same checks.
2016-03-10 13:01:42 +01:00
Nikita Popov
f493219c7d
Move "kind" attribute handling out of lexer
...
Doesn't belong there and will cause issue with multiple assignments.
2016-03-10 12:55:15 +01:00
Nikita Popov
aa199120c7
Add kind attribute for arrays
...
To distinguish array() and [] syntax. The pretty printer respects
this attribute. The shortArraySyntax pretty printer option acts as
a default in case the attribute is not specified.
2016-03-09 21:31:54 +01:00
Nikita Popov
ae30f97af6
Add "kind" attribute to LNumbers
...
Kind specifies whether the number was formatted as decimal, octal,
binary or hex. The pretty printer reproduces the number kind (but
not necessarily the exact formatting).
2016-03-09 21:10:55 +01:00
Nikita Popov
7eac2cfd8b
Introduce Nop statement to collect dangling comments
...
A Nop statement will be inserted into statement lists if there are
any trailing comments in the list (which would otherwise not be
associated with any node).
The pretty printer output currently still contains a superfluous
newline.
2016-03-09 19:48:36 +01:00
Jesse Schalken
5c2cc50455
Remove some more unecessary @property doc comments
2015-12-29 23:15:00 +11:00
Jesse Schalken
58eb1ea7c3
Remove some unecessary @property doc comments
2015-12-29 23:13:55 +11:00
Nikita Popov
719ca71d4a
Distinguish declare(); and declare(){}
...
It makes semantic difference and the latter form is actually
forbidden for strict_types.
This sets Declare->stmts to null for the body-less case.
2015-12-07 12:12:00 +01:00
Nikita Popov
a9074c7444
Introduce Scalar\EncapsedStringPart
2015-12-03 22:55:07 +01:00
Nikita Popov
eecaf1e93b
Merge branch '1.x'
...
Conflicts:
grammar/rebuildParsers.php
lib/PhpParser/Parser.php
2015-09-19 22:07:29 +08:00
Nikita Popov
950ada4cba
Fix issue #227
...
Use \z instead of $.
2015-09-19 22:05:23 +08:00
Nikita Popov
0ef15c111a
Merge branch '1.x'
2015-07-14 17:08:28 +02:00
Nikita Popov
d341d94976
Add ClassLike::getMethod($name)
...
To allow getting individual method with a given name.
2015-07-14 17:07:45 +02:00
Nikita Popov
0265c28e6e
Switch NameResolver resolve methods to be immutable
...
To make it theoretically possible to expose this as API.
Add slice() method to Name to allow this. Deprecate existing mutable
Name APIs.
2015-07-12 23:56:57 +02:00
Nikita Popov
49324ea412
Drop default values from Scalar ctor params
2015-07-12 22:02:18 +02:00
Nikita Popov
1d62e9d8cc
Fix implicit visibility for properties as well
...
Also switch to using PPP mask.
2015-07-05 20:17:52 +02:00
Lisachenko Alexander
e3195c246f
Fix public modifier check for ClassMethod node
2015-07-05 20:17:50 +02:00
Nikita Popov
90ab32f046
Merge branch '1.x'
2015-07-05 20:16:41 +02:00
Nikita Popov
7434a682e5
Fix implicit visibility for properties as well
...
Also switch to using PPP mask.
2015-07-05 20:16:21 +02:00
Lisachenko Alexander
0fbb5f90a1
Fix public modifier check for ClassMethod node
2015-07-05 20:10:48 +02:00
Nikita Popov
a5db176903
Merge branch '1.x'
2015-07-02 18:09:38 +02:00
Nikita Popov
42e368e964
Fix returnType typehints
...
Fixes issues #207
2015-07-02 18:06:41 +02:00
Nikita Popov
ef9a154d09
Add support for unicode escape sequences
...
Only parsed if the PHP 7 parser is used.
2015-06-13 20:51:02 +02:00
Nikita Popov
1a1bd1448d
Support mixed group use declarations
2015-06-13 11:27:38 +02:00
Nikita Popov
9620f79cdc
Add partial group use support
...
Supported via Stmt\GroupUse which has Name $prefix in addition to
the usual.
Still missing: Mixed group uses.
2015-06-12 23:05:28 +02:00
Nikita Popov
db3dafd64d
Merge branch '1.x'
2015-06-05 18:57:04 +02:00
Suralc
bb2c5303ae
Add a FunctionLike interface to Methods, Functions and Closures.
...
The elements listed above share common elements like parameters, possible return types and bodies.
2015-06-05 18:56:25 +02:00
Nikita Popov
5d1e3be7d4
Anonymize some callbacks
2015-05-02 22:35:15 +02:00
Nikita Popov
29b9015f51
Drop support for old Node format
2015-05-02 22:17:34 +02:00
Nikita Popov
55b2ead967
Make special class name checks case insensitive
2015-04-26 23:13:27 +02:00
Nikita Popov
e1a0ec3724
Add support for anonymous classes
...
Has not landed upstream yet, but syntax is unlikely to change.
2015-04-26 23:04:31 +02:00
Nikita Popov
ab80054e97
Add support for "yield from"
2015-04-26 11:56:02 +02:00
Nikita Popov
62f83a0dc2
Add column info for non-syntax errors where relatively precise
...
Should it also be added if only rough information is available? E.g.
spanning an entire class?
2015-04-18 13:27:58 +02:00
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