Skip to content

Commit

Permalink
PHPStan false positive "Creating callable from Mockery\MockInterface …
Browse files Browse the repository at this point in the history
…but it might not be a callable" in `Override` trait.

See: phpstan/phpstan-mockery#34
  • Loading branch information
LastDragon-ru committed Mar 21, 2024
1 parent 8d38fbb commit 6c18cb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/testing/src/Concerns/Override.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\TestCase;

use function assert;
use function is_callable;
use function is_string;
use function sprintf;
Expand Down Expand Up @@ -101,6 +102,8 @@ protected function override(string $class, mixed $factory = null): mixed {
return $mock;
});

assert(is_callable($this->overrides[$class]));

Container::getInstance()->bind(
$class,
($this->overrides[$class])(...),
Expand Down
2 changes: 0 additions & 2 deletions phpstan-baseline-well-known.neon
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ parameters:
message: "#^Creating callable from Mockery\\\\MockInterface but it might not be a callable\\.$#"
paths:
- packages/**/*Test.php
- packages/testing/src/Package/TestCase.php
- packages/testing/src/TestCase.php

# False positive
# https://github.com/phpstan/phpstan-mockery/issues/18
Expand Down

0 comments on commit 6c18cb1

Please sign in to comment.