Skip to content

Commit

Permalink
ACMS-4373: Revert static code analysis as per ORCA.
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshreeputra committed Dec 27, 2024
1 parent 8055761 commit 274727c
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 23 deletions.
5 changes: 2 additions & 3 deletions modules/acquia_cms_toolbar/acquia_cms_toolbar.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
*/

use Acquia\DrupalEnvironmentDetector\AcquiaDrupalEnvironmentDetector as Environment;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
use Drupal\acquia_cms_toolbar\EntityOperations\PermissionManager;
use Drupal\Core\Url;
use Drupal\user\RoleInterface;

/**
Expand Down Expand Up @@ -107,7 +106,7 @@ function _acquia_cms_toolbar_get_environment_indicator_color_config(): array {
* Implements hook_entity_insert().
*/
function acquia_cms_toolbar_user_role_insert(RoleInterface $role) {
if(!$role->isSyncing()) {
if (!$role->isSyncing()) {
$class_resolver = \Drupal::service('class_resolver');
$class_resolver->getInstanceFromDefinition(PermissionManager::class)
->grantPermissionToRoles([$role->id()]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function create(ContainerInterface $container) {
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function grantPermissionToRoles(array $role_ids = NULL): void {
public function grantPermissionToRoles(?array $role_ids = NULL): void {
$roles = $this->entityTypeManager->getStorage('user_role')->loadMultiple($role_ids ?? [
'content_administrator',
'content_author',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PermissionsTest extends BrowserTestBase {
* {@inheritdoc}
*/
protected static $modules = [
'acquia_cms_toolbar'
'acquia_cms_toolbar',
];

/**
Expand All @@ -38,7 +38,7 @@ class PermissionsTest extends BrowserTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->drupalCreateRole([],'content_administrator');
$this->drupalCreateRole([], 'content_administrator');
$this->entityTypeManager = $this->container->get("entity_type.manager");
}

Expand Down
2 changes: 1 addition & 1 deletion modules/acquia_cms_tour/acquia_cms_tour.install
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Drupal\user\Entity\Role;
function acquia_cms_tour_install($is_syncing) {
if (!$is_syncing) {
$role = \Drupal::entityTypeManager()->getStorage('user_role')->load('content_administrator');
if($role) {
if ($role) {
$role->grantPermission('access acquia cms tour dashboard')->trustData()->save();
}
}
Expand Down
3 changes: 1 addition & 2 deletions modules/acquia_cms_tour/acquia_cms_tour.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Contains hook implementations for the acquia_cms_tour module.
*/

use Drupal\Core\Entity\EntityInterface;
use Drupal\user\RoleInterface;

/**
Expand Down Expand Up @@ -61,7 +60,7 @@ function acquia_cms_tour_modules_uninstalled(array $modules) {
* Implements hook_cms_tour_entity_insert().
*/
function acquia_cms_tour_user_role_insert(RoleInterface $role) {
if(!$role->isSyncing() &&
if (!$role->isSyncing() &&
$role->id() == 'content_administrator'
) {
$role = \Drupal::entityTypeManager()->getStorage('user_role')->load('content_administrator');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Drupal\acquia_cms_tour\Controller;

use Drupal\acquia_cms_tour\AcquiaCmsTourManager;
use Drupal\acquia_cms_tour\Services\StarterKitService;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\Url;
use Drupal\acquia_cms_tour\AcquiaCmsTourManager;
use Drupal\acquia_cms_tour\Services\StarterKitService;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract class AcquiaCmsDashboardBase extends ConfigFormBase implements AcquiaDa
* @param \Drupal\Core\Extension\InfoParserInterface $info_parser
* The info file parser.
* @param \Drupal\Core\Extension\ModuleExtensionList $module_handler
* The module list.
* The module list.
*/
public function __construct(StateInterface $state, ModuleHandlerInterface $module_handler, LinkGeneratorInterface $link_generator, InfoParserInterface $info_parser, ModuleExtensionList $module_list) {
$this->state = $state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Drupal\acquia_cms_tour\Form;

use Drupal\acquia_cms_tour\AcquiaCmsTourManager;
use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Renderer;
use Drupal\Core\State\StateInterface;
use Drupal\acquia_cms_tour\AcquiaCmsTourManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Drupal\acquia_cms_tour\Form;

use Drupal\acquia_cms_tour\AcquiaCmsStarterKitManager;
use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Renderer;
use Drupal\Core\State\StateInterface;
use Drupal\acquia_cms_tour\AcquiaCmsStarterKitManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsStarterKit;

use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsStarterKit;

use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsTour;

use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase;
use Drupal\geocoder\GeocoderProviderInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsTour;

use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase;
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase;
use Drupal\google_tag\Entity\TagContainer;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsTour;

use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase;

/**
* Plugin implementation of the acquia_cms_tour.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\Tests\acquia_cms_tour\Functional;

use Drupal\Tests\BrowserTestBase;
use Drupal\geocoder\Entity\GeocoderProvider;
use Drupal\Tests\BrowserTestBase;

/**
* Tests the Acquia CMS Tour module's integration with Geocoder & Google Maps.
Expand Down Expand Up @@ -96,7 +96,6 @@ public function testGeocoderGoogleMaps() {
$this->assertSame($cohesion_map_key, $dummy_key);
}


$configuration = GeocoderProvider::load('googlemaps')->get('configuration');
$this->assertSame($configuration['apiKey'], $dummy_key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PermissionsTest extends BrowserTestBase {
* {@inheritdoc}
*/
protected static $modules = [
'acquia_cms_tour'
'acquia_cms_tour',
];

/**
Expand All @@ -37,7 +37,7 @@ class PermissionsTest extends BrowserTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->drupalCreateRole([],'content_administrator');
$this->drupalCreateRole([], 'content_administrator');
$this->entityTypeManager = $this->container->get("entity_type.manager");
}

Expand Down

0 comments on commit 274727c

Please sign in to comment.