Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless foreach key and cast string, and fix invalid @var definition on test #1061

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'));
}
}
Loading