Skip to content

Commit df7d7a1

Browse files
committed
Merge branch '2.14' into 2.15
2 parents 578611a + 8667f92 commit df7d7a1

File tree

10 files changed

+41
-43
lines changed

10 files changed

+41
-43
lines changed

tests/AutoReview/FixerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public function testFixerDefinitions(FixerInterface $fixer)
6262

6363
static::assertRegExp('/^[A-Z`].*\.$/', $definition->getSummary(), sprintf('[%s] Description must start with capital letter or a ` and end with dot.', $fixerName));
6464
static::assertNotContains('phpdocs', $definition->getSummary(), sprintf('[%s] `PHPDoc` must not be in the plural in description.', $fixerName), true);
65-
$this->assertCorrectCasing($definition->getSummary(), 'PHPDoc', sprintf('[%s] `PHPDoc` must be in correct casing in description.', $fixerName));
66-
$this->assertCorrectCasing($definition->getSummary(), 'PHPUnit', sprintf('[%s] `PHPUnit` must be in correct casing in description.', $fixerName));
65+
static::assertCorrectCasing($definition->getSummary(), 'PHPDoc', sprintf('[%s] `PHPDoc` must be in correct casing in description.', $fixerName));
66+
static::assertCorrectCasing($definition->getSummary(), 'PHPUnit', sprintf('[%s] `PHPUnit` must be in correct casing in description.', $fixerName));
6767

6868
$samples = $definition->getCodeSamples();
6969
static::assertNotEmpty($samples, sprintf('[%s] Code samples are required.', $fixerName));
@@ -75,7 +75,7 @@ public function testFixerDefinitions(FixerInterface $fixer)
7575
static::assertInternalType('int', $sampleCounter);
7676

7777
$code = $sample->getCode();
78-
$this->assertStringIsNotEmpty($code, sprintf('[%s] Sample #%d', $fixerName, $sampleCounter));
78+
static::assertStringIsNotEmpty($code, sprintf('[%s] Sample #%d', $fixerName, $sampleCounter));
7979
if (!($fixer instanceof SingleBlankLineAtEofFixer)) {
8080
static::assertSame("\n", substr($code, -1), sprintf('[%s] Sample #%d must end with linebreak', $fixerName, $sampleCounter));
8181
}
@@ -148,10 +148,10 @@ public function testFixerDefinitions(FixerInterface $fixer)
148148
}
149149

150150
if ($fixer->isRisky()) {
151-
$this->assertStringIsNotEmpty($definition->getRiskyDescription(), sprintf('[%s] Risky reasoning is required.', $fixerName));
151+
static::assertStringIsNotEmpty($definition->getRiskyDescription(), sprintf('[%s] Risky reasoning is required.', $fixerName));
152152
static::assertNotContains('phpdocs', $definition->getRiskyDescription(), sprintf('[%s] `PHPDoc` must not be in the plural in risky reasoning.', $fixerName), true);
153-
$this->assertCorrectCasing($definition->getRiskyDescription(), 'PHPDoc', sprintf('[%s] `PHPDoc` must be in correct casing in risky reasoning.', $fixerName));
154-
$this->assertCorrectCasing($definition->getRiskyDescription(), 'PHPUnit', sprintf('[%s] `PHPUnit` must be in correct casing in risky reasoning.', $fixerName));
153+
static::assertCorrectCasing($definition->getRiskyDescription(), 'PHPDoc', sprintf('[%s] `PHPDoc` must be in correct casing in risky reasoning.', $fixerName));
154+
static::assertCorrectCasing($definition->getRiskyDescription(), 'PHPUnit', sprintf('[%s] `PHPUnit` must be in correct casing in risky reasoning.', $fixerName));
155155
} else {
156156
static::assertNull($definition->getRiskyDescription(), sprintf('[%s] Fixer is not risky so no description of it expected.', $fixerName));
157157
}

tests/Console/Command/SelfUpdateCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function testExecute(
135135
$commandTester = $this->execute($command, $input, $decorated);
136136

137137
static::assertSame($expectedFileContents, file_get_contents($this->getToolPath()));
138-
$this->assertDisplay($expectedDisplay, $commandTester);
138+
static::assertDisplay($expectedDisplay, $commandTester);
139139
static::assertSame(0, $commandTester->getStatusCode());
140140
}
141141

@@ -274,7 +274,7 @@ public function testExecuteWhenNotAbleToGetLatestVersions(
274274

275275
$commandTester = $this->execute($command, $input, $decorated);
276276

277-
$this->assertDisplay(
277+
static::assertDisplay(
278278
"\033[37;41mUnable to determine newest version: Foo.\033[39;49m\n",
279279
$commandTester
280280
);
@@ -321,7 +321,7 @@ public function testExecuteWhenNotInstalledAsPhar(array $input, $decorated)
321321

322322
$commandTester = $this->execute($command, $input, $decorated);
323323

324-
$this->assertDisplay(
324+
static::assertDisplay(
325325
"\033[37;41mSelf-update is available only for PHAR version.\033[39;49m\n",
326326
$commandTester
327327
);

tests/Console/ConfigurationResolverTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ public function testResolveRulesWithConfig()
903903
$config
904904
);
905905

906-
$this->assertSameRules(
906+
static::assertSameRules(
907907
[
908908
'braces' => true,
909909
],
@@ -915,7 +915,7 @@ public function testResolveRulesWithOption()
915915
{
916916
$resolver = $this->createConfigurationResolver(['rules' => 'braces,-strict_comparison']);
917917

918-
$this->assertSameRules(
918+
static::assertSameRules(
919919
[
920920
'braces' => true,
921921
],
@@ -950,7 +950,7 @@ public function testResolveRulesWithConfigAndOption()
950950
$config
951951
);
952952

953-
$this->assertSameRules(
953+
static::assertSameRules(
954954
[
955955
'blank_line_before_statement' => true,
956956
],
@@ -1143,7 +1143,7 @@ public function provideDeprecatedFixerConfiguredCases()
11431143
];
11441144
}
11451145

1146-
private function assertSameRules(array $expected, array $actual, $message = '')
1146+
private static function assertSameRules(array $expected, array $actual, $message = '')
11471147
{
11481148
ksort($expected);
11491149
ksort($actual);

tests/Report/JsonReporterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ protected function createNoErrorReport()
144144

145145
protected function assertFormat($expected, $input)
146146
{
147-
$this->assertJsonSchema($input);
147+
static::assertJsonSchema($input);
148148
static::assertJsonStringEqualsJsonString($expected, $input);
149149
}
150150

151151
/**
152152
* @param string $json
153153
*/
154-
private function assertJsonSchema($json)
154+
private static function assertJsonSchema($json)
155155
{
156156
$jsonPath = __DIR__.'/../../doc/schema.json';
157157

tests/RuleSetTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function testResolveRulesWithSet()
151151
'strict_comparison' => true,
152152
]);
153153

154-
$this->assertSameRules(
154+
static::assertSameRules(
155155
[
156156
'braces' => true,
157157
'full_opening_tag' => true,
@@ -169,7 +169,7 @@ public function testResolveRulesWithNestedSet()
169169
'strict_comparison' => true,
170170
]);
171171

172-
$this->assertSameRules(
172+
static::assertSameRules(
173173
[
174174
'blank_line_after_namespace' => true,
175175
'braces' => true,
@@ -210,7 +210,7 @@ public function testResolveRulesWithDisabledSet()
210210
'encoding' => true,
211211
]);
212212

213-
$this->assertSameRules(
213+
static::assertSameRules(
214214
[
215215
'blank_line_after_namespace' => true,
216216
'braces' => true,
@@ -374,7 +374,7 @@ public function testResolveRules(array $expected, array $rules)
374374
{
375375
$ruleSet = $this->createRuleSetToTestWith($rules);
376376

377-
$this->assertSameRules($expected, $ruleSet->getRules());
377+
static::assertSameRules($expected, $ruleSet->getRules());
378378
}
379379

380380
public function provideResolveRulesCases()
@@ -516,7 +516,7 @@ public function testGetMissingRuleConfiguration()
516516
$ruleSet->getRuleConfiguration('_not_exists');
517517
}
518518

519-
private function assertSameRules(array $expected, array $actual, $message = '')
519+
private static function assertSameRules(array $expected, array $actual, $message = '')
520520
{
521521
ksort($expected);
522522
ksort($actual);

tests/Smoke/InstallViaComposerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testInstallationViaPathIsPossible()
8787
json_encode($initialComposerFileState, Utils::calculateBitmask(['JSON_PRETTY_PRINT']))
8888
);
8989

90-
self::assertCommandsWork($this->stepsToVerifyInstallation, $tmpPath);
90+
static::assertCommandsWork($this->stepsToVerifyInstallation, $tmpPath);
9191

9292
$fs->remove($tmpPath);
9393
}
@@ -149,9 +149,9 @@ public function testInstallationViaArtifactIsPossible()
149149
'git rm -r . && rm -rf .git',
150150
];
151151

152-
self::assertCommandsWork($stepsToInitializeArtifact, $cwd);
153-
self::assertCommandsWork($stepsToPrepareArtifact, $tmpArtifactPath);
154-
self::assertCommandsWork($this->stepsToVerifyInstallation, $tmpPath);
152+
static::assertCommandsWork($stepsToInitializeArtifact, $cwd);
153+
static::assertCommandsWork($stepsToPrepareArtifact, $tmpArtifactPath);
154+
static::assertCommandsWork($this->stepsToVerifyInstallation, $tmpPath);
155155

156156
$fs->remove($tmpPath);
157157
$fs->remove($tmpArtifactPath);

tests/Test/AbstractFixerTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected function doTest($expected, $input = null, \SplFileInfo $file = null)
147147

148148
Tokens::clearCache();
149149
$expectedTokens = Tokens::fromCode($expected);
150-
$this->assertTokens($expectedTokens, $tokens);
150+
static::assertTokens($expectedTokens, $tokens);
151151
}
152152

153153
static::assertNull($this->lintSource($expected));

tests/Test/AbstractIntegrationTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ protected function doTest(IntegrationCase $case)
294294
$runner->fix();
295295
$fixedInputCodeWithReversedFixers = file_get_contents($tmpFile);
296296

297-
$this->assertRevertedOrderFixing($case, $fixedInputCode, $fixedInputCodeWithReversedFixers);
297+
static::assertRevertedOrderFixing($case, $fixedInputCode, $fixedInputCodeWithReversedFixers);
298298
}
299299

300300
// run the test again with the `expected` part, this should always stay the same

tests/Test/Assert/AssertTokensTrait.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,18 @@
2222
*/
2323
trait AssertTokensTrait
2424
{
25-
private function assertTokens(Tokens $expectedTokens, Tokens $inputTokens)
25+
private static function assertTokens(Tokens $expectedTokens, Tokens $inputTokens)
2626
{
27-
$option = ['JSON_PRETTY_PRINT'];
28-
2927
foreach ($expectedTokens as $index => $expectedToken) {
3028
$inputToken = $inputTokens[$index];
3129

32-
$this->assertTrue(
30+
static::assertTrue(
3331
$expectedToken->equals($inputToken),
34-
sprintf("The token at index %d must be:\n%s,\ngot:\n%s.", $index, $expectedToken->toJson($option), $inputToken->toJson($option))
32+
sprintf("The token at index %d must be:\n%s,\ngot:\n%s.", $index, $expectedToken->toJson(), $inputToken->toJson())
3533
);
3634

3735
$expectedTokenKind = $expectedToken->isArray() ? $expectedToken->getId() : $expectedToken->getContent();
38-
$this->assertTrue(
36+
static::assertTrue(
3937
$inputTokens->isTokenKindFound($expectedTokenKind),
4038
sprintf(
4139
'The token kind %s (%s) must be found in tokens collection.',
@@ -45,6 +43,6 @@ private function assertTokens(Tokens $expectedTokens, Tokens $inputTokens)
4543
);
4644
}
4745

48-
$this->assertSame($expectedTokens->count(), $inputTokens->count(), 'Both collections must have the same length.');
46+
static::assertSame($expectedTokens->count(), $inputTokens->count(), 'Both collections must have the same length.');
4947
}
5048
}

tests/Tokenizer/TokensTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testFindSequence(
6565
) {
6666
$tokens = Tokens::fromCode($source);
6767

68-
$this->assertEqualsTokensArray(
68+
static::assertEqualsTokensArray(
6969
$expected,
7070
$tokens->findSequence(
7171
$sequence,
@@ -691,7 +691,7 @@ public function provideTokenOfKindSiblingCases()
691691
*/
692692
public function testFindBlockEnd($expectedIndex, $source, $type, $searchIndex)
693693
{
694-
$this->assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex);
694+
static::assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex);
695695
}
696696

697697
public function provideFindBlockEndCases()
@@ -720,7 +720,7 @@ public function provideFindBlockEndCases()
720720
*/
721721
public function testFindBlockEnd70($expectedIndex, $source, $type, $searchIndex)
722722
{
723-
$this->assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex);
723+
static::assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex);
724724
}
725725

726726
public function provideFindBlockEnd70Cases()
@@ -741,7 +741,7 @@ public function provideFindBlockEnd70Cases()
741741
*/
742742
public function testFindBlockEnd71($expectedIndex, $source, $type, $searchIndex)
743743
{
744-
$this->assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex);
744+
static::assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex);
745745
}
746746

747747
public function provideFindBlockEnd71Cases()
@@ -882,7 +882,7 @@ public function testClone()
882882
* @param int $type
883883
* @param int $searchIndex
884884
*/
885-
public function assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex)
885+
public static function assertFindBlockEnd($expectedIndex, $source, $type, $searchIndex)
886886
{
887887
Tokens::clearCache();
888888
$tokens = Tokens::fromCode($source);
@@ -919,7 +919,7 @@ public function testEnsureWhitespaceAtIndex($expected, $input, $index, $offset,
919919
$tokens = Tokens::fromCode($input);
920920
$tokens->ensureWhitespaceAtIndex($index, $offset, $whiteSpace);
921921
$tokens->clearEmptyTokens();
922-
$this->assertTokens(Tokens::fromCode($expected), $tokens);
922+
static::assertTokens(Tokens::fromCode($expected), $tokens);
923923
}
924924

925925
public function provideEnsureWhitespaceAtIndexCases()
@@ -1070,7 +1070,7 @@ public function __construct($name)
10701070
$expected = Tokens::fromCode(sprintf($template, 'private $name;'));
10711071
static::assertFalse($expected->isChanged());
10721072

1073-
$this->assertTokens($expected, $tokens);
1073+
static::assertTokens($expected, $tokens);
10741074
}
10751075

10761076
/**
@@ -1183,7 +1183,7 @@ public function testRemovingLeadingWhitespaceWithEmptyTokenInCollection()
11831183
$tokens->removeLeadingWhitespace(3);
11841184

11851185
$tokens->clearEmptyTokens();
1186-
$this->assertTokens(Tokens::fromCode("<?php\nMY_INDEX_IS_THREE;foo();"), $tokens);
1186+
static::assertTokens(Tokens::fromCode("<?php\nMY_INDEX_IS_THREE;foo();"), $tokens);
11871187
}
11881188

11891189
public function testRemovingTrailingWhitespaceWithEmptyTokenInCollection()
@@ -1195,7 +1195,7 @@ public function testRemovingTrailingWhitespaceWithEmptyTokenInCollection()
11951195
$tokens->removeTrailingWhitespace(1);
11961196

11971197
$tokens->clearEmptyTokens();
1198-
$this->assertTokens(Tokens::fromCode("<?php\nMY_INDEX_IS_ONE;foo();"), $tokens);
1198+
static::assertTokens(Tokens::fromCode("<?php\nMY_INDEX_IS_ONE;foo();"), $tokens);
11991199
}
12001200

12011201
/**
@@ -1244,7 +1244,7 @@ public function testRemovingTrailingWhitespaceWillNotIncreaseTokensCount()
12441244
* @param null|Token[] $expected
12451245
* @param null|Token[] $input
12461246
*/
1247-
private function assertEqualsTokensArray(array $expected = null, array $input = null)
1247+
private static function assertEqualsTokensArray(array $expected = null, array $input = null)
12481248
{
12491249
if (null === $expected) {
12501250
static::assertNull($input);

0 commit comments

Comments
 (0)