Commit Graph

1142 Commits

Author SHA1 Message Date
Nikita Popov
0ed9065b4c Flexible doc: Validate and strip indentation
If indentation is invalid, we strip on a best-effort basis.

The error position information is not great, but I don't want to
introduce sub-token error positioning at this point in time.
2018-09-21 21:47:01 +02:00
Nikita Popov
5f73c4de80 Flexible doc: Validate end label indentation
Move doc string parsing logic from rebuildParsers.php and
String_::parseDocString() into ParserAbstract. This stuff is
going to get complicated now.

For now only implement the validation of the indentation on the
end label.
2018-09-21 16:31:17 +02:00
Nikita Popov
146411bb86 Ignore one more test...
This one is passing on Windows because the extra \r makes the
opening tag actually valid. Fails on Linux though.
2018-09-21 12:41:10 +02:00
Nikita Popov
e12891a9db Ignore failures in complex flexible doc string tests
These test nesting of flexible heredoc strings. This is too hard for
us to emulate and we do not expect to see these patterns used in the
wild.
2018-09-21 12:35:11 +02:00
Nikita Popov
a5c726bfbf Make sure heredoc end label not followed by label char 2018-09-21 11:44:39 +02:00
Nikita Popov
fd93690705 Test against more recent php-src tarball 2018-09-21 11:40:36 +02:00
Nikita Popov
83766c8c0e Partial support for flexible heredoc/nowdoc
This only implements the token emulation part, it does not yet
handle the indentation stripping.

Emulating this feature on old PHP versions is really tough and is
not going to work perfectly, but hopefully this implementation is
"good enough".
2018-09-21 11:16:00 +02:00
Nikita Popov
fa6ee28600 Release PHP-Parser 4.0.4 2018-09-18 09:03:24 +02:00
Nikita Popov
16c5d107ca Revert "Add check for leading backslash in Name ctor"
This reverts commit 2f67429ec9.

Reverting this to avoid a BC break in a patch release, will
reapply for the next major version.
2018-09-18 09:00:32 +02:00
Tomáš Votruba
d7d581c1d2 Remove NodeTraverser dependency on parent::__construct() (#528)
A parent::__construct() call is now optional when extending NodeTraverser.
2018-08-28 07:49:42 +09:00
Brent Shaffer
1973b6633a Fixes typo in AST Builder doc (#529) 2018-08-17 07:18:50 +09:00
Nikita Popov
7f96481c80 Mark PHP-Parser 3.0 as unsupported
The last release was in Febuary and there haven't been any commits
since. Make it official.
2018-07-22 21:42:51 +02:00
Nikita Popov
41408081d7 Rename setTypeHint() to setType()
To align with modern terminology -- we don't like calling these
type hints anymore. Old method name remains, marked as @deprecated.
2018-07-22 21:41:21 +02:00
Nikita Popov
4d6825c460 Add notes for new builders in docs 2018-07-22 21:33:04 +02:00
ProgMiner
d4a5a6e84b Add tests for Builder\TraitUseAdaptation 2018-07-22 21:23:00 +02:00
ProgMiner
c55798ccc6 Add tests for Builder\TraitUse 2018-07-22 21:23:00 +02:00
ProgMiner
82e8b33814 Add some trait use factory builder integration tests 2018-07-22 21:23:00 +02:00
ProgMiner
8d9ae46597 Add Builder\TraitUse::with receiving adaptation builder ability 2018-07-22 21:23:00 +02:00
ProgMiner
f6fc248ca3 Add TraitUseAdaptation and factory for it 2018-07-22 21:23:00 +02:00
ProgMiner
84dcd179d2 Add TraitUse builder and useTrait builder factory 2018-07-22 21:22:57 +02:00
Nikita Popov
3e02eb7108 Fix updateTests.php 2018-07-22 21:18:34 +02:00
Nikita Popov
2f67429ec9 Add check for leading backslash in Name ctor
Fixes #523.
2018-07-21 21:58:32 +02:00
Nikita Popov
0cd7207ca6 Add tests for var() and propertyFetch() 2018-07-20 21:59:42 +02:00
Eridan Domoratskiy
6751ac3c9d Add Variable and PropertyFetch node constructors 2018-07-20 21:49:21 +02:00
Eridan Domoratskiy
5aeb884ab5 Mention makeReturnByRef() in AST_builders.markdown (#519) 2018-07-20 21:47:07 +02:00
Nikita Popov
b855c1ca23 Add some tests for new use builders 2018-07-20 21:44:37 +02:00
Eridan Domoratskiy
53c732a96d Add useFunction() and useConst() builder methods 2018-07-20 21:38:27 +02:00
Nikita Popov
bd088dc940 Release PHP-Parser 4.0.3 2018-07-15 19:25:16 +02:00
Nikita Popov
8b1c9c0409 Store comment at end of class in Nop statement
Fixed #509.
2018-07-07 12:49:49 +02:00
openex27
df64d86cf4 Check for empty $append in safeAppend()
Can happen with Nop statements.
2018-07-07 12:34:07 +02:00
Nikita Popov
aac539ef0a Adjust test output
Whoops, forgot to commit this part.
2018-07-07 12:25:01 +02:00
Nikita Popov
f967b867d5 Improve error recovery in arrays
Similarly to missing semicolons, the error is not indicated in the
AST.

Fixes #512.
2018-07-07 12:24:06 +02:00
Gabriel Caruso
6bbdaf6c16 Remove flags from phpunit.xml that have default value and colorize (#510) 2018-07-01 23:29:44 +02:00
Nikita Popov
35b8caf75e Release PHP-Parser 4.0.2 2018-06-03 13:33:10 +02:00
Nikita Popov
6526ea2497 Throw when printin EncapsedStringPart
This needs to go through something like Encapsed or ShellExec to
determine quotation type. Explicitly throw an exception to avoid
getting an undefined method error.
2018-06-03 13:31:00 +02:00
David Paz
3ce5e628a7 Fix binary operator doc block comment (#504)
Remove reference to bitwise and in doc block.
2018-05-19 12:21:45 +02:00
Gabriel Caruso
ee870e3464 Fixes from PHPStan (#502) 2018-05-19 11:12:24 +02:00
Gabriel Caruso
21d27527ed Use dedicated assertNull assertion (#503) 2018-05-19 11:12:07 +02:00
Nikita Popov
7b201b63d2 Error recovery for functions without body 2018-05-13 16:28:08 +02:00
Nikita Popov
01e85a26c6 Support recovery for param without variable
We store an Expr\Error for the variable in this case.
2018-05-12 19:49:39 +02:00
Gabriel Caruso
e6452e8d15 Fix typo in UPGRADE-4.0 (#498) 2018-05-05 23:45:25 +02:00
Gabriel Caruso
9202d87f53 Fix typos in UPGRADE-4.0 (#497) 2018-05-01 22:19:29 +02:00
Nikita Popov
fa99c3fbfb Recover from foreach without as 2018-04-28 22:31:45 +02:00
Loek van der Linde
2b0bd657bb Update 2_Usage_of_basic_components.markdown (#494) 2018-04-17 18:29:16 +03:00
Hans Ott
81b7be3ba6 Fix links in README.md (#493) 2018-04-07 18:26:59 +03:00
Nikita Popov
6121001576 Remove unused ParserAbstract::$errors property
Leftover from before ErrorHandler was introduced.
2018-03-30 21:45:52 +02:00
Nikita Popov
7208b1c7ac Improve error recovery in classes (#492) 2018-03-30 16:03:03 +02:00
Nikita Popov
e4a54fa90a Release PHP-Parser 4.0.1 2018-03-25 19:35:16 +02:00
Nikita Popov
3125b54e5e Link to composer/xdebug-handler 2018-03-25 19:34:45 +02:00
Nikita Popov
7f8ff1b9a4 Add support for list reference assignments
RFC: https://wiki.php.net/rfc/list_reference_assignment
2018-03-10 16:48:20 +01:00