Skip to content

Commit fa02db3

Browse files
authored
Remove useless foreach key and cast string, and fix invalid @var definition in test (#1061)
1 parent d4fce83 commit fa02db3

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

test/PhpParser/CodeTestParser.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function ($matches) {
2424
// multiple sections possible with always two forming a pair
2525
$chunks = array_chunk($parts, $chunksPerTest);
2626
$tests = [];
27-
foreach ($chunks as $i => $chunk) {
27+
foreach ($chunks as $chunk) {
2828
$lastPart = array_pop($chunk);
2929
list($lastPart, $mode) = $this->extractMode($lastPart);
3030
$tests[] = [$mode, array_merge($chunk, [$lastPart])];
@@ -61,7 +61,7 @@ private function extractMode(string $expected): array {
6161
return [$expected, null];
6262
}
6363

64-
$expected = (string) substr($expected, $firstNewLine + 1);
64+
$expected = substr($expected, $firstNewLine + 1);
6565
return [$expected, substr($firstLine, 2)];
6666
}
6767
}

test/PhpParser/Node/Scalar/DNumberTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ public function testRawValue(): void {
1515
$this->assertInstanceOf(Echo_::class, $echo);
1616

1717
/** @var Echo_ $echo */
18-
$lLumber = $echo->exprs[0];
19-
$this->assertInstanceOf(Float_::class, $lLumber);
18+
$dnumber = $echo->exprs[0];
19+
$this->assertInstanceOf(Float_::class, $dnumber);
2020

2121
/** @var Float_ $dnumber */
22-
$this->assertSame(1234.56, $lLumber->value);
23-
$this->assertSame('1_234.56', $lLumber->getAttribute('rawValue'));
22+
$this->assertSame(1234.56, $dnumber->value);
23+
$this->assertSame('1_234.56', $dnumber->getAttribute('rawValue'));
2424
}
2525
}

test/PhpParser/Node/Scalar/NumberTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public function testRawValue(): void {
1414
$this->assertInstanceOf(Echo_::class, $echo);
1515

1616
/** @var Echo_ $echo */
17-
$lLumber = $echo->exprs[0];
18-
$this->assertInstanceOf(Int_::class, $lLumber);
17+
$lnumber = $echo->exprs[0];
18+
$this->assertInstanceOf(Int_::class, $lnumber);
1919

2020
/** @var Int_ $lnumber */
21-
$this->assertSame(1234, $lLumber->value);
22-
$this->assertSame('1_234', $lLumber->getAttribute('rawValue'));
21+
$this->assertSame(1234, $lnumber->value);
22+
$this->assertSame('1_234', $lnumber->getAttribute('rawValue'));
2323
}
2424
}

0 commit comments

Comments
 (0)