Skip to content

Commit

Permalink
Remove useless foreach key and cast string, and fix invalid @var defi…
Browse files Browse the repository at this point in the history
…nition in test (#1061)
  • Loading branch information
samsonasik authored Jan 17, 2025
1 parent d4fce83 commit fa02db3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/PhpParser/CodeTestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function ($matches) {
// multiple sections possible with always two forming a pair
$chunks = array_chunk($parts, $chunksPerTest);
$tests = [];
foreach ($chunks as $i => $chunk) {
foreach ($chunks as $chunk) {
$lastPart = array_pop($chunk);
list($lastPart, $mode) = $this->extractMode($lastPart);
$tests[] = [$mode, array_merge($chunk, [$lastPart])];
Expand Down Expand Up @@ -61,7 +61,7 @@ private function extractMode(string $expected): array {
return [$expected, null];
}

$expected = (string) substr($expected, $firstNewLine + 1);
$expected = substr($expected, $firstNewLine + 1);
return [$expected, substr($firstLine, 2)];
}
}
8 changes: 4 additions & 4 deletions test/PhpParser/Node/Scalar/DNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public function testRawValue(): void {
$this->assertInstanceOf(Echo_::class, $echo);

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

/** @var Float_ $dnumber */
$this->assertSame(1234.56, $lLumber->value);
$this->assertSame('1_234.56', $lLumber->getAttribute('rawValue'));
$this->assertSame(1234.56, $dnumber->value);
$this->assertSame('1_234.56', $dnumber->getAttribute('rawValue'));
}
}
8 changes: 4 additions & 4 deletions test/PhpParser/Node/Scalar/NumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ public function testRawValue(): void {
$this->assertInstanceOf(Echo_::class, $echo);

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

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

0 comments on commit fa02db3

Please sign in to comment.