Skip to content

Commit

Permalink
Ref #121: Update templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-teck committed Feb 23, 2024
1 parent b07b87b commit b66b355
Show file tree
Hide file tree
Showing 282 changed files with 863 additions and 297 deletions.
4 changes: 3 additions & 1 deletion bin/dcg
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env php
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

use DrupalCodeGenerator\Application;
use DrupalCodeGenerator\BootstrapHandler;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Entity/EntityBundleClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected function generate(array &$vars, AssetCollection $assets): void {

// @todo Handle duplicated hooks.
$assets->addFile('{machine_name}.module', 'module.twig')
->appendIfExists(7);
->appendIfExists(9);
}

}
2 changes: 1 addition & 1 deletion src/Command/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function generate(array &$vars, AssetCollection $assets): void {

$assets->addFile('{machine_name}.{file_type}')
->inlineTemplate($hook_templates[$vars['hook_name']])
->appendIfExists(7);
->appendIfExists(9);
}

}
2 changes: 1 addition & 1 deletion src/Command/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function generate(array &$vars, Assets $assets): void {
if ($vars['create_theme'] || $vars['create_preprocess']) {
$assets->addFile('{machine_name}.module')
->template('module.twig')
->appendIfExists(7);
->appendIfExists(9);
}
}

Expand Down
26 changes: 14 additions & 12 deletions src/Helper/Drupal/HookInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,20 @@ private static function buildHookTemplate(string $hook_name, string $hook_code):

$file_description = self::getFileDescription(self::getFileType($hook_name));
return <<< TWIG
<?php declare(strict_types = 1);
/**
* @file
* $file_description
*/
/**
* Implements hook_$hook_name().
*/
$hook_template
TWIG;
<?php
declare(strict_types=1);
/**
* @file
* $file_description
*/
/**
* Implements hook_$hook_name().
*/
$hook_template
TWIG;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion templates/Drush/_generator/generator.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Generator;

Expand Down
4 changes: 3 additions & 1 deletion templates/Drush/_generator/template.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% verbatim %}<?php declare(strict_types = 1);
{% verbatim %}<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }};

Expand Down
4 changes: 3 additions & 1 deletion templates/Drush/_symfony-command/command.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Command;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Entity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Form;

Expand Down
4 changes: 3 additions & 1 deletion templates/Entity/_content-entity/model.module.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

/**
* @file
Expand Down
4 changes: 3 additions & 1 deletion templates/Entity/_content-entity/src/Entity/Example.php.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Entity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Entity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Form;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Form;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Form;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Routing;

Expand Down
4 changes: 3 additions & 1 deletion templates/Entity/_entity-bundle-class/bundle-base-class.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace {{ namespace }};

Expand Down
4 changes: 3 additions & 1 deletion templates/Entity/_entity-bundle-class/bundle-class.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace {{ namespace }};
{% if not base_class %}
Expand Down
4 changes: 3 additions & 1 deletion templates/Entity/_entity-bundle-class/module.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

/**
* @file
Expand Down
4 changes: 3 additions & 1 deletion templates/Form/_config/form.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Form;

Expand Down
4 changes: 3 additions & 1 deletion templates/Form/_confirm/form.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Form;

Expand Down
4 changes: 3 additions & 1 deletion templates/Form/_simple/form.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Form;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Field/_formatter/formatter.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Field\FieldFormatter;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Field/_type/type.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Field\FieldType;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Field/_widget/widget.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Field\FieldWidget;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Migrate/_destination/destination.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\migrate\destination;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Migrate/_process/process.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\migrate\process;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Migrate/_source/source.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\migrate\source;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\views\argument_default;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Views/_field/field.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\views\field;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/Views/_style/style.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\views\style;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/_action/action.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Action;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/_block/block.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Block;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/_condition/condition.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Condition;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/_constraint/constraint.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Validation\Constraint;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/_constraint/validator.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Validation\Constraint;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\EntityReferenceSelection;

Expand Down
4 changes: 3 additions & 1 deletion templates/Plugin/_filter/filter.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% import '@lib/di.twig' as di %}
<?php declare(strict_types = 1);
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Plugin\Filter;

Expand Down
Loading

0 comments on commit b66b355

Please sign in to comment.