Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

662
Vistas
How do I correct syntax highlight in VS Code for PHP 8.1 Enum Class?

My Code:

namespace App\Enum;

enum HomeStatus: string
{
    case RENT = 'rent';
    case MOVE_IN = 'move_in';
    case SOLD = 'sold';
    case COMING_SOON = 'coming_soon';
}

The code above is executing and working but the editor has the following error:

Unexpected 'Name'. Expected ';'.intelephense(1001)

I am using Intelephense v1.8.0 which I believe is the latest.

In the Change Log it says:

PHP 8.1 is now the default version.

I'm thinking that either that's not the case or PHP 8.1 does not yet have support for enums.

Is there a way to resolve this or is this something that is not yet supported?

EDIT As requested here's a screenshot of the error.

enter image description here

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Open Visual Studio Code settings and ensure the intelephense.environment.phpVersion directive is set to "8.1.0". It can be set for the whole program or for specific projects.

intelephense.environment.phpVersion

{
    "intelephense.environment.phpVersion": "8.1.0"
}
over 4 years ago · Santiago Trujillo Denunciar

0

For me, Alvaro's solution was only half of the fix. I also had to update this setting to point to my PHP executable.

{
"php.validate.executablePath": "C://laragon//bin//php//php-8.1.3-Win32-vs16-x64//php.exe"
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda