Commit 36e0695d authored by willzyx's avatar willzyx

Coding standard

parent f7147f0d
......@@ -35,7 +35,7 @@ function devel_generate_entity_insert(EntityInterface $entity) {
if ($entity->getEntityTypeId() != 'node' || !isset($entity->devel_generate)) {
return;
}
/** @var \Drupal\node\NodeInterface $entity */
/* @var \Drupal\node\NodeInterface $entity */
$results = $entity->devel_generate;
if (!empty($results['max_comments'])) {
......
......@@ -165,10 +165,10 @@ function _drush_plugin_validate($params) {
if (!isset($instance_and_values[$plugin_id])) {
/** @var DevelGeneratePluginManager $manager */
/* @var DevelGeneratePluginManager $manager */
$manager = \Drupal::service('plugin.manager.develgenerate');
/** @var DevelGenerateBaseInterface $instance */
/* @var DevelGenerateBaseInterface $instance */
$instance = $manager->createInstance($plugin_id, array());
//Plugin instance suit params in order to fit for generateElements
......@@ -188,7 +188,7 @@ function drush_devel_generate() {
$plugin_id = array_shift($params);
$instance_and_values = drupal_static('drush_devel_generate_generate_validate');
/** @var DevelGenerateBaseInterface $instance */
/* @var DevelGenerateBaseInterface $instance */
$instance = $instance_and_values[$plugin_id]['instance'];
$values = $instance_and_values[$plugin_id]['values'];
$instance->generate($values);
......
......@@ -177,7 +177,7 @@ class DevelGenerateCommands extends DrushCommands {
$manager = $this->getManager();
$args = $commandData->input()->getArguments();
$commandName = array_shift($args);
/** @var DevelGenerateBaseInterface $instance */
/* @var DevelGenerateBaseInterface $instance */
$instance = $manager->createInstance($commandData->annotationData()->get('pluginId'), array());
$this->setPluginInstance($instance);
$parameters = $instance->validateDrushParams($args, $commandData->input()->getOptions());
......
......@@ -92,7 +92,7 @@ abstract class DevelGenerateBase extends PluginBase implements DevelGenerateBase
* The entity to be enriched with sample field values.
*/
public static function populateFields(EntityInterface $entity) {
/** @var \Drupal\field\FieldConfigInterface[] $instances */
/* @var \Drupal\field\FieldConfigInterface[] $instances */
$instances = entity_load_multiple_by_properties('field_config', array('entity_type' => $entity->getEntityType()->id(), 'bundle' => $entity->bundle()));
if ($skips = function_exists('drush_get_option') ? drush_get_option('skip-fields', '') : @$_REQUEST['skip-fields']) {
......
......@@ -20,4 +20,4 @@ use Drupal\Component\Render\MarkupTrait;
final class FilteredMarkup implements MarkupInterface, \Countable {
use MarkupTrait;
}
\ No newline at end of file
}
......@@ -101,7 +101,7 @@ class RouteSubscriber extends RouteSubscriberBase {
'_title' => 'Devel Render',
])
->addRequirements([
'_permission' => 'access devel information'
'_permission' => 'access devel information',
])
->setOption('_admin_route', TRUE)
->setOption('_devel_entity_type_id', $entity_type_id)
......@@ -132,7 +132,7 @@ class RouteSubscriber extends RouteSubscriberBase {
'_title' => 'Entity type definition',
])
->addRequirements([
'_permission' => 'access devel information'
'_permission' => 'access devel information',
])
->setOption('_admin_route', TRUE)
->setOption('_devel_entity_type_id', $entity_type_id)
......
......@@ -181,10 +181,10 @@ class Debug extends \Twig_Extension {
* Filters the Twig context variable.
*
* @param array $context
* The Twig context.
* The Twig context.
*
* @return array
* An array Twig context variables.
* An array Twig context variables.
*/
protected function getContextVariables(array $context) {
$context_variables = [];
......
......@@ -69,7 +69,7 @@ class DevelContainerInfoTest extends BrowserTestBase {
$this->assertNotNull($table);
// Ensures that the expected table headers are found.
/** @var $headers \Behat\Mink\Element\NodeElement[] */
/* @var $headers \Behat\Mink\Element\NodeElement[] */
$headers = $table->findAll('css', 'thead th');
$this->assertEquals(4, count($headers));
......@@ -105,7 +105,7 @@ class DevelContainerInfoTest extends BrowserTestBase {
$row = $table->find('css', sprintf('tbody tr:contains("%s")', $service_id));
$this->assertNotNull($row);
/** @var $cells \Behat\Mink\Element\NodeElement[] */
/* @var $cells \Behat\Mink\Element\NodeElement[] */
$cells = $row->findAll('css', 'td');
$this->assertEquals(4, count($cells));
......@@ -174,7 +174,7 @@ class DevelContainerInfoTest extends BrowserTestBase {
$this->assertNotNull($table);
// Ensures that the expected table headers are found.
/** @var $headers \Behat\Mink\Element\NodeElement[] */
/* @var $headers \Behat\Mink\Element\NodeElement[] */
$headers = $table->findAll('css', 'thead th');
$this->assertEquals(2, count($headers));
......@@ -202,7 +202,7 @@ class DevelContainerInfoTest extends BrowserTestBase {
$row = $table->find('css', sprintf('tbody tr:contains("%s")', $parameter_name));
$this->assertNotNull($row);
/** @var $cells \Behat\Mink\Element\NodeElement[] */
/* @var $cells \Behat\Mink\Element\NodeElement[] */
$cells = $row->findAll('css', 'td');
$this->assertEquals(2, count($cells));
......
......@@ -96,7 +96,7 @@ class DevelElementInfoTest extends BrowserTestBase {
$row = $table->find('css', sprintf('tbody tr:contains("%s")', $element_name));
$this->assertNotNull($row);
/** @var $cells \Behat\Mink\Element\NodeElement[] */
/* @var $cells \Behat\Mink\Element\NodeElement[] */
$cells = $row->findAll('css', 'td');
$this->assertEquals(4, count($cells));
......
......@@ -43,8 +43,8 @@ class DevelEntityTypeInfoTest extends BrowserTestBase {
*/
public function testEntityInfoMenuLink() {
$this->drupalPlaceBlock('system_menu_block:devel');
// Ensures that the entity type info link is present on the devel menu and that
// it points to the correct page.
// Ensures that the entity type info link is present on the devel menu and
// that it points to the correct page.
$this->drupalGet('');
$this->clickLink('Entity Info');
$this->assertSession()->statusCodeEquals(200);
......@@ -76,7 +76,8 @@ class DevelEntityTypeInfoTest extends BrowserTestBase {
}, $headers);
$this->assertSame($expected_headers, $actual_headers);
// Tests the presence of some (arbitrarily chosen) entity types in the table.
// Tests the presence of some (arbitrarily chosen) entity types in the
// table.
$expected_types = [
'date_format' => [
'name' => 'Date format',
......@@ -99,7 +100,7 @@ class DevelEntityTypeInfoTest extends BrowserTestBase {
$row = $table->find('css', sprintf('tbody tr:contains("%s")', $entity_type_id));
$this->assertNotNull($row);
/** @var $cells \Behat\Mink\Element\NodeElement[] */
/* @var $cells \Behat\Mink\Element\NodeElement[] */
$cells = $row->findAll('css', 'td');
$this->assertEquals(5, count($cells));
......
......@@ -67,7 +67,7 @@ class DevelEventInfoTest extends BrowserTestBase {
$this->assertNotNull($table);
// Ensures that the expected table headers are found.
/** @var $headers \Behat\Mink\Element\NodeElement[] */
/* @var $headers \Behat\Mink\Element\NodeElement[] */
$headers = $table->findAll('css', 'thead th');
$this->assertEquals(3, count($headers));
......@@ -100,14 +100,14 @@ class DevelEventInfoTest extends BrowserTestBase {
$this->assertEquals(1, count($event_header_row));
// Ensures that all the event listener are listed in the table.
/** @var $event_rows \Behat\Mink\Element\NodeElement[] */
/* @var $event_rows \Behat\Mink\Element\NodeElement[] */
$event_rows = $table->findAll('css', sprintf('tbody tr:contains("%s")', $event_name));
// Remove the header row.
array_shift($event_rows);
$this->assertEquals(count($listeners), count($event_rows));
foreach ($listeners as $index => $listener) {
/** @var $cells \Behat\Mink\Element\NodeElement[] */
/* @var $cells \Behat\Mink\Element\NodeElement[] */
$cells = $event_rows[$index]->findAll('css', 'td');
$this->assertEquals(3, count($cells));
......
......@@ -70,7 +70,7 @@ class DevelLayoutInfoTest extends BrowserTestBase {
$this->assertNotNull($table);
// Ensures that the expected table headers are found.
/** @var $headers \Behat\Mink\Element\NodeElement[] */
/* @var $headers \Behat\Mink\Element\NodeElement[] */
$headers = $table->findAll('css', 'thead th');
$this->assertEquals(6, count($headers));
......
......@@ -52,7 +52,7 @@ class DevelRouteInfoTest extends BrowserTestBase {
$page = $this->getSession()->getPage();
// Ensures that the expected table headers are found.
/** @var $headers \Behat\Mink\Element\NodeElement[] */
/* @var $headers \Behat\Mink\Element\NodeElement[] */
$headers = $page->findAll('css', 'table.devel-route-list thead th');
$this->assertEquals(4, count($headers));
......@@ -94,7 +94,7 @@ class DevelRouteInfoTest extends BrowserTestBase {
$row = $page->find('css', sprintf('table.devel-route-list tbody tr:contains("%s")', $route_name));
$this->assertNotNull($row);
/** @var $cells \Behat\Mink\Element\NodeElement[] */
/* @var $cells \Behat\Mink\Element\NodeElement[] */
$cells = $row->findAll('css', 'td');
$this->assertEquals(4, count($cells));
......
......@@ -36,7 +36,7 @@ class DevelEnforcedDependenciesTest extends KernelTestBase {
* Tests devel menu enforced dependencies.
*/
public function testMenuEnforcedDependencies() {
/** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
/* @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
$config_manager = $this->container->get('config.manager');
// Ensure that the Devel menu has explicit enforced dependencies on devel
......
......@@ -78,7 +78,7 @@ class DevelTwigExtensionTest extends KernelTestBase {
* Tests that the Twig dump functions are registered properly.
*/
public function testDumpFunctionsRegistered() {
/** @var \Twig_SimpleFunction[] $functions */
/* @var \Twig_SimpleFunction[] $functions */
$functions = \Drupal::service('twig')->getFunctions();
$dump_functions = ['devel_dump', 'kpr'];
......@@ -107,7 +107,7 @@ class DevelTwigExtensionTest extends KernelTestBase {
* Tests that the Twig function for XDebug integration is registered properly.
*/
public function testXDebugIntegrationFunctionsRegistered() {
/** @var \Twig_SimpleFunction $function */
/* @var \Twig_SimpleFunction $function */
$function = \Drupal::service('twig')->getFunction('devel_breakpoint');
$this->assertTrue($function instanceof \Twig_SimpleFunction);
$this->assertEquals($function->getName(), 'devel_breakpoint');
......@@ -134,7 +134,7 @@ class DevelTwigExtensionTest extends KernelTestBase {
'twig_object' => new \stdClass(),
];
/** @var \Drupal\Core\Template\TwigEnvironment $environment */
/* @var \Drupal\Core\Template\TwigEnvironment $environment */
$environment = \Drupal::service('twig');
// Ensures that the twig extension does nothing if the current
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment