Skip to content

Commit 918a883

Browse files
hjuarez20enzolutions
authored andcommitted
4071 command coding standard (#4074)
* [update:execute] Fixed update table * Revert "Merge remote-tracking branch 'upstream/master'" This reverts commit ddf7739, reversing changes made to a95b7e6. * [generate:command] Added the coding standard
1 parent 46fb9eb commit 918a883

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

templates/module/src/Command/command.php.twig

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ use Drupal\Console\Core\Command\ContainerAwareCommand;
1616
{% else %}
1717
use Drupal\Console\Core\Command\Command;
1818
{% endif %}
19-
use Drupal\Console\Annotations\DrupalCommand;
2019
{% endblock %}
2120

2221
{% block class_declaration %}
2322
/**
2423
* Class {{ class_name }}.
2524
*
26-
* @DrupalCommand (
25+
* Drupal\Console\Annotations\DrupalCommand (
2726
* extension="{{extension}}",
2827
* extensionType="{{ extension_type }}"
2928
* )
@@ -39,6 +38,7 @@ class {{ class_name }} extends {% if container_aware %}ContainerAwareCommand{% e
3938
{{ serviceClassInitialization(services) }}
4039
parent::__construct();
4140
}
41+
4242
{% endif %}
4343
{% endblock %}
4444

@@ -53,19 +53,19 @@ class {{ class_name }} extends {% if container_aware %}ContainerAwareCommand{% e
5353
}
5454

5555
{% if initialize %}
56-
/**
57-
* {@inheritdoc}
58-
*/
56+
/**
57+
* {@inheritdoc}
58+
*/
5959
protected function initialize(InputInterface $input, OutputInterface $output) {
6060
parent::initialize($input, $output);
6161
$this->getIo()->info('initialize');
6262
}
6363

6464
{% endif %}
6565
{% if interact %}
66-
/**
67-
* {@inheritdoc}
68-
*/
66+
/**
67+
* {@inheritdoc}
68+
*/
6969
protected function interact(InputInterface $input, OutputInterface $output) {
7070
$this->getIo()->info('interact');
7171
}
@@ -81,5 +81,4 @@ class {{ class_name }} extends {% if container_aware %}ContainerAwareCommand{% e
8181
$this->generator->generate([]);
8282
{% endif %}
8383
}
84-
85-
{%- endblock -%}
84+
{% endblock %}

templates/module/src/Command/console/translations/en/command.yml.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ description: 'Drupal Console generated command.'
22
options: {}
33
arguments: {}
44
messages:
5-
success: 'I am a new generated command.'
5+
success: 'I am a new generated command.'

templates/module/src/Generator/generator.php.twig

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,22 @@ use Drupal\Console\Core\Generator\GeneratorInterface;
1515

1616
{% block class_declaration %}
1717
/**
18-
* Class {{ class_name }}
18+
* Class {{ class_name }}.
1919
*
2020
* @package Drupal\Console\Generator
2121
*/
22-
class {{ class_name }} extends Generator implements GeneratorInterface
23-
{% endblock %}
22+
class {{ class_name }} extends Generator implements GeneratorInterface {% endblock %}
2423

2524
{% block class_methods %}
2625
/**
2726
* {@inheritdoc}
2827
*/
29-
public function generate(array $parameters)
30-
{
31-
// Example how to render a twig template using the renderFile method
32-
// $this->renderFile(
33-
// 'path/to/file.php.twig',
34-
// 'path/to/file.php',
35-
// $parameters
36-
// );
28+
public function generate(array $parameters) {
29+
// Example how to render a twig template using the renderFile method
30+
// $this->renderFile(
31+
// 'path/to/file.php.twig',
32+
// 'path/to/file.php',
33+
// $parameters
34+
// );.
3735
}
3836
{% endblock %}

0 commit comments

Comments
 (0)