laravel / tinker

Powerful REPL for the Laravel framework.
https://laravel.com/docs/artisan#tinker
MIT License
7.33k stars 130 forks source link

Add support for laravel/framework < v5.4.17 #50

Closed StanAngeloff closed 6 years ago

StanAngeloff commented 6 years ago

This is my second attempt to address the issue (initially #48 was merged which broke Lumen installs unfortunately).

Requesting review by @GrahamCampbell

After the update to ServiceProviders, the basePath() function in Illuminate\Foundation\Application was extended to support an additional parameter $path. This was not documented nor updated in the contract. When attempting to use laravel/tinker on a laravel/framework installation prior to v5.4.17, the following exception is thrown:

[Symfony\Component\Debug\Exception\FatalErrorException]

Laravel\Tinker\ClassAliasAutoloader::__construct():
Failed opening required '/data/projects/project'
(include_path='.:/usr/share/php')

This commit reverts to the old basePath() behaviour without passing an argument and does the path construction within the TinkerCommand instead.

We cannot rely on the base_path() helper as it's not available in Lumen.