Skip to content

Commit

Permalink
Merge branch refs/heads/1.12.x into 2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
phpstan-bot authored Oct 7, 2024
2 parents 57519cc + f7f2be8 commit fca1268
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,4 +844,12 @@ public function testClosureBind(): void
]);
}

public function testBug10872(): void
{
$this->checkThisOnly = false;
$this->checkExplicitMixed = true;
$this->checkImplicitMixed = true;
$this->analyse([__DIR__ . '/data/bug-10872.php'], []);
}

}
42 changes: 42 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-10872.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Bug10872;

class HelloWorld
{
/**
* @return array<string, string|null>
*/
public function getRow(): array
{
return [];
}

/**
* @template ExpectedType of array<mixed>
* @param ExpectedType $expected
* @param array<mixed> $actual
* @psalm-assert =ExpectedType $actual
*/
public static function assertSame(array $expected, array $actual): void
{
if ($actual !== $expected) {
throw new \Exception();
}
}

public function testEscapeIdentifier(): void
{
$names = [
'foo',
'2',
];

$expected = array_combine($names, array_fill(0, count($names), 'x'));

self::assertSame(
$expected,
$this->getRow()
);
}
}

0 comments on commit fca1268

Please sign in to comment.