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

621 Commits

Author SHA1 Message Date
TomasVotruba
05e6725b7a [cs] use strict comparison where allowed 2017-08-13 21:14:28 +02:00
TomasVotruba
ec535ea14e [cs] use PHP 5.4 short array, since PHP 7.0 is min version 2017-08-13 21:14:28 +02:00
TomasVotruba
58bf92e4f7 [cs] remove unused imports 2017-08-13 21:14:28 +02:00
Nikita Popov
d11ef05aaf Merge branch '3.x' 2017-07-19 17:14:23 +02:00
Nikita Popov
6fa073879e Remove deprecation of Name::$parts
It doesn't look like this is going away for now, and we currently
don't have the APIs to cover all existing usages elegantly.
2017-07-19 17:13:10 +02:00
Nikita Popov
5a3a1ec25c Handle LC_NUMERIC with comma decimal separator
Closes #399.
2017-07-19 17:10:55 +02:00
Pavel Levin
8bdcb47815 Simplify ternary operator for PHP7 (#395) 2017-06-30 18:19:13 +02:00
Nikita Popov
46e7fea72d Merge branch '3.x'
Conflicts:
	test/PhpParser/Builder/ParamTest.php
2017-06-28 23:13:33 +02:00
Nikita Popov
4a7d011317 Add support for object type 2017-06-28 23:12:13 +02:00
Nikita Popov
4fea054ee0 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php7.php
2017-06-28 23:06:38 +02:00
Nikita Popov
7f862ac21c Add support for trailing comma in group use 2017-06-28 23:05:28 +02:00
Nikita Popov
19dde1363e Treat special names correctly in getShortName()
Also change the API to accept a string rather than a FullyQualified
name instance, as this is not appropriate for symbols like "self".
2017-06-13 19:51:22 +02:00
Nikita Popov
7646b31907 Merge branch '3.x' 2017-06-03 15:18:44 +02:00
Romain Neutron
c28b8556f5 Fix Lexer errorHandling when there is no tokens
I encounter an issue when no tokens exist. An error `Undefined offset -1` is triggered.
2017-06-03 15:17:45 +02:00
Nikita Popov
b2c6497d63 Remove undefined variable hack
No longer necessary, as we don't support PHP 5 anymore.
2017-05-07 19:57:24 +02:00
Nikita Popov
4e162bd0ea Fix type annotation for List::$items 2017-05-07 19:56:14 +02:00
Nikita Popov
73dc35cbbd Allow null in ClassMethod::getStmts() 2017-05-07 19:56:14 +02:00
Wes
b1af3d1f7d Add Node::setAttributes() (#385) 2017-05-05 18:18:44 +02:00
Nikita Popov
92275bdfa8 Remove Node::setLine() method 2017-04-29 13:01:02 +02:00
Nikita Popov
56d57d472a Merge branch '3.x' 2017-04-29 12:58:50 +02:00
Nikita Popov
3da86df48f Deprecate Node::setLine() 2017-04-29 12:58:35 +02:00
Nikita Popov
a32e3797d4 Generate PHP 7 type annotations 2017-04-28 21:40:59 +02:00
Nikita Popov
3da189769c Distinguish between implicit/explicit alias
The UseUse::$alias node can now be null if an alias is not
explicitly given. As such "use Foo\Bar" and "use Foo\Bar as Bar"
are now represented differently.

The UseUse->getAlias() method replicates the previous semantics,
by returning "Bar" in both cases.
2017-04-28 21:05:01 +02:00
Nikita Popov
a6846e3b71 Always use Identifier nodes
The parser will now always generate Identifier nodes (for
non-namespaced identifiers). This obsoletes the useIdentifierNodes
parser option.

Node constructors still accepts strings and will implicitly create
an Identifier wrapper. Identifier implement __toString(), so that
outside of strict-mode many things continue to work without changes.
2017-04-28 20:57:32 +02:00
Nikita Popov
3b4abbfc97 Add BuilderFactors->args(Add BuilderFactors->args()) 2017-04-28 18:13:06 +02:00
Nikita Popov
7f6477ed83 Combine class/non-class name resolution into single method 2017-04-28 17:18:13 +02:00
Nikita Popov
56b810e91d Add getShortName() API
PHP's name resolution rules are f'ing complicated.
2017-04-28 17:10:30 +02:00
Nikita Popov
6168abd9a0 Extract name resolution logic into NameContext
All the generic name resolution logic is now available as a separate
class with a public API.
2017-04-27 21:06:07 +02:00
Nikita Popov
888b9dcf30 Drop misspellt class constant 2017-04-27 18:28:10 +02:00
Nikita Popov
8635365a30 Fix some typing issues 2017-04-26 21:50:40 +02:00
Nikita Popov
fba61390d8 Use null-coalesce operator 2017-04-24 22:32:40 +02:00
Nikita Popov
60f1504978 Drop emulative lexer implementation
Nothing to emulate anymore... Revert this commit when something
turns up.
2017-04-24 22:15:50 +02:00
Nikita Popov
5f7070e94f Added BuilderFactory->concat() method 2017-04-24 21:42:59 +02:00
Nikita Popov
8f40eec122 Add BuilderFactory->val() method 2017-04-24 21:28:03 +02:00
Nikita Popov
e4f493cd1d Replace func_get_args() with variadics
We're on PHP 5.6 now, so can do this...
2017-04-24 21:19:08 +02:00
Nikita Popov
7419649eae Change BuilderAbstract into BuilderHelpers static class
Used as poor man's function namespace here.
2017-04-24 21:15:11 +02:00
Nikita Popov
6b6c903585 Kill the BuilderAbstract::$flags property
Instead pass and return the flags explicitly.
2017-04-24 21:06:54 +02:00
Andreev Sergey
9dc93aafaa Add ClassMethod::isMagic() method 2017-04-23 13:54:17 +02:00
Nikita Popov
ba85da88a0 Merge branch '3.x' 2017-04-19 11:20:32 +02:00
Nikita Popov
901b895c02 Fix spelling of VISIBILITY_MODIFIER_MASK 2017-04-19 11:20:05 +02:00
Nikita Popov
55be521ff8 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Builder/Param.php
2017-04-19 11:17:52 +02:00
SignpostMarv
c877c1a64f Add Builder\Param::makeVariadic() 2017-04-19 11:16:29 +02:00
Nikita Popov
bc75ac2990 Merge branch '3.x' 2017-04-09 19:51:18 +02:00
Nikita Popov
c3cbf07946 Pretty printer: Preserve comments in arrays and calls
If call arguments or array contains comments, print it in multiline
form, so that comments may be preserved.
2017-04-09 19:49:47 +02:00
Nikita Popov
1ec5591574 Tweak node insertion formatting 2017-04-08 23:11:46 +02:00
Tyson Andre
b5935a4aff Fix a typo in NodeDumper for REQUIRE_ONCE (#367) 2017-03-17 11:35:48 +01:00
Nikita Popov
2beb4e7fd6 Merge branch '3.x'
Conflicts:
	lib/PhpParser/ParserAbstract.php
	test/code/parser/errorHandling/recovery.test
2017-02-26 23:47:27 +01:00
Nikita Popov
d5873b177b Adjust the end attributes on the stack as well 2017-02-26 23:45:14 +01:00
Nikita Popov
da97f78e25 Merge branch '3.x'
Conflicts:
	lib/PhpParser/ParserAbstract.php
	test/code/parser/errorHandling/recovery.test
2017-02-26 23:40:32 +01:00
Nikita Popov
48ec654d0c Make Expr\Error nodes empty
Resolves issue #359.
2017-02-26 23:38:32 +01:00