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

168 Commits

Author SHA1 Message Date
Tomas Votruba
4c22c62783
[PHP 8.0] Add attributes support (#661)
Adds support for PHP 8 attributes, represented using `AttrGroup` nodes
containing `Attribute` nodes. The `attrGroup` subnode is added to all
nodes that can have attributes.

This is still missing FPPP support.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-09-13 21:01:17 +02:00
Ondřej Mirtes
4a40a84cf6 Fixed PHPDoc typo 2020-09-02 12:33:46 +02:00
Viktor Szépe
56356e4aec Remove repeated word from PHPDoc in Name 2020-08-23 08:59:38 +02:00
Nikita Popov
a98350581c Add support for throw expression 2020-08-09 20:52:55 +02:00
Nikita Popov
98f7f39d1c Add named argument support
Not adding any explicit FPPP support, as I don't think add/remove
of names can be handled any better than full reformatting.
2020-08-09 17:37:44 +02:00
Nikita Popov
23d9c17770 Add support for nullsafe operator 2020-08-09 12:08:05 +02:00
Alex
54fc023b25
Update Array_ annotations, items are nullable (#696)
When used to destructure, items are optional. E.g. `[$a, , $b] = [1, 2, 3];`.
2020-08-08 10:04:21 +02:00
Tomas Votruba
69c5d48afd
[PHP 8.0] Add match expressions (#672)
RFC:  https://wiki.php.net/rfc/match_expression_v2
Upstream implementation: php/php-src#5371

Closes #671.
2020-07-15 21:40:05 +02:00
TomasVotruba
b58b19ed1d Add constructor promotion support 2020-06-27 17:57:47 +02:00
TomasVotruba
b5f5313d73 [PHP 8.0] Add exception witout variable 2020-06-03 09:18:13 +02:00
Ruud Kamphuis
64f4d5b619 Add getProperty to ClassLike 2020-02-09 22:43:42 +01:00
Nikita Popov
664c10121e Add support for union types
We definitely need to introduce a general "Type" abstraction in
the next major version.
2019-11-08 14:45:32 +01:00
Tomas Votruba
006acba066 add getTraitUses() method to ClassLike 2019-08-31 09:26:51 +02:00
Tomas Votruba
005bb1dba7 add getProperties() and getConstants() to ClassLike 2019-08-30 20:47:14 +02:00
Tyson Andre
a1f72690ef Fix harmless typos in documentation 2019-07-23 12:32:37 +02:00
Tyson Andre
2e2954ccdf Avoid notices in php 7.4 with hexdec/base_convert (#619)
This is made to avoid notices caused by
https://wiki.php.net/rfc/base_convert_improvements

(seen with `php -d error_reporting=E_ALL vendor/bin/phpunit`)
2019-07-14 10:56:13 +02:00
Tomáš Votruba
3f718ee2c3 [PHP 7.4] Add support for numeric literal separators (#615)
Implements RFC https://wiki.php.net/rfc/numeric_literal_separator.

Closes #614.
2019-06-30 12:13:28 +02:00
Nikita Popov
993f29906b Avoid parent constructor call during node construction
Instead explicitly assign the attributes. This is a minor
performance improvement.
2019-05-12 14:55:21 +02:00
Tomas Votruba
8012faea54 [PHP 7.4] Add array spread 2019-05-09 19:15:35 +02:00
Tomáš Votruba
f3b19c19ef [PHP 7.4] Add support for arrow functions (#602)
Per RFC https://wiki.php.net/rfc/arrow_functions_v2.
2019-05-09 14:17:28 +02:00
Tomas Votruba
9de96821f7 Add support for ??= operator
Introduced in PHP 5.4, represented using an AssignOp\Coalesce node.
2019-02-09 11:16:26 +01:00
Tomas Votruba
af8c729603 Add PHP 7.4 typed properties support 2019-01-05 21:34:25 +01:00
Tomas Votruba
0ef61b49bb add float/double/real KIND support to Cast\Double node 2019-01-05 19:23:00 +01:00
Tomas Votruba
a74b54ce8b [cs] remove unused @var name 2018-11-20 20:31:31 +01:00
Matthew Brown
674c5610fb StaticCall::$name cannot be a string 2018-10-04 21:29:57 +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
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
Nikita Popov
2f67429ec9 Add check for leading backslash in Name ctor
Fixes #523.
2018-07-21 21:58:32 +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
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
Nikita Popov
b998d1e9b5 Add funcCall(), methodCall() and staticCall() builders 2018-03-03 15:40:51 +01:00
Gabriel Caruso
68d07c4662 [CS] New line in the end of file 2018-01-13 16:08:26 +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
248b29ecf6 Add public visibility to getType method (#463) 2018-01-10 18:57:48 +01:00
Gabriel Caruso
e6e8791848 Missing # in method description 2017-12-25 14:28:33 +01:00
Gabriel Caruso
4dbb02c57b Use Null Coalesce Operator 2017-12-15 21:41:41 +01:00
Nikita Popov
b507fa43da Ensure names are not empty 2017-12-01 18:13:55 +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
Alexander Miertsch
ab596db285 ClassMethod stmts property can be null (#435) 2017-11-01 20:26:21 +01:00
Nikita Popov
57bc42517b Move IdentifierTest where it belongs
Ooops...
2017-10-06 15:07:35 +02:00
Nikita Popov
65de924493 Add Identifier::toString()
For symmetry with the Name API.

Also add some missing unit tests.
2017-10-03 20:57:48 +02:00
Nikita Popov
4b1d9667af Add constant expression evaluator (#402) 2017-09-30 18:56:44 +02:00
Nikita Popov
5cfdc2e0a7 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php5.php
	lib/PhpParser/Parser/Php7.php
	test/PhpParser/ParserTest.php
2017-09-26 18:46:44 +02:00
Nikita Popov
5a9fbca54a Add attribute for namespace kinds (#417)
One of KIND_SEMICOLON or KIND_BRACED.
2017-09-26 18:45:05 +02:00
TomasVotruba
e2e99f269b Add strict_types to lib code 2017-08-18 23:00:13 +02:00
Nikita Popov
7b36ca3b6c Add isSpecialClassName() method to Identifier and Name 2017-08-15 22:59:52 +02:00