Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Arch tests returning Undefined constant PhpParser\Node\Expr\List_::KIND_LIST #1244

Open
gabrielrbarbosa opened this issue Sep 12, 2024 · 2 comments
Labels

Comments

@gabrielrbarbosa
Copy link

gabrielrbarbosa commented Sep 12, 2024

What Happened

 FAILED  Tests\Unit\ArchTest > expect 'App\Http' → toOnlyBeUsedIn 'App\Http'                                                                                  Error
  Undefined constant PhpParser\Node\Expr\List_::KIND_LIST

  at vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php:2642
    2638▕             588 => static function ($self, $stackPos) {
    2639▕                  $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2;
    2640▕             },
    2641▕             589 => static function ($self, $stackPos) {
  ➜ 2642▕                  $self->semValue = new Expr\List_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); $self->semValue->setAttribute('kind', Expr\List_::KIND_LIST);
    2643▕             $self->postprocessList($self->semValue);
    2644▕             },
    2645▕             590 => static function ($self, $stackPos) {
    2646▕                  $self->semValue = $self->semStack[$stackPos-(1-1)]; $end = count($self->semValue)-1; if ($self->semValue[$end]->value instanceof Expr\Error) array_pop($self->semValue);


  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   FAILED  Tests\Unit\ArchTest > expect 'App\Http\Controllers' → not → toHavePublicMethodsBesides ['__construct', '__invoke', 'index', …]                       Error
  Undefined constant PhpParser\Node\Expr\List_::KIND_LIST

  at vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php:2642
    2638▕             588 => static function ($self, $stackPos) {
    2639▕                  $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2;
    2640▕             },
    2641▕             589 => static function ($self, $stackPos) {
  ➜ 2642▕                  $self->semValue = new Expr\List_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); $self->semValue->setAttribute('kind', Expr\List_::KIND_LIST);
    2643▕             $self->postprocessList($self->semValue);
    2644▕             },
    2645▕             590 => static function ($self, $stackPos) {
    2646▕                  $self->semValue = $self->semStack[$stackPos-(1-1)]; $end = count($self->semValue)-1; if ($self->semValue[$end]->value instanceof Expr\Error) array_pop($self->semValue);


  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   FAILED  Tests\Unit\ArchTest > expect ['dd', 'ddd', 'dump', …] → not → toBeUsed                                                                               Error
  Undefined constant PhpParser\Node\Expr\List_::KIND_LIST

  at vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php:2642
    2638▕             588 => static function ($self, $stackPos) {
    2639▕                  $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2;
    2640▕             },
    2641▕             589 => static function ($self, $stackPos) {
  ➜ 2642▕                  $self->semValue = new Expr\List_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); $self->semValue->setAttribute('kind', Expr\List_::KIND_LIST);
    2643▕             $self->postprocessList($self->semValue);
    2644▕             },
    2645▕             590 => static function ($self, $stackPos) {
    2646▕                  $self->semValue = $self->semStack[$stackPos-(1-1)]; $end = count($self->semValue)-1; if ($self->semValue[$end]->value instanceof Expr\Error) array_pop($self->semValue);

How to Reproduce

php 8.3.10
laravel/framework 11.21.0

Using laravel preset or using some of its arch tests alone

Sample Repository

No response

Pest Version

3.0.5

PHP Version

8.3.10

Operation System

Linux

Notes

No response

@gabrielrbarbosa
Copy link
Author

If I replace Expr\List_::KIND_LIST with "1" it works for some reason 😕

@gabrielrbarbosa
Copy link
Author

nikic/PHP-Parser#1023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant