Skip to content

Commit

Permalink
Fix isset test in PHP 7.x
Browse files Browse the repository at this point in the history
We were backporting newer syntax thanks to PHP Parser, but now we're not.
  • Loading branch information
bobthecow committed Nov 14, 2023
1 parent 72b65ee commit 230789d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/CodeCleaner/IssetPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,25 @@ public function validFancyStatements()
['isset("str"->a)'],
['isset((["a" => "b"] + [])->a)'],
['isset((["a" => "b"] + [])->a->b)'],
];
}

/**
* @dataProvider validPHP8Statements
*/
public function testValidPHP8Statements($code)
{
$this->parseAndTraverse($code);
$this->assertTrue(true);
}

public function validPHP8Statements()
{
if (\version_compare(\PHP_VERSION, '8.0', '<')) {
$this->markTestSkipped();
}

return [
// Nullsafe operator
['isset($foo?->bar)'],
['isset($foo?->bar->baz)'],
Expand Down

0 comments on commit 230789d

Please sign in to comment.