diff --git a/config/app.example.php b/config/app.example.php index 879f2740..a642664f 100644 --- a/config/app.example.php +++ b/config/app.example.php @@ -52,5 +52,6 @@ ], // If a custom directory should be used, defaults to TMP otherwise 'codeCompletionPath' => null, + 'codeCompletionReturnType' => null, // Auto-detect based on controller/component, set to true/false to force one mode. ], ]; diff --git a/src/CodeCompletion/Task/ControllerEventsTask.php b/src/CodeCompletion/Task/ControllerEventsTask.php index b96d79e9..d86388d3 100644 --- a/src/CodeCompletion/Task/ControllerEventsTask.php +++ b/src/CodeCompletion/Task/ControllerEventsTask.php @@ -2,6 +2,8 @@ namespace IdeHelper\CodeCompletion\Task; +use Cake\Core\Configure; + class ControllerEventsTask implements TaskInterface { /** @@ -20,26 +22,11 @@ public function type(): string { * @return string */ public function create(): string { - $events = <<<'TXT' - public function startup(EventInterface $event) { - return null; - } - public function beforeFilter(EventInterface $event) { - return null; - } - public function beforeRender(EventInterface $event) { - return null; - } - public function afterFilter(EventInterface $event) { - return null; - } - public function shutdown(EventInterface $event) { - return null; - } - public function beforeRedirect(EventInterface $event, $url, Response $response) { - return null; - } -TXT; + /** @var bool|null $returnType */ + $returnType = Configure::read('IdeHelper.codeCompletionReturnType'); + + $controllerEvents = $this->events($returnType ?? false); + $componentEvents = $this->events($returnType ?? true); return <<