Search code examples
phplaravelsymfonytinker

Laravel Tinker Error: Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined method Psy\Configuration::getLoop()


I am trying to run php artisan tinker on my project and get this error:

Symfony\Component\Debug\Exception\FatalThrowableError  : Call to undefined method Psy\Configuration::getLoop()

  at /var/www/[my_project]/vendor/psy/psysh/src/Psy/Shell.php:80
    76|     public function __construct(Configuration $config = null)
    77|     {
    78|         $this->config   = $config ?: new Configuration();
    79|         $this->cleaner  = $this->config->getCodeCleaner();
  > 80|         $this->loop     = $this->config->getLoop();
    81|         $this->context  = new Context();
    82|         $this->includes = array();
    83|         $this->readline = $this->config->getReadline();
    84|         $this->inputBuffer = array();

As you see the problem is on line 80. I think I must mention that I once used Throwable and FatalThrowableError in one of my controllers to get the Exception because the general Exception could not get the Exception I was getting! I handled that throwable error another way and was able to get that Exception by Exception itself! Anyway, I have not used Throwable or FatalThrowableError anywhere in my code anymore, but I still get the aforementioned error.

How can I get php artisan tinker work again? I think the problem is somehow related to the composer.


Solution

  • I just deleted my vendor folder manually, and tried running composer install. By doing this, the php artisan tinker command worked properly again. This might not be the right solution, but anyway, it works again. Maybe just deleting vendor/psy folder and running composer install would do the same.