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

chore(deps-dev): bump larastan/larastan from 2.9.11 to 3.0.0 #1493

Closed

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Nov 15, 2024

Bumps larastan/larastan from 2.9.11 to 3.0.0.

Release notes

Sourced from larastan/larastan's releases.

3.0.0

Larastan 3.0 🥳

This release adds compability with PHPStan 2 and drops support for Laravel versions < 11

Please make sure you read the both PHPStan's and Larastan's upgrade guides!

Notable changes:

  • Added support for PHPStan 2
  • Dropped support for Laravel versions <11
  • Dropped support for automatically adding generic return types for relations. Read the upgrade guide for more info.
  • Removed some PHPStan config options. If you want the same behavior as before, you can add them back yourselves.
  • Made some rules enabled by default.
Upgrade guide

Sourced from larastan/larastan's upgrade guide.

Upgrade Guide

Upgrading to 3.0 from 2.x

This is a new major release with lots of breaking changes.

Please first read PHPStan's 2.0 upgrade guide here carefully.

Correct return types for model relation methods

Likelihood Of Impact: High

Normally PHPStan warns the users when a return type of method does not provide its generic types. For example, the following code will produce a PHPStan error:

class User extends Model
{
    public function posts(): HasMany
    {
        return $this->hasMany(Post::class);
    }
}
// Method User::posts() return type with generic class HasMany does not specify its types: TRelatedModel, TDeclaringModel

In the previous versions of Larastan, in this case Larastan would parse the model file and read the method body to understand the generic types of the relation. But this approach is slow (because it requires parsing the file) and the maintenance of this feature is hard. So in this version, Larastan will not parse the method body to understand the generic types of the relation. Instead, you need to provide the correct generic types in the return type of the relation method. Here is how you can fix the above example:

class User extends Model
{
    /**
     * @return HasMany<Post, $this>
     */
    public function posts(): HasMany
    {
        return $this->hasMany(Post::class);
    }
}

Manually adding these annotations can be tedious. To help with this, we've created a Rector rule that can automatically add them for you! You can use this rule to automatically add the correct generic annotations. It detects your Laravel version and adds the appropriate generic types accordingly.

If you're not currently using Rector, or can't use it due to dependency conflicts, don't worry! We've also prepared a simple script that can run Rector for you without requiring a full installation.

First install cpx:

composer global require cpx/cpx

Then download this script from the gist and run with:

... (truncated)

Commits
  • 88f46e3 chore: update README
  • bc93ff0 chore: rework upgrade guide
  • 2fbbcbe fix: revert hack
  • 0ad3c58 fix: require testbench-core and adjust dependencies
  • 637a453 fix: require PHP parser explicitly
  • 3814cdd fix: hack workaround to dependency problem
  • 51db2b6 fix PHP parser compatibility
  • 5cfdb31 feat: update dependencies
  • 254796e fix: relation forwards calls extension uses type instead of class reflection
  • 2489d05 fix compability
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file php Pull requests that update Php code labels Nov 15, 2024
@github-actions github-actions bot enabled auto-merge (squash) November 15, 2024 11:00
@dependabot dependabot bot force-pushed the dependabot/composer/larastan/larastan-3.0.0 branch 4 times, most recently from e7357d6 to 1ebd205 Compare November 23, 2024 17:51
Bumps [larastan/larastan](https://github.com/larastan/larastan) from 2.9.11 to 3.0.0.
- [Release notes](https://github.com/larastan/larastan/releases)
- [Changelog](https://github.com/larastan/larastan/blob/3.x/RELEASE.md)
- [Upgrade guide](https://github.com/larastan/larastan/blob/3.x/UPGRADE.md)
- [Commits](larastan/larastan@v2.9.11...v3.0.0)

---
updated-dependencies:
- dependency-name: larastan/larastan
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/composer/larastan/larastan-3.0.0 branch from 1ebd205 to 852ab22 Compare November 25, 2024 10:54
Copy link
Contributor Author

dependabot bot commented on behalf of github Nov 27, 2024

Superseded by #1504.

@dependabot dependabot bot closed this Nov 27, 2024
auto-merge was automatically disabled November 27, 2024 10:13

Pull request was closed

@dependabot dependabot bot deleted the dependabot/composer/larastan/larastan-3.0.0 branch November 27, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants