Skip to content

chore(deps-dev): bump larastan/larastan from 2.9.8 to 3.9.3#46

Open
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/composer/larastan/larastan-3.9.3
Open

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

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot Bot commented on behalf of github Mar 20, 2026

Bumps larastan/larastan from 2.9.8 to 3.9.3.

Release notes

Sourced from larastan/larastan's releases.

3.9.3

What's Changed

New Contributors

Full Changelog: larastan/larastan@v3.9.2...v3.9.3

3.9.2

What's Changed

Added

Fixed

New Contributors

Full Changelog: larastan/larastan@v3.9.1...v3.9.2

3.9.1

What's Changed

Fixed

Full Changelog: larastan/larastan@v3.9.0...v3.9.1

3.9.0

What's Changed

Added

Fixed

New Contributors

... (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
  • 64a52bc feat: improve config type inference to respect return docblocks (#2445)
  • 04bb863 feat: allow Laravel 13 (#2446)
  • bddd5bb fix: check for more traits
  • 438ddc0 fix build temporarily
  • c4bcf4e fix: add generic types
  • 2e9ed29 feat: improve type inference for MySQL ENUM types in squashed migrations (#...
  • 0ac2cfa fix: model property type has template type
  • 4b92d96 [3.x] Update PendingRequest stubs (#2432)
  • 82c1889 feat: disable migration cache by default
  • d0f8c1c docs: add docs for new features
  • 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 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)

Bumps [larastan/larastan](https://github.com/larastan/larastan) from 2.9.8 to 3.9.3.
- [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.9.3)

---
updated-dependencies:
- dependency-name: larastan/larastan
  dependency-version: 3.9.3
  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 Mar 20, 2026
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