ALPHA 3.0.2a

This commit is contained in:
TheGamecraft
2018-09-10 08:51:18 -04:00
parent 7fe13ae0a7
commit 0e0ef86b71
1404 changed files with 10604 additions and 33714 deletions

View File

@@ -1,8 +1,22 @@
Version 4.0.3-dev
Version 4.0.4-dev
-----------------
Nothing yet.
Version 4.0.3 (2018-07-15)
--------------------------
### Fixed
* Fixed possible undefined offset notice in formatting-preserving printer. (#513)
### Added
* Improved error recovery inside arrays.
* Preserve trailing comment inside classes. **Note:** This change is possibly BC breaking if your
code validates that classes can only contain certain statement types. After this change, classes
can also contain Nop statements, while this was not previously possible. (#509)
Version 4.0.2 (2018-06-03)
--------------------------

0
vendor/nikic/php-parser/bin/php-parse vendored Normal file → Executable file
View File

View File

@@ -454,11 +454,17 @@ static_var:
| plain_variable '=' static_scalar { $$ = Stmt\StaticVar[$1, $3]; }
;
class_statement_list:
class_statement_list class_statement { push($1, $2); }
class_statement_list_ex:
class_statement_list_ex class_statement { if ($2 !== null) { push($1, $2); } }
| /* empty */ { init(); }
;
class_statement_list:
class_statement_list_ex
{ makeNop($nop, $this->lookaheadStartAttributes, $this->endAttributes);
if ($nop !== null) { $1[] = $nop; } $$ = $1; }
;
class_statement:
variable_modifiers property_declaration_list ';'
{ $$ = Stmt\Property[$1, $2]; $this->checkProperty($$, #1); }

View File

@@ -522,11 +522,17 @@ static_var:
| plain_variable '=' expr { $$ = Stmt\StaticVar[$1, $3]; }
;
class_statement_list:
class_statement_list class_statement { if ($2 !== null) { push($1, $2); } }
class_statement_list_ex:
class_statement_list_ex class_statement { if ($2 !== null) { push($1, $2); } }
| /* empty */ { init(); }
;
class_statement_list:
class_statement_list_ex
{ makeNop($nop, $this->lookaheadStartAttributes, $this->endAttributes);
if ($nop !== null) { $1[] = $nop; } $$ = $1; }
;
class_statement:
variable_modifiers property_declaration_list ';'
{ $$ = Stmt\Property[$1, $2]; $this->checkProperty($$, #1); }
@@ -952,8 +958,13 @@ array_pair_list:
{ $$ = $1; $end = count($$)-1; if ($$[$end] === null) array_pop($$); }
;
comma_or_error:
','
| error
;
inner_array_pair_list:
inner_array_pair_list ',' array_pair { push($1, $3); }
inner_array_pair_list comma_or_error array_pair { push($1, $3); }
| array_pair { init($1); }
;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -951,12 +951,15 @@ abstract class PrettyPrinterAbstract
* @param string $append
*/
protected function safeAppend(string &$str, string $append) {
// $append must not be empty in this function
if ($str === "") {
$str = $append;
return;
}
if ($append === "") {
return;
}
if (!$this->labelCharMap[$append[0]]
|| !$this->labelCharMap[$str[\strlen($str) - 1]]) {
$str .= $append;

View File

@@ -1,14 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
colors="true"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="./test/bootstrap.php">
<testsuites>

View File

@@ -1266,4 +1266,111 @@ array(
)
)
)
)
-----
<?php
$array = [
$this->value $oopsAnotherValue->get()
];
$array = [
$value $oopsAnotherValue
];
$array = [
'key' => $value $oopsAnotherValue
];
-----
!!php7
Syntax error, unexpected T_VARIABLE, expecting ',' or ')' or ']' from 3:18 to 3:34
Syntax error, unexpected T_VARIABLE, expecting ',' or ')' or ']' from 6:12 to 6:28
Syntax error, unexpected T_VARIABLE, expecting ',' or ')' or ']' from 9:21 to 9:37
array(
0: Stmt_Expression(
expr: Expr_Assign(
var: Expr_Variable(
name: array
)
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Expr_PropertyFetch(
var: Expr_Variable(
name: this
)
name: Identifier(
name: value
)
)
byRef: false
)
1: Expr_ArrayItem(
key: null
value: Expr_MethodCall(
var: Expr_Variable(
name: oopsAnotherValue
)
name: Identifier(
name: get
)
args: array(
)
)
byRef: false
)
)
)
)
)
1: Stmt_Expression(
expr: Expr_Assign(
var: Expr_Variable(
name: array
)
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Expr_Variable(
name: value
)
byRef: false
)
1: Expr_ArrayItem(
key: null
value: Expr_Variable(
name: oopsAnotherValue
)
byRef: false
)
)
)
)
)
2: Stmt_Expression(
expr: Expr_Assign(
var: Expr_Variable(
name: array
)
expr: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: Scalar_String(
value: key
)
value: Expr_Variable(
name: value
)
byRef: false
)
1: Expr_ArrayItem(
key: null
value: Expr_Variable(
name: oopsAnotherValue
)
byRef: false
)
)
)
)
)
)

View File

@@ -222,6 +222,11 @@ array(
)
)
)
8: Stmt_Nop(
comments: array(
0: // __halt_compiler does not work
)
)
)
)
1: Stmt_Expression(

0
vendor/nikic/php-parser/test_old/run-php-src.sh vendored Normal file → Executable file
View File