Zolotov Alexander hace 6 años
padre
commit
66d8fa8c8c
Se han modificado 2 ficheros con 5 adiciones y 1 borrados
  1. 4 1
      src/Tools/Generator.php
  2. 1 0
      tests/Unit/GeneratorTestCase.php

+ 4 - 1
src/Tools/Generator.php

@@ -53,7 +53,10 @@ class Generator
      */
     public function processRoute(Route $route, array $rulesToApply = [])
     {
-        $action = $route->getAction()['uses'];
+        $action = $route->getAction();
+        if (is_array($action) && array_key_exists('uses', $action)) {
+            $action = $action['uses'];
+        }
         list($class, $method) = is_array($action) ? $action : explode('@', $action);
         $controller = new ReflectionClass($class);
         $method = $controller->getMethod($method);

+ 1 - 0
tests/Unit/GeneratorTestCase.php

@@ -604,6 +604,7 @@ abstract class GeneratorTestCase extends TestCase
     public function can_use_arrays_in_routes_uses()
     {
         $route = $this->createRouteUsesArray('GET', '/api/array/test', 'withEndpointDescription');
+
         $parsed = $this->generator->processRoute($route);
 
         $this->assertSame('Example title.', $parsed['title']);