Commit Graph

158 Commits

Author SHA1 Message Date
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
Nikita Popov
d97cc3d96e Add toLowerString() method to Name and Identifier
Avoids patterns like strtolower((string) $name) when using
strict types.
2017-08-15 22:49:16 +02:00
TomasVotruba
9d599040b7 [cs] spaces 2017-08-13 21:14:28 +02:00
TomasVotruba
05e6725b7a [cs] use strict comparison where allowed 2017-08-13 21:14:28 +02:00
TomasVotruba
ec535ea14e [cs] use PHP 5.4 short array, since PHP 7.0 is min version 2017-08-13 21:14:28 +02:00
Nikita Popov
d11ef05aaf Merge branch '3.x' 2017-07-19 17:14:23 +02:00
Nikita Popov
6fa073879e Remove deprecation of Name::$parts
It doesn't look like this is going away for now, and we currently
don't have the APIs to cover all existing usages elegantly.
2017-07-19 17:13:10 +02:00
Nikita Popov
4e162bd0ea Fix type annotation for List::$items 2017-05-07 19:56:14 +02:00
Nikita Popov
73dc35cbbd Allow null in ClassMethod::getStmts() 2017-05-07 19:56:14 +02:00
Nikita Popov
a32e3797d4 Generate PHP 7 type annotations 2017-04-28 21:40:59 +02:00
Nikita Popov
3da189769c Distinguish between implicit/explicit alias
The UseUse::$alias node can now be null if an alias is not
explicitly given. As such "use Foo\Bar" and "use Foo\Bar as Bar"
are now represented differently.

The UseUse->getAlias() method replicates the previous semantics,
by returning "Bar" in both cases.
2017-04-28 21:05:01 +02:00