imanghafoori1 / laravel-microscope

Fearless refactoring, it does a lot of smart checks to find certain errors.
MIT License
1.48k stars 96 forks source link

Cannot declare class App\Models\User, because the name is already in use. #143

Closed vmlinuz82 closed 3 years ago

vmlinuz82 commented 3 years ago

Hi, thanks for the awesome package. I have the following problem when running php artisan check:all.

Checking stringy classes...
PHP Fatal error:  Cannot declare class App\Models\User, because the name is already in use in /home/dade/Projects/PROJECT_NAME/app/Models/User.php on line 31

   Symfony\Component\ErrorHandler\Error\FatalError

  Cannot declare class App\Models\User, because the name is already in use

  at app/Models/User.php:31
     27▕  * App\Models\User
     28▕  *
     29▕  * @property App\Models\Site|null $site
     30▕  */
  ➜  31▕ class User extends Authenticatable implements HasMedia
     32▕ {
     33▕     use HasFactory, Notifiable, HasRoles, HasMediaTrait, LogsActivity, ReceivesWelcomeNotification;
     34▕
     35▕     /**

   Whoops\Exception\ErrorException

  Cannot declare class App\Models\User, because the name is already in use

  at app/Models/User.php:31
     27▕  * App\Models\User
     28▕  *
     29▕  * @property App\Models\Site|null $site
     30▕  */
  ➜  31▕ class User extends Authenticatable implements HasMedia
     32▕ {
     33▕     use HasFactory, Notifiable, HasRoles, HasMediaTrait, LogsActivity, ReceivesWelcomeNotification;
     34▕
     35▕     /**

      +1 vendor frames
  2   [internal]:0
      Whoops\Run::handleShutdown()

I'm using

imanghafoori1 commented 3 years ago

Thanks for the report. Do you have a manual require statement somewhere?

vmlinuz82 commented 3 years ago

No, not outside of requires that are already in Laravel framework.

imanghafoori1 commented 3 years ago

@vmlinuz82 Please try out the latest version, it should be fixed. I will close the issue after you confirm the fix.

imanghafoori1 commented 3 years ago

Closing for inactivity.