Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"nette/utils": "^3.2.5",
"nikic/php-parser": "^5.9.0",
"ondram/ci-detector": "^4.0",
"ondrejmirtes/better-reflection": "6.75.0.4",
"ondrejmirtes/better-reflection": "6.75.0.5",
"ondrejmirtes/composer-attribute-collector": "^1.4.0",
"ondrejmirtes/phplrt-runtime": "4.2.4.1",
"phpstan/php-8-stubs": "0.4.43",
Expand Down
15 changes: 8 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/Rules/Methods/OverridingMethodRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ public function processNode(Node $node, Scope&NodeCallbackInvoker&CollectedDataE
$reportReturnType = !$realPrototype instanceof MethodPrototypeReflection
|| $realPrototype->getTentativeReturnType() === null
|| (is_bool($prototype->isBuiltin()) ? !$prototype->isBuiltin() : $prototype->isBuiltin()->no());
} elseif ($realPrototype instanceof MethodPrototypeReflection && $realPrototype->getTentativeReturnType() !== null) {
} elseif (
$realPrototype instanceof MethodPrototypeReflection
&& $realPrototype->getTentativeReturnType() !== null
&& $prototypeDeclaringClass->isBuiltin()
) {
// return types that are only tentative are not checked before PHP 8.1
$reportReturnType = false;
} else {
Expand Down
14 changes: 12 additions & 2 deletions tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,19 @@ public function testBug9135(): void
]);
}

public function testBug10101(): void
public static function dataBug10101(): array
{
$this->phpVersionId = PHP_VERSION_ID;
return [
[70400],
[80000],
[PHP_VERSION_ID],
];
}

#[DataProvider('dataBug10101')]
public function testBug10101(int $phpVersionId): void
{
$this->phpVersionId = $phpVersionId;
$this->analyse([__DIR__ . '/data/bug-10101.php'], [
[
'Return type mixed of method Bug10101\B::next() is not covariant with return type void of method Bug10101\A::next().',
Expand Down
Loading