Description
I'm sure this an extreme edge case, but oh well. This is a new issue since updating to v0.10.0. Previously this did not occur.
The following package generates metadata for use with PHPstorm to better integrate with Laravel development. Among other things, this makes all of the weird hacky Laravel features like alias work with the IDE.
https://github.com/barryvdh/laravel-ide-helper
If the command "php artisan ide-help:meta" is run, during the process it throws this error:
[2017-08-13 23:03:21] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function getDocument() on null in /home/vagrant/Code/hoistway-cms/vendor/cloudcreativity/laravel-json-api/src/ServiceProvider.php:218
Stack trace:
#0 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Container/Container.php(726): CloudCreativity\LaravelJsonApi\ServiceProvider->CloudCreativity\LaravelJsonApi\{closure}(Object(Illuminate\Foundation\Application), Array)
#1 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build(Object(Closure))
#2 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('CloudCreativity...')
#3 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('CloudCreativity...')
#4 /home/vagrant/Code/hoistway-cms/vendor/barryvdh/laravel-ide-helper/src/Console/MetaCommand.php(82): Illuminate\Foundation\Application->make('CloudCreativity...')
#5 [internal function]: Barryvdh\LaravelIdeHelper\Console\MetaCommand->fire()
#6 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#7 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#8 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#9 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#10 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#11 /home/vagrant/Code/hoistway-cms/vendor/symfony/console/Command/Command.php(264): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#12 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Console/Command.php(167): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#13 /home/vagrant/Code/hoistway-cms/vendor/symfony/console/Application.php(874): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /home/vagrant/Code/hoistway-cms/vendor/symfony/console/Application.php(228): Symfony\Component\Console\Application->doRunCommand(Object(Barryvdh\LaravelIdeHelper\Console\MetaCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /home/vagrant/Code/hoistway-cms/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /home/vagrant/Code/hoistway-cms/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /home/vagrant/Code/hoistway-cms/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 {main}
The source of the error is here:
laravel-json-api/src/ServiceProvider.php
Line 218 in eb2dd6d
From what I can tell, the function 'json_api_request()' returns null when there is no inbound HTTP request. By whatever means ide-helper ends up parsing the laravel-json-api package, it ends up invoking this function, which returns null, so that the attempt to access the "getDocument()" method on null throws an error - notably not the custom error intended by this code snippet.
Otherwise the live server runs fine and there's no concern for production, but since ide-helper suddenly doesn't work anymore on account of this change I would just like to report it.