Skip to content

chore(deps-dev): bump larastan/larastan from 2.9.8 to 3.0.2#26

Closed
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/composer/larastan/larastan-3.0.2
Closed

chore(deps-dev): bump larastan/larastan from 2.9.8 to 3.0.2#26
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/composer/larastan/larastan-3.0.2

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot Bot commented on behalf of github Nov 27, 2024

Bumps larastan/larastan from 2.9.8 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

You can trigger a rebase of this PR 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)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Bumps [larastan/larastan](https://github.com/larastan/larastan) from 2.9.8 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.8...v3.0.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file php Pull requests that update Php code labels Nov 27, 2024
@dependabot @github
Copy link
Copy Markdown
Contributor Author

dependabot Bot commented on behalf of github Mar 20, 2026

Superseded by #46.

@dependabot dependabot Bot closed this Mar 20, 2026
@dependabot dependabot Bot deleted the dependabot/composer/larastan/larastan-3.0.2 branch March 20, 2026 21:05
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