Miguel Piedrafita
67df02c844
Update license year
2018-01-25 22:23:06 +01:00
Nikita Popov
b85b6b3519
Merge branch '3.x'
...
Conflicts:
lib/PhpParser/PrettyPrinter/Standard.php
2018-01-25 22:18:32 +01:00
Nikita Popov
94c715d97e
Fix pretty printing of -(-$x) and +(+$x)
...
Fixes #459 .
2018-01-25 22:17:35 +01:00
Nikita Popov
4dacbb8d39
FPPP: Fix indentation on list insertion
...
Use indentation of last list element, instead of indentation
before the insertion point.
Fixes #466 .
2018-01-25 22:08:40 +01:00
Gabriel Caruso
aa685e711a
Bump to PHP 7.2 in documentation
2018-01-14 22:10:37 +01:00
Gabriel Caruso
edafeb85c4
[CS] Order uses A -> Z
2018-01-13 16:08:27 +01:00
Gabriel Caruso
68d07c4662
[CS] New line in the end of file
2018-01-13 16:08:26 +01:00
Gabriel Caruso
8fae99aafe
[CS] Remove spaces
2018-01-13 16:08:25 +01:00
Nikita Popov
c7ada124d0
[CS] Use ::class notation instead of string
...
Conflicts:
test/PhpParser/ParserFactoryTest.php
test/PhpParser/ParserTest.php
2018-01-13 16:08:17 +01:00
Gabriel Caruso
f6617e6d25
[CS] Space after ternary operator
2018-01-13 16:04:00 +01:00
Gabriel Caruso
2499534729
[CS] Whitespace before return type
2018-01-13 16:03:59 +01:00
Gabriel Caruso
e0a2043089
[CS] Space before casting
2018-01-13 16:03:57 +01:00
Gabriel Caruso
e6e52abae7
[CS] Trim whitespaces
2018-01-13 16:03:56 +01:00
Gabriel Caruso
7f72c84122
[CS] Open class brackets in new line
2018-01-13 16:03:55 +01:00
Gabriel Caruso
fc8ac71e76
[CS] Trim whitespaces inside arrays
2018-01-13 16:03:54 +01:00
Gabriel Caruso
a8968caa5b
[CS] Remove extra lines
2018-01-13 16:03:53 +01:00
Nikita Popov
5285df8f22
[CS] Use elseif instead of else if
...
Conflicts:
lib/PhpParser/TokenStream.php
2018-01-13 16:03:36 +01:00
Gabriel Caruso
4366aa2fb0
[CS] Use __DIR__ instead of dirname(__FILE__)
2018-01-13 16:02:14 +01:00
Gabriel Caruso
bf7d811cda
Add methods visibility ( #464 )
...
* [PSR-2] Visibility before static
* [PSR-2] Declare method Visibility
2018-01-10 19:07:41 +01:00
Gabriel Caruso
248b29ecf6
Add public visibility to getType method ( #463 )
2018-01-10 18:57:48 +01:00
Gabriel Caruso
bcb45d31eb
Trailing whitespaces ( #461 )
...
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-08 11:10:03 +01:00
Gabriel Caruso
3bc31488ce
Combine issets ( #460 )
2018-01-04 13:36:01 +01:00
Nikita Popov
92b39e3d1f
Fix nNextFreeElement for arrays with trailing comma
...
Ugh.
2017-12-26 21:17:36 +01:00
Nikita Popov
1c7fd314d1
FPPP: Add heuristic for multi-line lists
2017-12-26 21:14:36 +01:00
Nikita Popov
fb8175567e
Simplify delayed add code
...
$insertStr always stays the same, so no reason to store it
separately.
2017-12-26 17:53:36 +01:00
Nikita Popov
63abf9cb3f
Release PHP-Parser 4.0 Alpha 3
2017-12-26 17:29:20 +01:00
Tomáš Votruba
ceb4932ca8
Clean merge leftover in changelog ( #456 )
2017-12-26 17:25:14 +01:00
Nikita Popov
aa289c9694
Merge branch '3.x'
...
Conflicts:
CHANGELOG.md
2017-12-26 15:44:25 +01:00
Nikita Popov
579f4ce846
Release PHP-Parser 3.1.3
2017-12-26 15:43:21 +01:00
Nikita Popov
8d3cb5f57b
FPPP: Fallback if we must insert a block
2017-12-26 15:41:38 +01:00
Nikita Popov
de82a40d04
FPPP: Add broken InlineHTML test cases
2017-12-26 15:08:30 +01:00
Nikita Popov
a86151f24f
FPPP: Fix fallback for inline HTML
2017-12-26 15:08:29 +01:00
Gabriel Caruso
e6e8791848
Missing # in method description
2017-12-25 14:28:33 +01:00
Gabriel Caruso
83b958763f
Refactoring tests
2017-12-15 21:42:34 +01:00
Gabriel Caruso
4dbb02c57b
Use Null Coalesce Operator
2017-12-15 21:41:41 +01:00
Nikita Popov
4fcdac40d1
FPPP: Fix insertion of multiple elems at start
2017-12-02 15:10:15 +01:00
Nikita Popov
04feb90d79
Rename abc1.test to basic.test
...
And split off fixup.test.
2017-12-01 23:15:50 +01:00
Nikita Popov
dc3ace55c3
FPPP: Support insert at start of list node ( #446 )
2017-12-01 22:09:51 +01:00
Nikita Popov
e5453f0d46
Extract pSingleQuotedString as an extension point
...
And add some more string formatting tests.
2017-12-01 18:31:21 +01:00
Nikita Popov
b507fa43da
Ensure names are not empty
2017-12-01 18:13:55 +01:00
Nikita Popov
336a49b428
FPPP: Fix comment indentation ( #443 )
2017-11-13 13:27:27 +01:00
Nikita Popov
fa174b093f
Merge branch '3.x'
2017-11-13 01:15:38 +01:00
Nikita Popov
94ca9a7ab9
Use Tokens::class in lexer
...
Ref #441 .
2017-11-13 01:14:55 +01:00
Nikita Popov
0bb74e03aa
Drop two more getType() usages in builders
2017-11-13 00:24:01 +01:00
Nikita Popov
8d3f48ab75
Switch some auxiliary pretty printer tables away from getType()
...
Instead use class names via ::class.
2017-11-13 00:18:44 +01:00
Nikita Popov
1c11626f0a
Add explicit getType() methods
...
Rather than automatically deriving getType() from the class name.
2017-11-12 21:27:14 +01:00
Nikita Popov
05e2cd287e
Merge branch '3.x'
...
Conflicts:
lib/PhpParser/NodeAbstract.php
2017-11-12 21:12:27 +01:00
Maks Rafalko
bac91b426e
Correctly determine Type of Node when PHP-Parser's namespaces are prefixed
...
Hi there,
I'm working on mutation testing framework ([Infection](https://github.com/infection/infection/ )) that is distributed as a PHAR. One of this goal is to run target project's test suite against mutated code. Since we use reflection and load project's autoloader, we want to avoid potential conflicts between vendor files of Infection itself and the target project.
To avoid this issue, there is a project calld [PHP-Scoper](https://github.com/humbug/php-scoper ). What it does is it prefixes all the namespaces of the library (including vendor folder) with some character(s), for example namespace `Infection\Mutator\PublicVisibility` is transformed to `ScoperAbc123\Infection\Mutant\PublicVisibility`.
But since it also prefixes vendor folder, PHP-Parser's classes are prefixed as well and `NodeAbstract::getType()` after this prefixing works incorrectly.
There is a hardcoded number `15` which means to remove `'PhpParser\Node'` (length=15) substring from the FQCN.
Code:
```php
// PHPParser\Node\Stmt\Declare_ -> Stmt_Declare
return strtr(substr(rtrim(get_class($this), '_'), 15), '\\', '_');
```
What I suggest is a little be more dynamic solution, to correctly extract class name (type) from the ***prefixed*** FQCL:
`ScoperAbc123\PHPParser\Node\Stmt\Declare_` -> `Stmt_Declare`
2017-11-12 21:11:41 +01:00
Nikita Popov
a75164c77e
Rename YYNLSTATES to numNonLeafStates
2017-11-12 16:09:00 +01:00
Nikita Popov
c59e75f873
Clear parser state directly after parsing
...
I don't think this makes any difference in practical scenarios, but
it makes memory usage analysis simpler.
2017-11-11 16:54:52 +01:00