Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Tests/BackCompat/BCFile/FindStartOfStatementTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ switch ($foo) {
/* testInsideCaseGotoStatement */
goto myLabel;

case 7:
/* testInsideCaseFullyQualifiedDieStatement */
\die(1);

/* testDefaultStatement */
default:
/* testInsideDefaultContinueStatement */
Expand Down
12 changes: 10 additions & 2 deletions Tests/BackCompat/BCFile/FindStartOfStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,8 @@ public function testFindStartInsideSwitchCaseDefaultStatements($testMarker, $tar
*/
public static function dataFindStartInsideSwitchCaseDefaultStatements()
{
$php8Names = parent::usesPhp8NameTokens();

return [
'Case keyword should be start of case statement - case itself' => [
'testMarker' => '/* testCaseStatement */',
Expand Down Expand Up @@ -607,16 +609,22 @@ public static function dataFindStartInsideSwitchCaseDefaultStatements()
'targets' => \T_CLOSE_PARENTHESIS,
'expectedTarget' => \T_THROW,
],
'Goto should be start for contents of the goto statement - goto label' => [
'Goto should be start for contents of the goto statement - goto label' => [
'testMarker' => '/* testInsideCaseGotoStatement */',
'targets' => \T_STRING,
'expectedTarget' => \T_GOTO,
],
'Goto should be start for contents of the goto statement - semicolon' => [
'Goto should be start for contents of the goto statement - semicolon' => [
'testMarker' => '/* testInsideCaseGotoStatement */',
'targets' => \T_SEMICOLON,
'expectedTarget' => \T_GOTO,
],
'Namespace separator for "die" should be start for contents of the die statement - close parenthesis' => [
// Note: not sure if this is actually correct - should this be the open parenthesis ?
'testMarker' => '/* testInsideCaseFullyQualifiedDieStatement */',
'targets' => T_CLOSE_PARENTHESIS,
'expectedTarget' => ($php8Names === true ? T_EXIT : T_NS_SEPARATOR),
],
'Default keyword should be start of default statement - default itself' => [
'testMarker' => '/* testDefaultStatement */',
'targets' => \T_DEFAULT,
Expand Down