Commit Graph

27 Commits

Author SHA1 Message Date
Nikita Popov
3ec87ef757 Don't require doc comment to be last comment
Fixes #652.
2020-02-15 10:52:34 +01:00
Nikita Popov
602af9060d Add end line / file position / token position to comments 2020-02-09 16:53:46 +01:00
Lars Moelleken
b7e6361536 updates via "rectorphp/rector" (#573)
- "global" -> remove unused "use" statements
- "phpunit" -> fix "@covers" comments
- "phpunit" -> replace "->will($this->returnValue()" with "->willReturn()"
- "UseTest.php" -> add missing namespace
- "composer.json" -> use "autoload-dev"
- remove -> "require_once" usage in the tests (use autoload-dev via composer.json)

-> most of the changes are done automatically by "https://github.com/rectorphp/rector"
2019-01-19 11:18:00 +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
7f72c84122 [CS] Open class brackets in new line 2018-01-13 16:03:55 +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
83b958763f Refactoring tests 2017-12-15 21:42:34 +01:00
Nikita Popov
47c973b3aa Store start token position in comments 2017-11-04 17:45:14 +01:00
TomasVotruba
b58157f024 add strict_types to tests + fix explode type 2017-11-03 13:24:19 +01:00
Nikita Popov
cc328a4c9c Add get{Start,End}{Line,TokenPos,FilePos}() methods 2017-09-29 17:34:15 +02:00
Nikita Popov
3d4621bbea Don't return by ref from getAttribute()
This is not worth the few times where it might be useful.
2017-09-29 17:14:27 +02:00
Nikita Popov
d8f9173390 Add Node::getComments() method 2017-09-29 17:09:16 +02:00
TomasVotruba
af12807451 [cs] apply same to tests 2017-08-13 21:14:28 +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
a32e3797d4 Generate PHP 7 type annotations 2017-04-28 21:40:59 +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
Ekin
3c44785e82 Bump phpunit version (#381) 2017-04-27 18:14:07 +02:00
Nikita Popov
d7f3c4f9d3 Renamve Param::$name to Param::$var
As it now contains a Variable node.
2017-01-19 23:39:15 +01:00
Nikita Popov
67274b9594 Enforce useConsistentVariableNames 2017-01-19 23:24:43 +01:00
Nikita Popov
ea47b6e0d6 Add NodeAbstract::setDocComment() 2016-09-17 20:51:22 +02:00
Nikita Popov
f7cb00d6d3 Add missing canonicalization in test 2016-07-25 21:02:53 +02:00
Nikita Popov
7dae6c7a6b Implement JsonSerializable for Nodes and Comments
Exposes the properties and adds an additional nodeType property.
2016-07-25 20:59:09 +02:00
Nikita Popov
29b9015f51 Drop support for old Node format 2015-05-02 22:17:34 +02: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
nikic
66fd29cb58 Use stricter assertions where possible 2014-09-30 20:38:09 +02:00
nikic
f82862ec9c Port library to use namespaces, with BC for old names 2014-02-06 20:29:35 +01:00