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

Laravel Lumen Error while running "php artisan insights" #673

Open
devkishanu opened this issue Feb 15, 2024 · 1 comment
Open

Laravel Lumen Error while running "php artisan insights" #673

devkishanu opened this issue Feb 15, 2024 · 1 comment

Comments

@devkishanu
Copy link

We have installed the package according to the steps but we are getting issues while running the command. please help me out on this one.

Thank you in advance

Error:-

The command "D:\laragon\bin\php\php-8.1.6-Win32-vs16-x64\php.exe "D:\laragon\www\blmp-api/vendor/bin/phpinsights" internal:processors thread-0-926867725bc85446ae5189b1f5b10feb" failed.
Exit Code: 255(Unknown error)
Working directory: D:\laragon\www\blmp-api
Output:

Fatal error: Uncaught Error: Typed property NunoMaduro\PhpInsights\Domain\File::$activeSniff must not be accessed before initialization in D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Doma
in\File.php:129
Stack trace:
#0 D:\laragon\www\blmp-api\vendor\squizlabs\php_codesniffer\src\Files\File.php(782): NunoMaduro\PhpInsights\Domain\File->addMessage(false, 'File has mixed ...', 1, 1, 'Internal.LineEn...', Array, 0, fa
lse)
#1 D:\laragon\www\blmp-api\vendor\squizlabs\php_codesniffer\src\Files\File.php(621): PHP_CodeSniffer\Files\File->addWarningOnLine('File has mixed ...', 1, 'Internal.LineEn...')
#2 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Domain\File.php(41): PHP_CodeSniffer\Files\File->parse()
#3 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Domain\File.php(74): NunoMaduro\PhpInsights\Domain\File->process()
#4 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Domain\FileProcessors\SniffFileProcessor.php(65): NunoMaduro\PhpInsights\Domain\File->processWithTokenListenersAndFileInfo(Array, Object(Sym
fony\Component\Finder\SplFileInfo), false)
#5 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Application\Console\Commands\InternalProcessorCommand.php(170): NunoMaduro\PhpInsights\Domain\FileProcessors\SniffFileProcessor->processFile
(Object(Symfony\Component\Finder\SplFileInfo))
#6 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Application\Console\Commands\InternalProcessorCommand.php(86): NunoMaduro\PhpInsights\Application\Console\Commands\InternalProcessorCommand-

processFile(Object(Symfony\Component\Finder\SplFileInfo))
#7 [internal function]: NunoMaduro\PhpInsights\Application\Console\Commands\InternalProcessorCommand->__invoke(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Cons
oleOutput))
#8 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Application\Console\Commands\InvokableCommand.php(41): call_user_func(Object(NunoMaduro\PhpInsights\Application\Console\Commands\InternalPro
cessorCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 D:\laragon\www\blmp-api\vendor\symfony\console\Command\Command.php(326): NunoMaduro\PhpInsights\Application\Console\Commands\InvokableCommand->execute(Object(Symfony\Component\Console\Input\ArgvInpu
t), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 D:\laragon\www\blmp-api\vendor\symfony\console\Application.php(1078): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Cons
ole\Output\ConsoleOutput))
#11 D:\laragon\www\blmp-api\vendor\symfony\console\Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(NunoMaduro\PhpInsights\Application\Console\Commands\InvokableCommand)
, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 D:\laragon\www\blmp-api\vendor\symfony\console\Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console
\Output\ConsoleOutput))
#13 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\bin\phpinsights(42): Symfony\Component\Console\Application->run()
#14 D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\bin\phpinsights(43): {closure}()
#15 D:\laragon\www\blmp-api\vendor\bin\phpinsights(120): include('D:\laragon\www\...')
#16 {main}
thrown in D:\laragon\www\blmp-api\vendor\nunomaduro\phpinsights\src\Domain\File.php on line 129

@HenkPoley
Copy link

HenkPoley commented Apr 25, 2024

I'm seeing this same activeSniff & 'File has mixed ...', 1, 'Internal.LineEn...' backtrace on Laravel Framework 9.52.16

So outside of the special case Laravel Lumen.

Running it like ./vendor/bin/phpinsights analyse .\app\Http\Controllers\ still works. Probably given that line-endings are consistent in the Controllers directory.

Edit: Fixing all the line-ending using PhpStorm (or unix2dos/dos2unix I guess) made the error go away.

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

No branches or pull requests

2 participants