Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/File::findStartOfStatement(): fix dataproviders #626

Merged
merged 1 commit into from
Oct 7, 2024
Merged
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
54 changes: 27 additions & 27 deletions tests/Core/File/FindStartOfStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,45 +710,45 @@ public static function dataFindStartInsideClosedScopeNestedWithinMatch()
// These were already working correctly.
'Closure function keyword should be start of closure - closure keyword' => [
'testMarker' => '/* test437ClosureDeclaration */',
'targets' => T_CLOSURE,
'target' => T_CLOSURE,
'expectedTarget' => T_CLOSURE,
],
'Open curly is a statement/expression opener - open curly' => [
'testMarker' => '/* test437ClosureDeclaration */',
'targets' => T_OPEN_CURLY_BRACKET,
'target' => T_OPEN_CURLY_BRACKET,
'expectedTarget' => T_OPEN_CURLY_BRACKET,
],

'Echo should be start for expression - echo keyword' => [
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
'targets' => T_ECHO,
'target' => T_ECHO,
'expectedTarget' => T_ECHO,
],
'Echo should be start for expression - variable' => [
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_ECHO,
],
'Echo should be start for expression - comma' => [
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
'targets' => T_COMMA,
'target' => T_COMMA,
'expectedTarget' => T_ECHO,
],

// These were not working correctly and would previously return the close curly of the match expression.
'First token after comma in echo expression should be start for expression - text string' => [
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
'targets' => T_CONSTANT_ENCAPSED_STRING,
'target' => T_CONSTANT_ENCAPSED_STRING,
'expectedTarget' => T_CONSTANT_ENCAPSED_STRING,
],
'First token after comma in echo expression - PHP_EOL constant' => [
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
'targets' => T_STRING,
'target' => T_STRING,
'expectedTarget' => T_STRING,
],
'First token after comma in echo expression - semicolon' => [
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
'targets' => T_SEMICOLON,
'target' => T_SEMICOLON,
'expectedTarget' => T_STRING,
],
];
Expand Down Expand Up @@ -791,44 +791,44 @@ public static function dataFindStartInsideParenthesesNestedWithinMatch()
return [
'Array item itself should be start for first array item' => [
'testMarker' => '/* test437NestedLongArrayWithinMatch */',
'targets' => T_LNUMBER,
'target' => T_LNUMBER,
'expectedTarget' => T_LNUMBER,
],
'Array item itself should be start for second array item' => [
'testMarker' => '/* test437NestedLongArrayWithinMatch */',
'targets' => T_DNUMBER,
'target' => T_DNUMBER,
'expectedTarget' => T_DNUMBER,
],
'Array item itself should be start for third array item' => [
'testMarker' => '/* test437NestedLongArrayWithinMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],

'Parameter itself should be start for first param passed to function call' => [
'testMarker' => '/* test437NestedFunctionCallWithinMatch */',
'targets' => T_LNUMBER,
'target' => T_LNUMBER,
'expectedTarget' => T_LNUMBER,
],
'Parameter itself should be start for second param passed to function call' => [
'testMarker' => '/* test437NestedFunctionCallWithinMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],
'Parameter itself should be start for third param passed to function call' => [
'testMarker' => '/* test437NestedFunctionCallWithinMatch */',
'targets' => T_DNUMBER,
'target' => T_DNUMBER,
'expectedTarget' => T_DNUMBER,
],

'Parameter itself should be start for first param declared in arrow function' => [
'testMarker' => '/* test437NestedArrowFunctionWithinMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],
'Parameter itself should be start for second param declared in arrow function' => [
'testMarker' => '/* test437FnSecondParamWithinMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],
];
Expand Down Expand Up @@ -872,44 +872,44 @@ public static function dataFindStartInsideParenthesesNestedWithinNestedMatch()
return [
'Array item itself should be start for first array item' => [
'testMarker' => '/* test437NestedLongArrayWithinNestedMatch */',
'targets' => T_LNUMBER,
'target' => T_LNUMBER,
'expectedTarget' => T_LNUMBER,
],
'Array item itself should be start for second array item' => [
'testMarker' => '/* test437NestedLongArrayWithinNestedMatch */',
'targets' => T_DNUMBER,
'target' => T_DNUMBER,
'expectedTarget' => T_DNUMBER,
],
'Array item itself should be start for third array item' => [
'testMarker' => '/* test437NestedLongArrayWithinNestedMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],

'Parameter itself should be start for first param passed to function call' => [
'testMarker' => '/* test437NestedFunctionCallWithinNestedMatch */',
'targets' => T_LNUMBER,
'target' => T_LNUMBER,
'expectedTarget' => T_LNUMBER,
],
'Parameter itself should be start for second param passed to function call' => [
'testMarker' => '/* test437NestedFunctionCallWithinNestedMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],
'Parameter itself should be start for third param passed to function call' => [
'testMarker' => '/* test437NestedFunctionCallWithinNestedMatch */',
'targets' => T_DNUMBER,
'target' => T_DNUMBER,
'expectedTarget' => T_DNUMBER,
],

'Parameter itself should be start for first param declared in arrow function' => [
'testMarker' => '/* test437NestedArrowFunctionWithinNestedMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],
'Parameter itself should be start for second param declared in arrow function' => [
'testMarker' => '/* test437FnSecondParamWithinNestedMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],
];
Expand Down Expand Up @@ -952,17 +952,17 @@ public static function dataFindStartInsideShortArrayNestedWithinMatch()
return [
'Array item itself should be start for first array item' => [
'testMarker' => '/* test437NestedShortArrayWithinMatch */',
'targets' => T_LNUMBER,
'target' => T_LNUMBER,
'expectedTarget' => T_LNUMBER,
],
'Array item itself should be start for second array item' => [
'testMarker' => '/* test437NestedShortArrayWithinMatch */',
'targets' => T_DNUMBER,
'target' => T_DNUMBER,
'expectedTarget' => T_DNUMBER,
],
'Array item itself should be start for third array item' => [
'testMarker' => '/* test437NestedShortArrayWithinMatch */',
'targets' => T_VARIABLE,
'target' => T_VARIABLE,
'expectedTarget' => T_VARIABLE,
],
];
Expand Down