From 02a449b3f2bc4adc955b32d0b73307f7e6b3f607 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Fri, 4 Oct 2024 13:27:34 +0200 Subject: [PATCH] add note to remove method hooks in generated template if not needed --- templates/bake/Plugin/src/Plugin.php.twig | 5 +++++ .../comparisons/Plugin/Company/Example/src/ExamplePlugin.php | 5 +++++ .../Plugin/SimpleExample/src/SimpleExamplePlugin.php | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/templates/bake/Plugin/src/Plugin.php.twig b/templates/bake/Plugin/src/Plugin.php.twig index a7d1575a..2892c840 100644 --- a/templates/bake/Plugin/src/Plugin.php.twig +++ b/templates/bake/Plugin/src/Plugin.php.twig @@ -41,6 +41,7 @@ class {{ name }}Plugin extends BasePlugin */ public function bootstrap(PluginApplicationInterface $app): void { + // remove this method hook if you don't need it } /** @@ -54,6 +55,7 @@ class {{ name }}Plugin extends BasePlugin */ public function routes(RouteBuilder $routes): void { + // remove this method hook if you don't need it $routes->plugin( '{{ plugin }}', ['path' => '/{{ routePath }}'], @@ -75,6 +77,7 @@ class {{ name }}Plugin extends BasePlugin public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue { // Add your middlewares here + // remove this method hook if you don't need it return $middlewareQueue; } @@ -88,6 +91,7 @@ class {{ name }}Plugin extends BasePlugin public function console(CommandCollection $commands): CommandCollection { // Add your commands here + // remove this method hook if you don't need it $commands = parent::console($commands); @@ -104,5 +108,6 @@ class {{ name }}Plugin extends BasePlugin public function services(ContainerInterface $container): void { // Add your services here + // remove this method hook if you don't need it } } diff --git a/tests/comparisons/Plugin/Company/Example/src/ExamplePlugin.php b/tests/comparisons/Plugin/Company/Example/src/ExamplePlugin.php index 1d947085..ac42bb1a 100644 --- a/tests/comparisons/Plugin/Company/Example/src/ExamplePlugin.php +++ b/tests/comparisons/Plugin/Company/Example/src/ExamplePlugin.php @@ -26,6 +26,7 @@ class ExamplePlugin extends BasePlugin */ public function bootstrap(PluginApplicationInterface $app): void { + // remove this method hook if you don't need it } /** @@ -39,6 +40,7 @@ public function bootstrap(PluginApplicationInterface $app): void */ public function routes(RouteBuilder $routes): void { + // remove this method hook if you don't need it $routes->plugin( 'Company/Example', ['path' => '/company/example'], @@ -60,6 +62,7 @@ function (RouteBuilder $builder) { public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue { // Add your middlewares here + // remove this method hook if you don't need it return $middlewareQueue; } @@ -73,6 +76,7 @@ public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue public function console(CommandCollection $commands): CommandCollection { // Add your commands here + // remove this method hook if you don't need it $commands = parent::console($commands); @@ -89,5 +93,6 @@ public function console(CommandCollection $commands): CommandCollection public function services(ContainerInterface $container): void { // Add your services here + // remove this method hook if you don't need it } } diff --git a/tests/comparisons/Plugin/SimpleExample/src/SimpleExamplePlugin.php b/tests/comparisons/Plugin/SimpleExample/src/SimpleExamplePlugin.php index 45bbf490..525f3b8a 100644 --- a/tests/comparisons/Plugin/SimpleExample/src/SimpleExamplePlugin.php +++ b/tests/comparisons/Plugin/SimpleExample/src/SimpleExamplePlugin.php @@ -26,6 +26,7 @@ class SimpleExamplePlugin extends BasePlugin */ public function bootstrap(PluginApplicationInterface $app): void { + // remove this method hook if you don't need it } /** @@ -39,6 +40,7 @@ public function bootstrap(PluginApplicationInterface $app): void */ public function routes(RouteBuilder $routes): void { + // remove this method hook if you don't need it $routes->plugin( 'SimpleExample', ['path' => '/simple-example'], @@ -60,6 +62,7 @@ function (RouteBuilder $builder) { public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue { // Add your middlewares here + // remove this method hook if you don't need it return $middlewareQueue; } @@ -73,6 +76,7 @@ public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue public function console(CommandCollection $commands): CommandCollection { // Add your commands here + // remove this method hook if you don't need it $commands = parent::console($commands); @@ -89,5 +93,6 @@ public function console(CommandCollection $commands): CommandCollection public function services(ContainerInterface $container): void { // Add your services here + // remove this method hook if you don't need it } }