Safiullah Miraj
Safiullah Miraj

Reputation: 21

When I using Enum in laravel gives me error during package installation and composer commands

When i use Enum in laravel it gives me error during package installation and composer commands: Generating optimized autoload files

Class App\Enums\Gender:string located in MyProject\app\Enums\Gender.php does not comply with psr-4 autoloading standard. Skipping.

I Want to use php(8.1) feature Enum in laravel(9)

Upvotes: 1

Views: 592

Answers (1)

Safiullah Miraj
Safiullah Miraj

Reputation: 21

There should be space between "Gender:" and "string".
I change this:

enum Gender:string { 
    case Male = 'male';
    case Female = 'female';
} 

to this:

enum Gender: string { 
    case Male = 'male';
    case Female = 'female';
}

The problem Solved.

Upvotes: 1

Related Questions