mtrajano / laravel-swagger

Auto generates the swagger documentation of a laravel project based on best practices and simple assumptions
167 stars 71 forks source link

Argument 1 passed to Mtrajano\LaravelSwagger\Generator::getActionClassInstance() must be of the type string, object given, called in vendor/mtrajano/laravel-swagger/src/Generator.php on line 114 #9

Closed Daniyal-Javani closed 4 years ago

Daniyal-Javani commented 4 years ago

Thanks for your great project. When I run artisan laravel-swagger:generate get this error. can you please help me to solve this? I also ran compoer update. Laravel: 5.8 PHP: 7.3

Here is the full error:

   Symfony\Component\Debug\Exception\FatalThrowableError  : Argument 1 passed to Mtrajano\LaravelSwagger\Generator::getActionClassInstance() must be of the type string, object given, called in /var/www/isfahan-ahan.test/vendor/mtrajano/laravel-swagger/src/Generator.php on line 114

  at /var/www/isfahan-ahan.test/vendor/mtrajano/laravel-swagger/src/Generator.php:177
    173|                 return new Parameters\QueryParameterGenerator($rules);
    174|         }
    175|     }
    176| 
  > 177|     private function getActionClassInstance(string $action)
    178|     {
    179|         list($class, $method) = Str::parseCallback($action);
    180| 
    181|         return new ReflectionMethod($class, $method);

  Exception trace:

  1   Mtrajano\LaravelSwagger\Generator::getActionClassInstance(Object(Closure))
      /var/www/isfahan-ahan.test/vendor/mtrajano/laravel-swagger/src/Generator.php:114

  2   Mtrajano\LaravelSwagger\Generator::generatePath()
      /var/www/isfahan-ahan.test/vendor/mtrajano/laravel-swagger/src/Generator.php:58
mtrajano commented 4 years ago

Hi @Daniyal-Javani thank you for the issue, there was a bug introduced in a previous feature I released but it should be good now in v0.5.2, feel free to open the ticket again if you are still facing issues.