-
Notifications
You must be signed in to change notification settings - Fork 1
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
bug: Model::find()
returns incorrect type
#25
Labels
bug
Something isn't working
Comments
What is the dumped value of |
This is an issue on $monster = $this->fabricator->make(); |
Yes, because PHPStan does not know what really A workaround is to add exhaustive tests. public function testMakesMonsterWithDungeon()
{
$monster = $this->fabricator->make();
$this->assertIsObject($monster);
$this->assertTrue(property_exists('dungeon_id', $monster));
$this->assertIsInt($monster->dungeon_id); // or assertIsString, whatever the case for this
$dungeon = model(DungeonModel::class)->find($monster->dungeon_id);
$this->assertInstanceOf(Dungeon::class, $dungeon); // this should be fine, but if using strict-rules might still error
} |
11 tasks
10 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Expected Output
The
$dungeon
type isApp\\Entities\\Dungeon
.The text was updated successfully, but these errors were encountered: