Commit Graph

1370 Commits

Author SHA1 Message Date
Nikita Popov
def24f2224 Add support for explicit octal literals 2021-09-03 16:29:30 +02:00
Nikita Popov
cfeb195205 Add test for new in initializer
This already works because we don't validate initializer contents,
everything is accepted from a parser perspective.
2021-09-03 15:10:29 +02:00
Nikita Popov
ace6c67a8a Add support for intersection types 2021-09-03 15:06:33 +02:00
Nikita Popov
0483391aca Introduce ComplexType base class
With the upcoming addition of intersection types, a type can
be Identifier|Name|NullableType|UnionType|IntersectionType, which
is quite the mouthful. Give NullableType and UnionType a common
base class ComplexType, which does not have any behavior, but
allows to write these types (and check them in instanceof) more
easily.
2021-09-02 18:35:05 +02:00
Nikita Popov
9aebf377fc Allow multiple modifiers for property promotion
Fixes issue #800.
2021-08-08 19:12:44 +02:00
simivar
5a43015499 Simplify BuilderHelpers::normalizeName() implementation
In order to get rid of the flag in `BuilderHelpers::normalizeNameCommon()` I have moved all the logic related to the normalization of the name to the `BuilderHelpers::normalizeName()` method and expr-related stuff to the `BuilderHelpers::normalizeNameOrExpr()` method which later calls the basic `normalizeName()` as well
2021-07-21 12:51:18 +02:00
Nikita Popov
6608f01670 Release PHP-Parser 4.12.0 2021-07-21 12:44:31 +02:00
Máté Kocsis
55c4269232
Add support for new PHP 8.1 modifiers (#796)
Implement support for readonly properties (https://wiki.php.net/rfc/readonly_properties_v2) and
final class contstants (https://wiki.php.net/rfc/final_class_const).
2021-07-21 12:43:29 +02:00
Nikita Popov
c4304c76bd Try to pass --ignore-platform-req=php on 8.1 only 2021-07-21 12:11:59 +02:00
Nikita Popov
b099e8fc76 Pass --ignore-platform-req=php 2021-07-21 12:08:11 +02:00
Nikita Popov
acf16edc8e Add PHP 8.1 to GH actions 2021-07-21 11:58:38 +02:00
Nikita Popov
a8b5ed4306 Fix JSON encoding test on PHP 8.1
Duplicate the test expectation for a different order.
2021-07-21 11:49:28 +02:00
Nikita Popov
c758510a37 Add support for PHP 8.1
With the introduction of intersection types, PHP now lexes the
token '&' either as T_AMPERSAND_(NOT_)FOLLOWED_BY_VAR_OR_VARARG.
This completely breaks parsing of any code containing '&'.

Fix this by canonicalizing to the new token format (unconditionally,
independent of emulation) and adjusting the parser to use the two
new tokens.

This doesn't add actual support for intersection types yet.
2021-07-09 16:52:58 +02:00
Nikita Popov
feed91cf0f Avoid ctype_alnum() on integer
This is deprecated in PHP 8.1
2021-07-09 15:46:50 +02:00
Nikita Popov
fe14cf3672 Release PHP-Parser 4.11.0 2021-07-03 15:36:55 +02:00
Bob Weinand
3fb73520c1 Add handling for Enum(Case)s in NameResolver 2021-07-03 15:09:11 +02:00
simivar
c35cc4b2cb Add support for "never" type in the BuilderHelpers::normalizeType() 2021-06-18 17:25:28 +02:00
Rod Elias
e69ebbbfd9 chore: use the word Xdebug instead of XDebug 2021-06-17 18:00:12 +02:00
simivar
0b258d9a9e Add missing tests for methods of BuilderHelpers 2021-06-17 17:55:59 +02:00
simivar
2d193bb0e4 Add attributes to integration Builder test 2021-06-17 09:18:53 +02:00
Krystian Marcisz
49e9951f2c
Add addAttribute() method to Builders with normalizer (#782)
Adds addAttribute() method to Builders of all nodes supporting attributes with BuilderHelpers::normalizeAttribute() usage inside so we can pass both Node\Attribute and Node\AttributeGroup instances.
2021-06-16 17:47:22 +02:00
Krystian Marcisz
eccf1bf464
Add Attribute builder and support for named args (#781)
Add BuilderFactory::attribute() and support named args in BuilderFactory::args().
2021-06-14 23:52:57 +02:00
Tom Klingenberg
b67560d388 Update CHANGELOG.md
very minor for the year.
2021-05-04 22:15:00 +02:00
Nikita Popov
4432ba399e Release PHP-Parser 4.10.5 2021-05-03 21:11:20 +02:00
Nikita Popov
37ac4ea9c2 Document that namespaced names containing whitespace are not supported 2021-04-25 22:47:15 +02:00
Nikita Popov
4848a0d734 Check for \r as newline in closing tag
Fixes #761.
2021-04-25 22:42:18 +02:00
Nikita Popov
8eb194ea1f Add never type
This should be recognized as Identifier instead of Name now.
2021-04-25 22:35:28 +02:00
Nikita Popov
e03d63cffb Fix precedence of arrow functions
Arrow functions should have lowest precedence.

Fixes #769.
2021-04-25 22:19:49 +02:00
Nikita Popov
ce91d139b5 Make sure match is one character long 2021-04-25 21:47:07 +02:00
Nikita Popov
33d7c8d3d8 Escape invalid UTF-8 in strings
To be friendlier to tooling that expects PHP files to be UTF-8
encoded, escape any sequences that are not legal under UTF-8.
2021-04-25 21:37:01 +02:00
Nikita Popov
6b409b96bb Use hex escaping for special characters in strings
Apart from \0, using the \xHH notation is more typical.
2021-04-25 21:22:15 +02:00
Tomas Votruba
f68e1a43ff
[PHP 8.1] Add support for enums (#758)
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-04-25 21:11:36 +02:00
Iskander (Alex) Sharipov
f767b9fd9f ParserAbstract: add missing '*' to the phpdoc
Otherwise, it's somewhat incompatible with the phpdoc definition.
2021-04-25 12:38:52 +02:00
Miguel
2a4bb7ef2c Moved phpy pseudo lang functions to separate file 2021-04-10 13:40:52 +02:00
Maxim L
4abdcde5f1
Fix missing argument in documentation (#767)
Missing argument in the getMessageWithColumnInfo call
2021-03-25 18:37:06 +01:00
WhizSid
d46f261ef9
Adding class constant to builder factory (#765)
* Adding class constant to builder factory

* Fix formatting,doc issues and Tweak returning node from ClassConst

* Fix PHPUnit
2021-03-21 20:58:21 +01:00
Nikita Popov
38aa0920c9 Add test for UTF-8 in string
These should not get escaped.
2021-03-21 17:03:15 +01:00
Nikita Popov
a8223f228a Add emulation for enum keyword 2021-03-20 17:49:44 +01:00
Oskar Stark
8165cf69fa CS fix 2021-02-02 09:57:47 +01:00
Tomas Votruba
46221a0914 Update Use_ builder to return specific type 2021-01-06 14:30:19 +01:00
Tomas Votruba
3b87eb721c make Namespace_ builder return Namespace_
Hi, just a little detail. This should fix invalid return type of docs
2020-12-30 10:13:54 +01:00
Ayesh Karunaratne
e3471d94d3 Update .gitattributes export-ignore rules
- Adds `.github` directory to `.gitattributes` file with an `export-ignore` rule.
 - This also aligns all `export-ignore` rules for more readability.
 - Removes `.travis.yml` file that is no longer used.
2020-12-22 22:58:39 +01:00
Nikita Popov
c6d052fc58 Release PHP-Parser 4.10.4 2020-12-20 11:01:03 +01:00
Nikita Popov
8008d07bef Remove Travis build badge
We no longer use Travis, so this isn't meaningful... And GitHub
already displays the build status, so there's no value in having
this kind of badge at all.
2020-12-20 10:58:16 +01:00
Nikita Popov
7284a4d019 Remove no longer necessary class parsing workaround
This was split to work around the attribute assignment bug fixed
in the previous commit, and as such is no longer necessary.
2020-12-20 10:53:45 +01:00
Nikita Popov
d3d1ee470a Fix #738 incorrect start line for traits
Empty productions are supposed to be assigned the start attributes
of the lookahead token. Currently, this happens by assigning above
the current stack position when the token it read.

This fails in a situation where we first reduce an empty production
higher up in the stack, and then again reduce an empty production
lower in the stack, without consuming the lookahead token in the
meantime.

Fix this by moving the assignment into the reduction phase. We
also need to do this for error productions, which are effectively
empty.
2020-12-20 10:52:47 +01:00
Nikita Popov
893a5bce3f Fix #741 incorrect varvar positions 2020-12-19 22:03:43 +01:00
Nikita Popov
bec74aceda Remove .travis.yml 2020-12-08 23:22:57 +01:00
Nikita Popov
7c09e096c9 Try to re-enable coveralls 2020-12-08 23:17:41 +01:00
Nikita Popov
0f64504317 Drop -n flag from test_old
In the hope of fixing the failure on GH actions.
2020-12-08 23:05:19 +01:00