Skip to content

Commit

Permalink
Merge pull request #626 from PHPCSStandards/feature/test-findstartofs…
Browse files Browse the repository at this point in the history
…tatement-fix-dataproviders

Tests/File::findStartOfStatement(): fix dataproviders
  • Loading branch information
jrfnl authored Oct 7, 2024
2 parents 81cea42 + 3272573 commit 2e3c58b
Showing 1 changed file with 27 additions and 27 deletions.
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

0 comments on commit 2e3c58b

Please sign in to comment.