-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixes #19875155] Implement static closures
- Loading branch information
1 parent
e4e5d5e
commit 1e24a34
Showing
11 changed files
with
272 additions
and
14 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
7 changes: 7 additions & 0 deletions
7
src/test/resources/files/Code/ASTClosure/testIsStaticReturnsFalseForNonStaticClosure.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,7 @@ | ||
<?php | ||
function testIsStaticReturnsFalseForNonStaticClosure() | ||
{ | ||
return function($x, $y) { | ||
return pow($x, $y); | ||
}; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/test/resources/files/Code/ASTClosure/testIsStaticReturnsTrueForStaticClosure.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,9 @@ | ||
<?php | ||
function testIsStaticReturnsTrueForStaticClosure() | ||
{ | ||
$closure = static function($x, $y) { | ||
return pow($x, $y); | ||
}; | ||
var_dump($closure(2, 2)); | ||
} | ||
testIsStaticReturnsTrueForStaticClosure(); |
7 changes: 7 additions & 0 deletions
7
...ces/files/Code/ASTClosure/testReturnsByReferenceReturnsFalseByDefaultForStaticClosure.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,7 @@ | ||
<?php | ||
function testReturnsByReferenceReturnsFalseByDefaultForStaticClosure() | ||
{ | ||
return static function ($x, $y) { | ||
return pow($x, $y); | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
...est/resources/files/Code/ASTClosure/testReturnsByReferenceReturnsTrueForStaticClosure.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,7 @@ | ||
<?php | ||
function testReturnsByReferenceReturnsTrueForStaticClosure() | ||
{ | ||
return static function &($x, $y) { | ||
return pow($x, $y); | ||
}; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/files/Code/ASTClosure/testStaticClosureHasExpectedEndColumn.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,8 @@ | ||
<?php | ||
function testStaticClosureHasExpectedEndColumn() | ||
{ | ||
return static | ||
function($x, $y) { | ||
return ($x * $y); | ||
}; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/files/Code/ASTClosure/testStaticClosureHasExpectedEndLine.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,8 @@ | ||
<?php | ||
function testStaticClosureHasExpectedEndLine() | ||
{ | ||
return static | ||
function($x, $y) { | ||
return ($x * $y); | ||
}; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/files/Code/ASTClosure/testStaticClosureHasExpectedStartColumn.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,8 @@ | ||
<?php | ||
function testStaticClosureHasExpectedStartColumn() | ||
{ | ||
return static | ||
function($x, $y) { | ||
return ($x * $y); | ||
}; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/files/Code/ASTClosure/testStaticClosureHasExpectedStartLine.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,8 @@ | ||
<?php | ||
function testStaticClosureHasExpectedStartLine() | ||
{ | ||
return static | ||
function($x, $y) { | ||
return ($x * $y); | ||
}; | ||
} |