From 62751a9974ddb1db2864fd6f3c0b567d524a99f8 Mon Sep 17 00:00:00 2001 From: Oliver Davies <oliver@oliverdavies.dev> Date: Wed, 31 May 2023 13:48:52 +0100 Subject: [PATCH] feat(phpactor): override the default template Make classes final and enable strict types by default. Refs: #41 --- config/phpactor/phpactor.yml | 1 + config/phpactor/templates/default/SourceCode.php.twig | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 config/phpactor/templates/default/SourceCode.php.twig diff --git a/config/phpactor/phpactor.yml b/config/phpactor/phpactor.yml index 9b11d77b..536f4083 100644 --- a/config/phpactor/phpactor.yml +++ b/config/phpactor/phpactor.yml @@ -1,4 +1,5 @@ code_transform.class_new.variants: + default: default drupal-functional-test: drupal-functional-test drupal-kernel-test: drupal-kernel-test drupal-unit-test: drupal-unit-test diff --git a/config/phpactor/templates/default/SourceCode.php.twig b/config/phpactor/templates/default/SourceCode.php.twig new file mode 100644 index 00000000..86de1d9f --- /dev/null +++ b/config/phpactor/templates/default/SourceCode.php.twig @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace {{ prototype.namespace }}; + +{% for class in prototype.classes %} +final class {{ class.name }} { +} +{% endfor %}