Skip to content

Commit 2fbf9e3

Browse files
authored
Merge pull request #316 from PHPCSStandards/feature/tests-tokenizer-split-contextsensitive-test-class
Tests/Tokenizer: split `ContextSensitiveKeywordsTest`
2 parents 01d1269 + 0d2bba1 commit 2fbf9e3

File tree

4 files changed

+412
-278
lines changed

4 files changed

+412
-278
lines changed

tests/Core/Tokenizer/ContextSensitiveKeywordsTest.inc

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class ContextSensitiveKeywords
5353
const /* testMatch */ MATCH = 'MATCH';
5454
const /* testNamespace */ NAMESPACE = 'NAMESPACE';
5555
const /* testNew */ NEW = 'NEW';
56-
const /* testParent */ PARENT = 'PARENT';
5756
const /* testPrint */ PRINT = 'PRINT';
5857
const /* testPrivate */ PRIVATE = 'PRIVATE';
5958
const /* testProtected */ PROTECTED = 'PROTECTED';
@@ -62,7 +61,6 @@ class ContextSensitiveKeywords
6261
const /* testRequire */ REQUIRE = 'REQUIRE';
6362
const /* testRequireOnce */ REQUIRE_ONCE = 'REQUIRE_ONCE';
6463
const /* testReturn */ RETURN = 'RETURN';
65-
const /* testSelf */ SELF = 'SELF';
6664
const /* testStatic */ STATIC = 'STATIC';
6765
const /* testSwitch */ SWITCH = 'SWITCH';
6866
const /* testThrows */ THROW = 'THROW';
@@ -78,10 +76,6 @@ class ContextSensitiveKeywords
7876
const /* testAnd */ AND = 'LOGICAL_AND';
7977
const /* testOr */ OR = 'LOGICAL_OR';
8078
const /* testXor */ XOR = 'LOGICAL_XOR';
81-
82-
const /* testFalse */ FALSE = 'FALSE',
83-
const /* testTrue */ TRUE = 'TRUE',
84-
const /* testNull */ NULL = 'NULL',
8579
}
8680

8781
namespace /* testKeywordAfterNamespaceShouldBeString */ class;
@@ -110,10 +104,6 @@ namespace /* testNamespaceNameIsString1 */ my\ /* testNamespaceNameIsString2 */
110104
/* testFinalIsKeyword */ final /* testFunctionIsKeyword */ function someFunction(
111105
/* testCallableIsKeyword */
112106
callable $callable,
113-
/* testSelfIsKeyword */
114-
self $self,
115-
/* testParentIsKeyword */
116-
parent $parent
117107
) {
118108
/* testReturnIsKeyword */
119109
return $this;
@@ -220,45 +210,18 @@ $anonymousClass = new /* testAnonymousClassIsKeyword */ class {};
220210
$anonymousClass2 = new class /* testExtendsInAnonymousClassIsKeyword */ extends SomeParent {};
221211
$anonymousClass3 = new class /* testImplementsInAnonymousClassIsKeyword */ implements SomeInterface {};
222212

223-
$instantiated1 = new /* testClassInstantiationParentIsKeyword */ parent();
224-
$instantiated2 = new /* testClassInstantiationSelfIsKeyword */ SELF;
225-
$instantiated3 = new /* testClassInstantiationStaticIsKeyword */ static($param);
213+
$instantiated = new /* testClassInstantiationStaticIsKeyword */ static($param);
226214

227215
class Foo extends /* testNamespaceInNameIsKeyword */ namespace\Exception
228216
{}
229217

230218
function /* testKeywordAfterFunctionShouldBeString */ eval() {}
231219
function /* testKeywordAfterFunctionByRefShouldBeString */ &switch() {}
232220

233-
function /* testKeywordSelfAfterFunctionByRefShouldBeString */ &self() {}
234221
function /* testKeywordStaticAfterFunctionByRefShouldBeString */ &static() {}
235-
function /* testKeywordParentAfterFunctionByRefShouldBeString */ &parent() {}
236-
function /* testKeywordFalseAfterFunctionByRefShouldBeString */ &false() {}
237-
function /* testKeywordTrueAfterFunctionByRefShouldBeString */ & true () {}
238-
function /* testKeywordNullAfterFunctionByRefShouldBeString */ &NULL() {}
239222

240-
/* testKeywordAsFunctionCallNameShouldBeStringSelf */ self();
241223
/* testKeywordAsFunctionCallNameShouldBeStringStatic */ static();
242224
$obj-> /* testKeywordAsMethodCallNameShouldBeStringStatic */ static();
243-
/* testKeywordAsFunctionCallNameShouldBeStringParent */ parent();
244-
/* testKeywordAsFunctionCallNameShouldBeStringFalse */ false();
245-
/* testKeywordAsFunctionCallNameShouldBeStringTrue */ True ();
246-
/* testKeywordAsFunctionCallNameShouldBeStringNull */ null /*comment*/ ();
247-
248-
$instantiated4 = new /* testClassInstantiationFalseIsString */ False();
249-
$instantiated5 = new /* testClassInstantiationTrueIsString */ true ();
250-
$instantiated6 = new /* testClassInstantiationNullIsString */ null();
251225

252226
$function = /* testStaticIsKeywordBeforeClosure */ static function(/* testStaticIsKeywordWhenParamType */ static $param) {};
253227
$arrow = /* testStaticIsKeywordBeforeArrow */ static fn(): /* testStaticIsKeywordWhenReturnType */ static => 10;
254-
255-
function standAloneFalseTrueNullTypesAndMore(
256-
/* testFalseIsKeywordAsParamType */ false $paramA,
257-
/* testTrueIsKeywordAsParamType */ true $paramB,
258-
/* testNullIsKeywordAsParamType */ null $paramC,
259-
) /* testFalseIsKeywordAsReturnType */ false | /* testTrueIsKeywordAsReturnType */ true | /* testNullIsKeywordAsReturnType */ null {
260-
if ($a === /* testFalseIsKeywordInComparison */ false
261-
|| $a === /* testTrueIsKeywordInComparison */ true
262-
|| $a === /* testNullIsKeywordInComparison */ null
263-
) {}
264-
}

0 commit comments

Comments
 (0)