Skip to content
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

fix: return correct types from model factories #1339

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

canvural
Copy link
Collaborator

  • Added or updated tests
  • Documented user facing changes
  • Updated CHANGELOG.md

Changes

Better return type inference for model factories. Now Larastan understands that User::factory()->create() returns a single model, whereas User:factory(2)->create() or User::factory()->count(2)->create() returns a collection.

Breaking changes

@canvural canvural merged commit 81f35a6 into master Aug 23, 2022
@canvural canvural deleted the eloquent-factory-count-fixes branch August 23, 2022 22:50
// yield from $this->gatherAssertTypes(__DIR__.'/data/eloquent-builder.php');
// yield from $this->gatherAssertTypes(__DIR__.'/data/paginator-extension.php');
// yield from $this->gatherAssertTypes(__DIR__.'/data/model-properties.php');
// yield from $this->gatherAssertTypes(__DIR__.'/data/model-properties-relations.php');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to add these back:)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was fixed in ef427e6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants