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
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
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
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
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
Tomáš Votruba
88f3a669c1
Add union type to ParamBuilder and BuilderHelpers
2020-01-05 00:34:49 +01:00
Nikita Popov
5b1cd2e4f2
Fix phpdoc for Param\Builer::$type
2019-11-02 18:29:08 +01:00
Nikita Popov
1f95f9215c
Tweak type annotation to include null
2019-01-12 17:31:37 +01:00
Tomas Votruba
af8c729603
Add PHP 7.4 typed properties support
2019-01-05 21:34:25 +01:00
Nikita Popov
41408081d7
Rename setTypeHint() to setType()
...
To align with modern terminology -- we don't like calling these
type hints anymore. Old method name remains, marked as @deprecated.
2018-07-22 21:41:21 +02:00
ProgMiner
8d9ae46597
Add Builder\TraitUse::with receiving adaptation builder ability
2018-07-22 21:23:00 +02:00
ProgMiner
f6fc248ca3
Add TraitUseAdaptation and factory for it
2018-07-22 21:23:00 +02:00
ProgMiner
84dcd179d2
Add TraitUse builder and useTrait builder factory
2018-07-22 21:22:57 +02:00
Gabriel Caruso
68d07c4662
[CS] New line in the end of file
2018-01-13 16:08:26 +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
Nikita Popov
0bb74e03aa
Drop two more getType() usages in builders
2017-11-13 00:24:01 +01:00
Nikita Popov
fd6e8d7ea8
Merge branch '3.x'
...
Conflicts:
lib/PhpParser/Builder/Namespace_.php
lib/PhpParser/Node/Stmt/ClassMethod.php
test/PhpParser/Builder/NamespaceTest.php
2017-11-04 12:45:04 +01:00
Nikita Popov
0ba710affa
Add setDocComment() to namespace build ( #437 )
2017-11-04 12:43:02 +01:00
Nikita Popov
31065389f1
Remove workarounds for reserved keyword method names
...
No longer necessary in PHP 7.
2017-09-02 20:08:20 +02:00
Nikita Popov
efd39a67a2
Merge branch '3.x'
...
Conflicts:
lib/PhpParser/Builder/Trait_.php
test/PhpParser/Builder/TraitTest.php
2017-08-29 23:20:47 +02:00
Nikita Popov
d77e6cd6e9
Allow TraitUse statements in trait builder
...
Fixes #413 .
2017-08-29 23:18:59 +02:00
TomasVotruba
e2e99f269b
Add strict_types to lib code
2017-08-18 23:00:13 +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
TomasVotruba
58bf92e4f7
[cs] remove unused imports
2017-08-13 21:14:28 +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
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
Nikita Popov
e4f493cd1d
Replace func_get_args() with variadics
...
We're on PHP 5.6 now, so can do this...
2017-04-24 21:19:08 +02:00
Nikita Popov
7419649eae
Change BuilderAbstract into BuilderHelpers static class
...
Used as poor man's function namespace here.
2017-04-24 21:15:11 +02:00
Nikita Popov
6b6c903585
Kill the BuilderAbstract::$flags property
...
Instead pass and return the flags explicitly.
2017-04-24 21:06:54 +02:00
Nikita Popov
55be521ff8
Merge branch '3.x'
...
Conflicts:
lib/PhpParser/Builder/Param.php
2017-04-19 11:17:52 +02:00
SignpostMarv
c877c1a64f
Add Builder\Param::makeVariadic()
2017-04-19 11:16:29 +02:00
Nikita Popov
6238f5f9f9
Adjust code for constitent var mode
2017-01-19 23:32:49 +01:00
Nikita Popov
7623d20f69
Automatically wrap in Stmt\Expression in builders
2017-01-19 22:39:21 +01:00
Nikita Popov
61574a1818
Drop support for PHP 5.5
2017-01-19 20:55:08 +01:00
Matthew Brown
030de805e1
Add NullableType to types of properties/args that offer it ( #323 )
2016-12-05 13:30:29 +01:00
Nikita Popov
bcdfb703d5
Cleanup imports
...
Thanks PhpStorm :)
2016-11-23 22:58:18 +01:00
Nikita Popov
1ab24d26ee
Add support for PHP 7.1 types to builders
...
This adds support for void, iterable and nullable types.
2016-09-16 13:53:13 +02:00
Nikita Popov
18129480ae
Rename $type subnode to $flags
...
Type makes it sound like a type-hint, and on a number of other nodes
$type is used for exactly that. Use $flags to hold modifiers instead.
2016-07-25 13:33:19 +02:00
Nikita Popov
867ae5148d
Bring Trait constructor in line with Class/interface
2016-07-22 17:01:51 +02:00
Graham Campbell
e7f0860d85
Tweaked a phpdoc description
2016-04-10 21:10:55 +09:00
lvht
39f93f09f9
Add setReturnType() method to function/method builders
...
Also support scalar type hints in existing setTypeHint() method on params.
2016-04-09 18:41:38 +09:00
Nikita Popov
65af37f7b0
Doc comment tweaks
2016-02-20 17:06:09 +01:00
Nikita Popov
5ede167835
Fix infinite recursion in Use builder __call
2015-07-12 22:11:43 +02:00
Nikita Popov
b862de1f5b
Support properties in trait builder
2015-07-11 22:31:45 +02:00
Nikita Popov
0c34706799
Add "use" builder
2015-03-10 16:05:55 +01:00
Nikita Popov
f9fc2fc9ee
Add support for global namespace in NS builder
...
NULL argument can now be used to create a global namespace {} block.
2015-03-10 15:28:19 +01:00
Thomas Ruiz
73cace360d
Implicit public should not generate as explicit public
2015-03-08 20:21:01 +01:00