larastan: Anyone else has problems with latest PHPStan 1.10 ?

  • Larastan Version: 2.4.1
  • --level used: 6
  • Pull request with failing test:

Description

Just updated my codebase to new PHPStan 1.10 and I’ve started to get errors on weird places without changing the code.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (17 by maintainers)

Most upvoted comments

a ha! I got it to work without ignoring errors… it’s ugly but it works. 😉

$builder = $this->model::class::hasTranslatedField($attribute, $value)
	->when($this->model->getKey(), function (Builder $query): void {
		$query->where($this->model->getKeyName(), '<>', $this->model->getKey());
	});

here you go guys:

Dumped type: App\Contracts\HasTranslations&App\Models\Model
Dumped type: Illuminate\Database\Eloquent\Builder

I think this bug report should be more specific - show some code for which PHPStan/Larastan is now failing.

Also make sure to test PHPStan 1.10.1 first 😃

Yeah something like that… also some local scopes are not recognized as “scopes” and they were before… And one more thing… model “create” functions are returning generic Model instead of a specific model class eg. Post