composer update

This commit is contained in:
Oliver Davies 2019-01-24 08:00:03 +00:00
parent f6abc3dce2
commit 71dfaca858
1753 changed files with 45274 additions and 14619 deletions

View file

@ -95,6 +95,13 @@ namespace Baz {
C;
E;
K;
class ClassWithTypeProperties
{
public float $php = 7.4;
public ?Foo $person;
protected static ?bool $probability;
}
}
EOC;
$expectedCode = <<<'EOC'
@ -163,6 +170,12 @@ namespace Baz {
\Y\T\B\C;
\Y\T\D\E;
\Z\T\K;
class ClassWithTypeProperties
{
public float $php = 7.4;
public ?\Baz\Foo $person;
protected static ?bool $probability;
}
}
EOC;

View file

@ -167,6 +167,10 @@ EOC;
["namespace Foo;", ['kind' => Stmt\Namespace_::KIND_SEMICOLON]],
["namespace Foo {}", ['kind' => Stmt\Namespace_::KIND_BRACED]],
["namespace {}", ['kind' => Stmt\Namespace_::KIND_BRACED]],
["(float) 5.0", ['kind' => Expr\Cast\Double::KIND_FLOAT]],
["(double) 5.0", ['kind' => Expr\Cast\Double::KIND_DOUBLE]],
["(real) 5.0", ['kind' => Expr\Cast\Double::KIND_REAL]],
[" ( REAL ) 5.0", ['kind' => Expr\Cast\Double::KIND_REAL]],
];
}
}

View file

@ -0,0 +1,39 @@
Adding property type
-----
<?php
class A
{
public $a
= 1;
}
-----
$stmts[0]->stmts[0]->type = new Node\Identifier('string');
-----
<?php
class A
{
public string $a
= 1;
}
-----
<?php
class A
{
public
$b;
}
-----
$stmts[0]->stmts[0]->type = new Node\Identifier('int');
-----
<?php
class A
{
public
int $b;
}

View file

@ -13,4 +13,16 @@ $new->args[] = new Expr\Variable('y');
<?php
new class
($x, $y)
{ };
{ };
-----
<?php
new class
{};
-----
// Ignore name assigned to anon class
$new = $stmts[0]->expr;
$new->class->name = new Node\Identifier('Anon1');
-----
<?php
new class
{};

View file

@ -0,0 +1,22 @@
Removing property type
-----
<?php
class B
{
public
?float
$b;
}
-----
$stmts[0]->stmts[0]->type = null;
-----
<?php
class B
{
public
$b;
}

View file

@ -18,6 +18,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_PROTECTED (2)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(

View file

@ -756,6 +756,7 @@ array(
)
3: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -975,6 +976,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -1373,4 +1375,37 @@ array(
)
)
)
)
)
-----
<?php
function foo() :
{
return $a;
}
-----
!!php7
Syntax error, unexpected '{' from 3:1 to 3:1
array(
0: Stmt_Function(
byRef: false
name: Identifier(
name: foo
)
params: array(
)
returnType: null
stmts: array(
0: Stmt_Return(
expr: Expr_Variable(
name: a
)
)
)
)
)
-----
<?php
$a = ["a "thing"];
-----
!!php7
Syntax error, unexpected T_STRING, expecting ',' or ')' or ']' from 2:11 to 2:15

View file

@ -112,6 +112,7 @@ array(
)
4: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -123,6 +124,7 @@ array(
)
5: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(

View file

@ -89,6 +89,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(

View file

@ -24,6 +24,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: 0
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -35,6 +36,7 @@ array(
)
1: Stmt_Property(
flags: MODIFIER_STATIC (8)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(

View file

@ -15,6 +15,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -43,6 +44,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -99,6 +101,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_STATIC (8)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -207,6 +210,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_ABSTRACT (16)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -235,6 +239,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: MODIFIER_FINAL (32)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(

View file

@ -20,6 +20,7 @@ array(
stmts: array(
0: Stmt_Property(
flags: 0
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(

View file

@ -0,0 +1,70 @@
Class declaration
-----
<?php
class A {
public string $a;
protected static D $b;
private ?float $c;
}
-----
!!php7
array(
0: Stmt_Class(
flags: 0
name: Identifier(
name: A
)
extends: null
implements: array(
)
stmts: array(
0: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: Identifier(
name: string
)
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
name: a
)
default: null
)
)
)
1: Stmt_Property(
flags: MODIFIER_PROTECTED | MODIFIER_STATIC (10)
type: Name(
parts: array(
0: D
)
)
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
name: b
)
default: null
)
)
)
2: Stmt_Property(
flags: MODIFIER_PRIVATE (4)
type: NullableType(
type: Identifier(
name: float
)
)
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
name: c
)
default: null
)
)
)
)
)
)

View file

@ -63,6 +63,7 @@ array(
)
1: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -84,6 +85,7 @@ array(
)
2: Stmt_Property(
flags: MODIFIER_PROTECTED (2)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(
@ -95,6 +97,7 @@ array(
)
3: Stmt_Property(
flags: MODIFIER_PRIVATE (4)
type: null
props: array(
0: Stmt_PropertyProperty(
name: VarLikeIdentifier(

View file

@ -19,6 +19,9 @@ $a--;
(float) $a;
(double) $a;
(real) $a;
( float) $a;
(double ) $a;
( REAL ) $a;
(string) $a;
(binary) $a;
(array) $a;
@ -87,9 +90,12 @@ $a--;
+$a;
(int) $a;
(int) $a;
(float) $a;
(double) $a;
(real) $a;
(float) $a;
(double) $a;
(double) $a;
(real) $a;
(string) $a;
(string) $a;
(array) $a;

View file

@ -0,0 +1,20 @@
Class properties
-----
<?php
class A
{
public $a;
public string $b;
protected static ?float $c = 5.0;
private static ?self $d;
}
-----
!!php7
class A
{
public $a;
public string $b;
protected static ?float $c = 5.0;
private static ?self $d;
}