Skip to content

Commit

Permalink
Improve docblocks for generated constructors. (#3244)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrenssen authored and jmolivas committed Apr 3, 2017
1 parent 1fdc520 commit 4aa2530
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion templates/module/src/Command/command.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class {{ class_name }} extends Command {% endblock %}
{% if services is not empty %}

/**
* {@inheritdoc}
* Constructs a new {{ class_name }} object.
*/
public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
{{ serviceClassInitialization(services) }}
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Controller/controller.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class {{ class_name }} extends ControllerBase {% endblock %}
{% if services is not empty %}

/**
* {@inheritdoc}
* Constructs a new {{ class_name }} object.
*/
public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
{{ serviceClassInitialization(services) }}
Expand Down
3 changes: 3 additions & 0 deletions templates/module/src/Form/form-config.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class {{ class_name }} extends ConfigFormBase {% endblock %}
{% block class_construct %}
{% if services is not empty %}
/**
* Constructs a new {{ class_name }} object.
*/
public function __construct(
ConfigFactoryInterface $config_factory,
{{ servicesAsParameters(services)|join(',\n ') }}
Expand Down
3 changes: 3 additions & 0 deletions templates/module/src/Form/form.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class {{ class_name }} extends FormBase {% endblock %}
{% block class_construct %}
{% if services is not empty %}
/**
* Constructs a new {{ class_name }} object.
*/
public function __construct(
{{ servicesAsParameters(services)|join(',\n ') }}
) {
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/Block/block.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class {{class_name}} extends BlockBase {% if services is not empty %}implements
{% block class_construct %}
{% if services is not empty %}
/**
* Construct.
* Constructs a new {{class_name}} object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/Condition/condition.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function create(ContainerInterface $container, array $configuratio
}

/**
* Creates a new ExampleCondition instance.
* Creates a new {{ class_name }} object.
*
* @param array $configuration
* The plugin configuration, i.e. an array with configuration values keyed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class {{ class_name }} extends ImageFormatterBase implements ContainerFactoryPlu
protected $imageStyleStorage;

/**
* Constructs an ImageFormatter object.
* Constructs a new {{ class_name }} object.
*
* @param string $plugin_id
* The plugin_id for the formatter.
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/Mail/mail.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class {{class_name}} extends PhpMail {% if services is not empty %}implements Co
{% block class_construct %}
{% if services is not empty %}
/**
* Construct.
* Constructs a new {{class_name}} object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/Rest/Resource/rest.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class {{ class_name }} extends ResourceBase {% endblock %}
{% block class_construct %}

/**
* Constructs a Drupal\rest\Plugin\ResourceBase object.
* Constructs a new {{ class_name }} object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/Plugin/skeleton.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class {{class_name}} implements {% if plugin_interface is not empty %} {{ plugin
{% block class_construct %}
{% if services is not empty %}
/**
* Construct.
* Constructs a new {{class_name}} object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/TwigExtension/twig-extension.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class {{ class }} extends \Twig_Extension {% endblock %}
{% if services|length > 1 %}

/**
* Constructor.
* Constructs a new {{ class }} object.
*/
public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
parent::__construct($renderer);
Expand Down
4 changes: 2 additions & 2 deletions templates/module/src/cache-context.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class {{ class }} implements CacheContextInterface {% endblock %}
{% block class_construct %}

/**
* Constructor.
*/
* Constructs a new {{ class }} object.
*/
public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
{{ serviceClassInitialization(services) }}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/event-subscriber.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class {{ class }} implements EventSubscriberInterface {% endblock %}
{% block class_construct %}

/**
* Constructor.
* Constructs a new {{ class }} object.
*/
public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
{{ serviceClassInitialization(services) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class {{ class_name }}Manager extends DefaultPluginManager {% endblock %}
{% block class_methods %}

/**
* Constructor for {{ class_name }}Manager objects.
* Constructs a new {{ class_name }}Manager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/service.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Drupal\{{module}};{% endblock %}
class {{ class }}{% if(interface is defined and interface) %} implements {{ interface }}{% endif %} {% endblock %}
{% block class_construct %}
/**
* Constructor.
* Constructs a new {{ class }} object.
*/
public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
{{ serviceClassInitialization(services) }}
Expand Down
2 changes: 1 addition & 1 deletion templates/module/src/yaml-plugin-manager.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class {{ plugin_class }}Manager extends DefaultPluginManager implements {{ plugi
];

/**
* Constructs a {{ plugin_class }}Manager object.
* Constructs a new {{ plugin_class }}Manager object.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
Expand Down

0 comments on commit 4aa2530

Please sign in to comment.