Commit Graph

359 Commits

Author SHA1 Message Date
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
Nikita Popov
f291a19fd5 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php7.php
2017-02-26 23:13:21 +01:00
Nikita Popov
c12a4c8239 Fix start attribute assignment for Error in ClassConstFetch 2017-02-26 23:00:38 +01:00
Nikita Popov
86ea6fe8c4 Remove leftover code 2017-02-26 22:53:08 +01:00
Nikita Popov
dce34f37db Merge branch '3.x' 2017-02-26 22:51:27 +01:00
Nikita Popov
1b59e918f7 Perform NullableType resolution earlier
This makes sure function signatures are already fully resolved in
enterNode(). Resolves issue #360.
2017-02-26 22:50:31 +01:00
Matthew Brown
9857a545e2 Remove unused variables (#357) 2017-02-11 11:05:36 +01:00
Matthew Brown
329e90c239 Improve doc comments 2017-02-09 20:49:52 +01:00
Nikita Popov
9f5ec5a69a Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php5.php
	lib/PhpParser/Parser/Php7.php
	test/code/parser/stmt/class/name.test
2017-02-09 20:38:33 +01:00
Nikita Popov
df98b0417b Handle "extends static" etc more gracefully
Use class_name production and emit the same error as for
"extends self" and "extends parent". It's weird that "extends
static" gives a different result than those two.
2017-02-09 18:43:09 +01:00
Nikita Popov
a8eb2fc675 Support recovery from invalid trailing commas 2017-02-09 00:35:12 +01:00
Nikita Popov
d18ccfeec7 Use p() in pPrec() for easier extensibility 2017-02-09 00:03:00 +01:00
Nikita Popov
f8a2f6e760 Merge branch '3.x' 2017-02-08 23:55:16 +01:00
Jennifer Hodgdon
4e55897059 Change one function to protected 2017-02-08 23:55:02 +01:00
Nikita Popov
865bfb2acf Merge branch '3.x'
Conflicts:
	grammar/php7.y
	lib/PhpParser/Parser/Php7.php
	test/code/parser/expr/uvs/globalNonSimpleVarError.test
	test/code/parser/stmt/namespace/groupUseErrors.test
2017-02-05 17:50:54 +01:00
Nikita Popov
62877b5d14 Recover from missing semicolons on statements 2017-02-05 17:47:56 +01:00