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

Added conditional return types #1236

Merged
merged 6 commits into from
May 23, 2022

Conversation

ricklambrechts
Copy link
Contributor

@ricklambrechts ricklambrechts commented May 17, 2022

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

Resolves #1218

Changes

Added conditional return types.
If the $id parameter is an array or Arrayable then return type is a collection else the model found.

Breaking changes

Updated the return types of the following methods:

  • Model::find()
  • Model::findOrFail()
  • BelongsToMany::findOrNew()
  • BelongsToMany::find()
  • BelongsToMany::findOrFail()
  • HasOneOrMany::findOrNew()

@szepeviktor
Copy link
Collaborator

Hello!!
You may have to write array< ... >

@szepeviktor
Copy link
Collaborator

Now only Tests\FeaturesTest::testFeatures fails.

@ricklambrechts
Copy link
Contributor Author

@szepeviktor thanks, made mistake by using incorrect collection type

@szepeviktor
Copy link
Collaborator

Let's see tests again!

@szepeviktor szepeviktor requested a review from canvural May 18, 2022 18:01
@ricklambrechts ricklambrechts marked this pull request as ready for review May 19, 2022 00:02
@canvural canvural merged commit 174007d into larastan:master May 23, 2022
@canvural
Copy link
Collaborator

Thank you.

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.

Take advantage of conditional return types
3 participants