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

Issue After Installing nunomaduro/phpinsights #283

Open abbasmashaddy72 opened 10 months ago

abbasmashaddy72 commented 10 months ago

I installed nunomaduro/phpinsights & FilamentPHP

Using Package Versions:

"filament/filament": "^3.1", (lock - 3.1.35)
"laravel/framework": "^10.10", (lock - 10.39.0)
"imanghafoori/laravel-microscope": "^1.0", (lock - 1.0.335)
"nunomaduro/phpinsights": "^2.11",

Issue Before installing nunomaduro/phpinsights

php artisan check:all

Started checking PSR-4 namespaces...
   The type hint on the listener: OwenIt\Auditing\Listeners\RecordCustomAudit does not match the event class path.
 __________________________________________________________________________________________________________________ 
 - 219 namespaces were checked.

Checking imports and class references...
   1 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/UserResource.php:9
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   2 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/OrderResource.php:14
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   3 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/BrandResource.php:13

Issue After installing nunomaduro/phpinsights Sowing vendor Error also as Before #282

php artisan check:all

Started checking PSR-4 namespaces...
   The type hint on the listener: OwenIt\Auditing\Listeners\RecordCustomAudit does not match the event class path.
 __________________________________________________________________________________________________________________ 
 - 219 namespaces were checked.

Checking imports and class references...
   1 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/UserResource.php:9
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   2 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/OrderResource.php:14
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   3 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/BrandResource.php:13
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   4 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/CustomerResource.php:9
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   5 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/ProductResource.php:14
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   6 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/Shield/RoleResource.php:14
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   7 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/CategoryResource.php:13
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   8 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/BlogCategoryResource.php:11
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   9 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/BlogResource.php:13
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  10 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/FaqResource.php:10
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  11 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/NavigationResource.php:12
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  12 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/PageResource.php:13
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  13 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/LaneResource.php:11
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  14 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/SportResource.php:11
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  15 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/SlotResource.php:10
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  16 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/LaneBookingResource.php:12
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
  17 Extra Import:
   Filament\Resources\Resource
at app/Filament/Resources/ContactUsResource.php:9
 ____________________________________________________________________________________________________________________________________________________________________________________________ 
   The type hint on the listener: OwenIt\Auditing\Listeners\RecordCustomAudit does not match the event class path.
 ____________________________________________________________________________________________________________________________________________________________________________________________ 

   Error 

  Interface "PHP_CodeSniffer\Sniffs\Sniff" not found

  at vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/AlphabeticallySortedUsesSniff.php:33
     29▕ use const T_OPEN_TAG;
     30▕ use const T_OPEN_USE_GROUP;
     31▕ use const T_SEMICOLON;
     32▕ 
  ➜  33▕ class AlphabeticallySortedUsesSniff implements Sniff
     34▕ {
     35▕ 
     36▕        public const CODE_INCORRECT_ORDER = 'IncorrectlyOrderedUses';
     37▕ 

      +2 vendor frames 

  3   [internal]:0
      Composer\Autoload\ClassLoader::loadClass()
      +33 vendor frames 

  37  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

Also, filament Code I am using Resource but still shows Extra Import:

<?php

namespace App\Filament\Resources;

use App\Models\User;
use Filament\Tables;
use Filament\Forms\Form;
use Filament\Tables\Table;
use Filament\Resources\Resource;
use Filament\Tables\Actions\Action;
use Filament\Forms\Components\Select;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\TextInput;
use App\Filament\Resources\UserResource\Pages;
use STS\FilamentImpersonate\Tables\Actions\Impersonate;
use pxlrbt\FilamentExcel\Actions\Tables\ExportBulkAction;
use Tapp\FilamentAuthenticationLog\RelationManagers\AuthenticationLogsRelationManager;

class UserResource extends Resource
{
    protected static ?string $model = User::class;

    protected static ?string $navigationIcon = 'heroicon-o-users';

    protected static ?string $navigationGroup = 'User Management';

    protected static ?int $navigationSort = 0;

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('name')->required(),
                TextInput::make('email')->required(),
                TextInput::make('password')->required(),
                Select::make('roles')
                    ->relationship('roles', 'name')
                    ->multiple()
                    ->preload()
                    ->searchable()
            ])->columns(3);
    }

    public static function table(Table $table): Table
    {
        return $table->emptyStateHeading('No Users yet')
            ->emptyStateIcon('heroicon-o-user')
            ->emptyStateActions([
                Action::make('create')
                    ->label('Create user')
                    ->url(route('filament.admin.resources.users.create'))
                    ->icon('heroicon-m-plus')
                    ->button(),
            ])
            ->columns([
                TextColumn::make('name')->sortable()->searchable(),
                Tables\Columns\TextColumn::make('roles.name')
                    ->searchable()
                    ->sortable()
                    ->toggleable(),
                TextColumn::make('email')->sortable()->searchable(),
                TextColumn::make('email_verified_at')->sortable()->since(),
            ])
            ->filters([
                //
            ])
            ->actions([
                Impersonate::make(),
                Tables\Actions\ViewAction::make(),
                Tables\Actions\EditAction::make(),
                Tables\Actions\DeleteAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\BulkActionGroup::make([
                    Tables\Actions\DeleteBulkAction::make(),
                ]),
                ExportBulkAction::make()
            ]);
    }

    public static function getRelations(): array
    {
        return [
            AuthenticationLogsRelationManager::class,
            // AuditsRelationManager::class,
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListUsers::route('/'),
            'create' => Pages\CreateUser::route('/create'),
            'edit' => Pages\EditUser::route('/{record}/edit'),
        ];
    }
}