psalm-plugin-laravel
psalm-plugin-laravel copied to clipboard
Test failure (factory(): can use factory helper in Laravel 6.x and 7.x)
Describe the bug
1) factory(): can use factory helper in Laravel 6.x and 7.x
Test tests/acceptance/FactoryTypes.feature:can use factory helper in Laravel 6.x and 7.x
Step Have a dependency satisfied "laravel/framework",">= 8.0"
Fail There were errors:
| MixedInferredReturnType | Could not verify return type 'Illuminate\Database\Eloquent\FactoryBuilder<Tests\Psalm\LaravelPlugin\Models\User, int>' for FactoryTest::getFactory |
| MixedReturnStatement | Could not infer a return type |
| MixedInferredReturnType | Could not verify return type 'Illuminate\Database\Eloquent\FactoryBuilder<Tests\Psalm\LaravelPlugin\Models\User, int>' for FactoryTest::getFactoryForTwo |
| MixedReturnStatement | Could not infer a return type |
| MixedInferredReturnType | Could not verify return type 'Tests\Psalm\LaravelPlugin\Models\User' for FactoryTest::makeUser |
| MixedReturnStatement | Could not infer a return type |
| MixedMethodCall | Cannot determine the type of the object on the left hand side of this expression |
| MixedInferredReturnType | Could not verify return type 'Tests\Psalm\LaravelPlugin\Models\User' for FactoryTest::createUser |
| MixedReturnStatement | Could not infer a return type |
| MixedMethodCall | Cannot determine the type of the object on the left hand side of this expression |
| MixedInferredReturnType | Could not verify return type 'Illuminate\Database\Eloquent\Collection<Tests\Psalm\LaravelPlugin\Models\User>' for FactoryTest::createUsers |
| MixedReturnStatement | Could not infer a return type |
| MixedMethodCall | Cannot determine the type of the object on the left hand side of this expression |
| MixedInferredReturnType | Could not verify return type 'Illuminate\Database\Eloquent\Collection<Tests\Psalm\LaravelPlugin\Models\User>' for FactoryTest::createUsersWithNameAttribute |
| MixedReturnStatement | Could not infer a return type |
| MixedMethodCall | Cannot determine the type of the object on the left hand side of this expression |
Impacted Versions ❌ PHP 7.3 | Illuminate 6.* | Composer Flags (broken) ✔ PHP 7.3 | Illuminate 6.* | Composer Flags --prefer-lowest (works)
Additional context (None.)
I'm not sure, but since there were no relevant changes in Laravel 6.x, maybe something changed in the way Psalm behaves?
Relevant changes: https://github.com/vimeo/psalm/compare/0317f1d...82b3564
yeah, haven't had a time to dig in but I agree something in psalm broke this behavior. https://github.com/psalm/psalm-plugin-laravel/pull/194#issuecomment-921094854