From b388508f13290eee3ce4379c81b789ffda9eacc8 Mon Sep 17 00:00:00 2001 From: Chi Date: Sun, 13 Dec 2020 15:13:03 +0000 Subject: [PATCH] Fixed code style issues --- src/TwigExtension.php | 10 +++++----- tests/src/Kernel/AccessTest.php | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/TwigExtension.php b/src/TwigExtension.php index 01b6a99..d61d37b 100644 --- a/src/TwigExtension.php +++ b/src/TwigExtension.php @@ -536,7 +536,7 @@ class TwigExtension extends AbstractExtension { ->addCacheTags($entity_type->getListCacheTags()) ->addCacheContexts($entity_type->getListCacheContexts()); - /* @var $blocks \Drupal\block\BlockInterface[] */ + /** @var \Drupal\block\BlockInterface[] $blocks */ foreach ($blocks as $id => $block) { $access = $block->access('view', NULL, TRUE); $cache_metadata = $cache_metadata->merge(CacheableMetadata::createFromObject($access)); @@ -1054,7 +1054,7 @@ class TwigExtension extends AbstractExtension { * in an tag. Requesting the URL will cause the image to be created. */ public function imageStyle($path, $style) { - + // @phpcs:ignore DrupalPractice.Objects.GlobalClass.GlobalClass if (!$image_style = ImageStyle::load($style)) { trigger_error(sprintf('Could not load image style %s.', $style)); return; @@ -1336,17 +1336,17 @@ class TwigExtension extends AbstractExtension { /** * Returns the translation for the given entity. * - * @param object $entity + * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to get the translation from. - * * @param string $langcode * (optional) For which language the translation should be looked for, * defaults to the current language context. * - * @return EntityInterface + * @return \Drupal\Core\Entity\EntityInterface * The appropriate translation for the given language context. */ public function entityTranslation(EntityInterface $entity, $langcode = NULL) { return \Drupal::service('entity.repository')->getTranslationFromContext($entity, $langcode); } + } diff --git a/tests/src/Kernel/AccessTest.php b/tests/src/Kernel/AccessTest.php index a8456a9..08332d5 100644 --- a/tests/src/Kernel/AccessTest.php +++ b/tests/src/Kernel/AccessTest.php @@ -270,7 +270,10 @@ class AccessTest extends KernelTestBase { self::assertSame($expected_cache, $build['#cache']); // -- Privileged user with access check. - $this->setUpCurrentUser(['name' => 'User 2'], ['access content', 'create article content']); + $this->setUpCurrentUser( + ['name' => 'User 2'], + ['access content', 'create article content'], + ); $build = $this->twigExtension->drupalEntityForm('node', NULL, 'default', $node_values); self::assertArrayHasKey('form_id', $build);