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

GetFromInlineValidatorBase::extractEnumClassFromArrayItem Argument #1 ($arrayItem) must be of type PhpParser\\Node\\ArrayItem, PhpParser\\Node\\Expr\\ArrayItem given #832

Closed
1 task done
wilecoyte78 opened this issue Mar 21, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@wilecoyte78
Copy link

wilecoyte78 commented Mar 21, 2024

Scribe version

4.34.0

PHP version

8.1

Framework

Laravel

Framework version

10.46.0

Scribe config

------ SAME AS DEFAULT CONFIG ------

What happened?

I ran php artisan scribe:generate and then I get an error:

Knuckles\Scribe\Extracting\Strategies\GetFromInlineValidatorBase::extractEnumClassFromArrayItem(): Argument #1 ($arrayItem) must be of type PhpParser\Node\ArrayItem, PhpParser\Node\Expr\ArrayItem given, called in vendor/knuckleswtf/scribe/src/Extracting/Strategies/GetFromInlineValidatorBase.php on line 88

at vendor/knuckleswtf/scribe/src/Extracting/Strategies/GetFromInlineValidatorBase.php:127
123▕
124▕ return [$rules, $customParameterData];
125▕ }
126▕
➜ 127▕ protected function extractEnumClassFromArrayItem(Node\ArrayItem $arrayItem): ?string
128▕ {
129▕ $args = [];
130▕
131▕ // Enum rule with the form "new Enum(...)"

Docs

@wilecoyte78 wilecoyte78 added bug Something isn't working triage labels Mar 21, 2024
@shalvah
Copy link
Contributor

shalvah commented Mar 26, 2024

Hmm, that sounds like you're using an older version of nikic/php-parser, which shouldn't be happening. Can you try running composer show nikic/php-parser?

@shalvah shalvah removed the triage label Mar 26, 2024
@wilecoyte78
Copy link
Author

wilecoyte78 commented Mar 26, 2024

$ composer show nikic/php-parser
name : nikic/php-parser
descrip. : A PHP parser written in PHP
keywords : parser, php
versions : * v5.0.1
type : library
license : BSD 3-Clause "New" or "Revised" License (BSD-3-Clause) (OSI approved) https://spdx.org/licenses/BSD-3-Clause.html#licenseText
homepage :
source : [git] https://github.com/nikic/PHP-Parser.git 2218c2252c874a4624ab2f613d86ac32d227bc69
dist : [zip] https://api.github.com/repos/nikic/PHP-Parser/zipball/2218c2252c874a4624ab2f613d86ac32d227bc69 2218c2252c874a4624ab2f613d86ac32d227bc69
path :
names : nikic/php-parser

support
issues : https://github.com/nikic/PHP-Parser/issues
source : https://github.com/nikic/PHP-Parser/tree/v5.0.1

autoload
psr-4
PhpParser\ => lib/PhpParser

requires
ext-ctype *
ext-json *
ext-tokenizer *
php >=7.4

requires (dev)
ircmaxell/php-yacc ^0.0.7
phpunit/phpunit ^7.0 || ^8.0 || ^9.0

@shalvah
Copy link
Contributor

shalvah commented Mar 28, 2024

No idea. Can't reproduce it. Try updating nikic/php-parser to the latest version. If it doesn't work, please share the code being parsed (it appears to be an inline validator) that leads to a crash (you can figure it out by looking at the logs to see what endpoint was being processed).

@shalvah shalvah closed this as completed Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants