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

Bump larastan/larastan from 2.9.10 to 3.0.2 #468

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Dec 2, 2024

Bumps larastan/larastan from 2.9.10 to 3.0.2.

Release notes

Sourced from larastan/larastan's releases.

v3.0.1

What's Changed

Fixed

Internal

Also changes from 2.9.12

New Contributors

Full Changelog: larastan/larastan@v3.0.0...v3.0.1

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.

v2.9.12

What's Changed

Added

Fixed

Full Changelog: larastan/larastan@v2.9.11...v2.9.12

2.9.11

What's Changed

Fixed

... (truncated)

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

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 Dec 2, 2024
@lanedirt
Copy link
Owner

lanedirt commented Dec 2, 2024

@dependabot rebase

@dependabot dependabot bot force-pushed the dependabot/composer/larastan/larastan-3.0.2 branch from 4cfdadf to ab00f18 Compare December 2, 2024 21:42
Bumps [larastan/larastan](https://github.com/larastan/larastan) from 2.9.10 to 3.0.2.
- [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.10...v3.0.2)

---
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.2 branch from ab00f18 to 105038e Compare December 2, 2024 22:24
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.

1 participant