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
Nikita Popov
6526ea2497
Throw when printin EncapsedStringPart
...
This needs to go through something like Encapsed or ShellExec to
determine quotation type. Explicitly throw an exception to avoid
getting an undefined method error.
2018-06-03 13:31:00 +02:00
Nikita Popov
1cdb280a30
Merge branch '3.x'
2018-01-25 22:28:08 +01:00
Nikita Popov
d01fafcb40
Handle +(++$x) and -(--$x) as well
2018-01-25 22:27:37 +01:00
Nikita Popov
b85b6b3519
Merge branch '3.x'
...
Conflicts:
lib/PhpParser/PrettyPrinter/Standard.php
2018-01-25 22:18:32 +01:00
Nikita Popov
94c715d97e
Fix pretty printing of -(-$x) and +(+$x)
...
Fixes #459 .
2018-01-25 22:17:35 +01:00
Gabriel Caruso
f6617e6d25
[CS] Space after ternary operator
2018-01-13 16:04:00 +01:00
Nikita Popov
e5453f0d46
Extract pSingleQuotedString as an extension point
...
And add some more string formatting tests.
2017-12-01 18:31:21 +01:00
Nikita Popov
8d3f48ab75
Switch some auxiliary pretty printer tables away from getType()
...
Instead use class names via ::class.
2017-11-13 00:18:44 +01:00
Nikita Popov
68e9b91e9c
Use fully-qualified names for global constant references
2017-11-10 23:33:12 +01:00
Nikita Popov
776275361a
FPPP: Support modifier changes ( #428 )
...
I decided against introducing a node type for this. In the end it
would require special handling anyway.
2017-10-25 22:27:29 +02:00
Nikita Popov
bb2ac91115
Move leading space out of pStmt_Else
...
Same as previous commit. Also add support for pStmt_If->else
insertion.
2017-10-06 14:56:59 +02:00
Nikita Popov
e3888cbe02
Move leading space out of pStmt_ElseIf
...
This is not part of the elseif itself and as such belongs in the
pStmt_If printer.
2017-10-06 14:52:52 +02:00
Nikita Popov
d8f9173390
Add Node::getComments() method
2017-09-29 17:09:16 +02:00
Nikita Popov
ec8692fb9e
Fix InlineHTML indentation
2017-09-03 19:02:07 +02:00
Nikita Popov
61e624bc9d
Replace noIndent mechanism in pretty printer
...
Instead store newline with indentation in $nl property and use it
where needed.
The implementation should be changed to compilet indentLevel and
fpIndentLevel, I don't think these need to be kept separate.
2017-09-03 18:11:25 +02:00
TomasVotruba
e2e99f269b
Add strict_types to lib code
2017-08-18 23:00:13 +02:00
TomasVotruba
9d599040b7
[cs] spaces
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
5a3a1ec25c
Handle LC_NUMERIC with comma decimal separator
...
Closes #399 .
2017-07-19 17:10:55 +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
bc75ac2990
Merge branch '3.x'
2017-04-09 19:51:18 +02:00
Nikita Popov
c3cbf07946
Pretty printer: Preserve comments in arrays and calls
...
If call arguments or array contains comments, print it in multiline
form, so that comments may be preserved.
2017-04-09 19:49:47 +02:00
Nikita Popov
f8a2f6e760
Merge branch '3.x'
2017-02-08 23:55:16 +01:00
Jennifer Hodgdon
4e55897059
Change one function to protected
2017-02-08 23:55:02 +01:00
Nikita Popov
d9911c8da5
Merge branch '3.x'
...
Conflicts:
lib/PhpParser/Node/Expr/ClassConstFetch.php
test/PhpParser/PrettyPrinterTest.php
2017-02-03 21:54:48 +01:00
Nikita Popov
d287c167bc
Pretty print: Handle Error in ClassConstFetch
2017-02-03 21:53:02 +01:00
Nikita Popov
e072c789d1
Merge branch '3.x'
...
Conflicts:
test/PhpParser/PrettyPrinterTest.php
2017-01-29 21:57:37 +01:00
Nikita Popov
fd7ac25108
Throw if pretty-printing Error node
2017-01-29 21:56:21 +01:00
Nikita Popov
cb5dd28985
Don't include whitespace directly in catch/finally print
2017-01-21 21:25:48 +01: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
a79306ccd9
Rename StaticVar::$name to $var
...
As it now holds a Variable
2017-01-19 23:35:31 +01:00
Nikita Popov
6238f5f9f9
Adjust code for constitent var mode
2017-01-19 23:32:49 +01:00
Nikita Popov
4d2a4d02b0
Add first shot at format preserving pretty printer
2016-12-26 18:28:49 +01:00
Nikita Popov
58970e2a37
Improve LNumber/DNumber pretty printing
...
* Support PHP_INT_MIN
* Support negative binary/octal/hex numbers
* Support INF/-INF/NAN in namespaces
2016-12-11 16:31:59 +01:00
Nikita Popov
5219f75719
Fix pretty-printing of nullable types
2016-12-06 12:26:21 +01:00
Nikita Popov
bcdfb703d5
Cleanup imports
...
Thanks PhpStorm :)
2016-11-23 22:58:18 +01:00
Nikita Popov
ec614c95dd
Add hasLeadingNewline attribute to InlineHTML
...
Use this attribute to not print an extra newline if the original
code did not have it.
2016-07-25 16:44:25 +02:00
Nikita Popov
818ef2e692
Make PrettyPrinter\Standard methods protected
...
I'm not sure how these ever ended up being public.
2016-07-25 14:27:03 +02:00
Nikita Popov
5f97b12576
Introduce explicit Finally node
2016-07-25 14:25:04 +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
537b59d4d1
PHP 7.1: Support multi-catch
...
Catch::$type is now an array Catch::$types.
2016-07-22 15:40:00 +02:00
Nikita Popov
574665b45b
PHP 7.1: list() with keys
...
Expr\List will now contain ArrayItems instead of plain variables.
I'm reusing ArrayItem, because code handling list() must also handle
arrays, and this allows both to go through the same code path.
This also renames Expr\List->vars to ->items.
TODO: Should Expr\List be dropped in favor of Expr\Array with an
extra flag?
2016-07-09 21:55:55 +02:00
Nikita Popov
437890d386
PHP 7: Short destructuring syntax
...
Potentially the pretty printer should force use of [] in assignment
context, instead of relying on the existance of the right attribute.
2016-07-06 23:43:23 +02:00
Nikita Popov
1edf72c040
PHP 7: Support nullable types
...
Using a new NullableType node.
2016-07-06 18:36:18 +02:00