Skip to content

Commit

Permalink
Merge branch 'php-8.0/squiz-objectinstantiation-support-match' of htt…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Feb 23, 2021
2 parents f2cd66d + 3148f1b commit 436a610
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public function process(File $phpcsFile, $stackPtr)
$allowedTokens = [
T_EQUAL => true,
T_DOUBLE_ARROW => true,
T_FN_ARROW => true,
T_MATCH_ARROW => true,
T_THROW => true,
T_RETURN => true,
T_INLINE_THEN => true,
Expand Down
11 changes: 11 additions & 0 deletions src/Standards/Squiz/Tests/Objects/ObjectInstantiationUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,16 @@ function foo() { return new MyClass(); }

$doodad = $x ? new Foo : new Bar;

function returnFn() {
$fn = fn($x) => new MyClass();
}

function returnMatch() {
$match = match($x) {
0 => new MyClass()
}
}

// Intentional parse error. This must be the last test in the file.
function new
?>

0 comments on commit 436a610

Please sign in to comment.