Larastan: PhpStorm shows 'Multiple definitions exists for class'

Created on 10 Apr 2020  路  4Comments  路  Source: nunomaduro/larastan

  • Larastan Version: 0.5.5

Description

PhpStorm shows 'Multiple definitions exist for class' warnings. It breaks code assistance.

Check the following screenshots.

image

image

image

It seems to be related to stubs defined in the package.

Laravel code where the issue was found

Declaring a model is an example.

<?php

declare(strict_types=1);

namespace Domain\Campaign\Model;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
}

Most helpful comment

The stubs in Larastan are not even php files. They have .stub extensions for this very reason.

So check your IDE settings, I believe you associated stub extension with PHP files.

All 4 comments

Very interesting!

@mariomka We are not sure how to improve this. Can you investigate this?

The stubs in Larastan are not even php files. They have .stub extensions for this very reason.

So check your IDE settings, I believe you associated stub extension with PHP files.

@canvural Yep! I removed .stub extension from PHP file types. I don't know if this extension is set by default or maybe I added it.

Thank you all.

Was this page helpful?
0 / 5 - 0 ratings