-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
PHP Version
8.2
PHPStan CodeIgniter Version
v1.4.3.70400
PHPStan Version
1.10.58
What happened?
Model::find() returns incorrect type.
See codeigniter4projects/playground#218 (comment)
Minimum Reproduction Script
public function testMakesMonsterWithDungeon()
{
$monster = $this->fabricator->make();
$dungeon = model(DungeonModel::class)->find($monster->dungeon_id);
$this->assertInstanceOf(Dungeon::class, $dungeon); // Line 49
} ------ ----------------------------------------------------------------------------------------------------------
Line tests/database/FakerTest.php
------ ----------------------------------------------------------------------------------------------------------
49 Call to method PHPUnit\Framework\Assert::assertInstanceOf() with 'App\\Entities\\Dungeon' and array<int,
App\Entities\Dungeon> will always evaluate to false.
💡 Because the type is coming from a PHPDoc, you can turn off this check by setting
treatPhpDocTypesAsCertain: false in your phpstan.neon.dist.
------ ----------------------------------------------------------------------------------------------------------
Expected Output
The $dungeon type is App\\Entities\\Dungeon.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working