Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Closes #269: Support static access to other expressions
- Loading branch information
Manuel Pichler
committed
Jan 6, 2017
1 parent
e28dc95
commit e611915
Showing
9 changed files
with
241 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...sources/files/Source/Language/PHP/PHPParserGenericVersion70/testUniformVariableSyntax.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
class UniformVariableSyntax | ||
{ | ||
static $bar, $baz; | ||
|
||
public function foo($foo, $bar, $baz) | ||
{ | ||
echo $foo::$bar::$baz, PHP_EOL; | ||
} | ||
} | ||
|
||
$foo = new UniformVariableSyntax(); | ||
$foo::$bar = $foo; | ||
$foo::$baz = 'foo::bar::baz'; | ||
$foo->foo($foo, 'bar', 'baz'); | ||
|
||
class UniformVariableSyntaxStatic | ||
{ | ||
public $bar; | ||
|
||
public function __construct() { | ||
$this->bar = new X(); | ||
$this->bar::$array = [1, 2]; | ||
} | ||
|
||
public function validVariableName() { | ||
if ($this->bar::$array[1]) { | ||
var_dump($this->bar::$array); | ||
} | ||
} | ||
} | ||
|
||
class X { | ||
public static $array; | ||
} | ||
|
||
$o = new UniformVariableSyntaxStatic(); | ||
$o->validVariableName(); | ||
|
||
class UniformVariableSyntaxCallReturn | ||
{ | ||
public function create() { | ||
return function () { | ||
echo __METHOD__, PHP_EOL; | ||
}; | ||
} | ||
} | ||
|
||
$o = new UniformVariableSyntaxCallReturn(); | ||
$o->create()(); | ||
|
||
class UniformVariableSyntaxOperatorOnExpression | ||
{ | ||
public function call() { | ||
(function () { | ||
echo __METHOD__, PHP_EOL; | ||
})(); | ||
} | ||
} | ||
|
||
$o = new UniformVariableSyntaxOperatorOnExpression(); | ||
$o->call(); | ||
|
||
class UniformVariableSyntaxOperatorOnExpression | ||
{ | ||
public function call() { | ||
($this)::go("Sindelfingen"); | ||
} | ||
|
||
public static function go($query) { | ||
echo $query, PHP_EOL; | ||
} | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
...files/Source/Language/PHP/PHPParserVersion56/testUniformVariableSyntaxThrowsException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
class UniformVariableSyntax | ||
{ | ||
static $bar, $baz; | ||
|
||
public function foo($foo, $bar, $baz) | ||
{ | ||
echo $foo::$bar::$baz, PHP_EOL; | ||
} | ||
} | ||
|
||
$foo = new UniformVariableSyntax(); | ||
$foo::$bar = $foo; | ||
$foo::$baz = 'foo::bar::baz'; | ||
$foo->foo($foo, 'bar', 'baz'); |
74 changes: 74 additions & 0 deletions
74
...test/resources/files/Source/Language/PHP/PHPParserVersion70/testUniformVariableSyntax.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
class UniformVariableSyntax | ||
{ | ||
static $bar, $baz; | ||
|
||
public function foo($foo, $bar, $baz) | ||
{ | ||
echo $foo::$bar::$baz, PHP_EOL; | ||
} | ||
} | ||
|
||
$foo = new UniformVariableSyntax(); | ||
$foo::$bar = $foo; | ||
$foo::$baz = 'foo::bar::baz'; | ||
$foo->foo($foo, 'bar', 'baz'); | ||
|
||
class UniformVariableSyntaxStatic | ||
{ | ||
public $bar; | ||
|
||
public function __construct() { | ||
$this->bar = new X(); | ||
$this->bar::$array = [1, 2]; | ||
} | ||
|
||
public function validVariableName() { | ||
if ($this->bar::$array[1]) { | ||
var_dump($this->bar::$array); | ||
} | ||
} | ||
} | ||
|
||
class X { | ||
public static $array; | ||
} | ||
|
||
$o = new UniformVariableSyntaxStatic(); | ||
$o->validVariableName(); | ||
|
||
class UniformVariableSyntaxCallReturn | ||
{ | ||
public function create() { | ||
return function () { | ||
echo __METHOD__, PHP_EOL; | ||
}; | ||
} | ||
} | ||
|
||
$o = new UniformVariableSyntaxCallReturn(); | ||
$o->create()(); | ||
|
||
class UniformVariableSyntaxOperatorOnExpression | ||
{ | ||
public function call() { | ||
(function () { | ||
echo __METHOD__, PHP_EOL; | ||
})(); | ||
} | ||
} | ||
|
||
$o = new UniformVariableSyntaxOperatorOnExpression(); | ||
$o->call(); | ||
|
||
class UniformVariableSyntaxOperatorOnExpression | ||
{ | ||
public function call() { | ||
($this)::go("Sindelfingen"); | ||
} | ||
|
||
public static function go($query) { | ||
echo $query, PHP_EOL; | ||
} | ||
} | ||
|