Skip to content

Commit

Permalink
Code style fixes according to PHPCBF.
Browse files Browse the repository at this point in the history
  • Loading branch information
pingers committed Oct 7, 2024
1 parent d698205 commit a0d1c75
Show file tree
Hide file tree
Showing 29 changed files with 93 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Drupal\shp_backup\Controller;

use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\shp_backup\Service\Backup;
use Drupal\shp_custom\Service\Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getFormId() {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $site = NULL, $backupName = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $site = NULL, $backupName = NULL) {
$form_state->set('site', $site->id());
$backup = $this->orchestrationProvider->getBackup($site->id(), $backupName);
if (!$backup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getFormId() {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $site = NULL, $backupName = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $site = NULL, $backupName = NULL) {
$form_state->set('site', $site->id());
$backup = $this->orchestrationProvider->getBackup($site->id(), $backupName);
if (!$backup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getPageTitle(NodeInterface $site, NodeInterface $environment) {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $site = NULL, NodeInterface $environment = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $site = NULL, ?NodeInterface $environment = NULL) {
$form_state->set('site', $site);
$form_state->set('environment', $environment);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getPageTitle(NodeInterface $site, NodeInterface $environment) {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $site = NULL, NodeInterface $environment = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $site = NULL, ?NodeInterface $environment = NULL) {
$form_state->set('site', $site);
$form_state->set('environment', $environment);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function getPageTitle(NodeInterface $site, NodeInterface $environment) {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $site = NULL, NodeInterface $environment = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $site = NULL, ?NodeInterface $environment = NULL) {
$form_state->set('site', $site);
$form_state->set('environment', $environment);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static function create(ContainerInterface $container, array $configuratio
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
return $object->access('update', $account, $return_as_object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function create(ContainerInterface $container, array $configuratio
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
return $object->access('update', $account, $return_as_object);
}

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

namespace Drupal\shp_cache_backend\Plugin;

use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;

/**
* Provides the CacheBackend plugin manager.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;
use Drupal\node\NodeStorageInterface;
use Drupal\shp_cache_backend\Plugin\CacheBackend\MemcachedDatagrid;
use Drupal\shp_custom\Service\EnvironmentType;
use Drupal\shp_service_accounts\Entity\ServiceAccount;
use Drupal\shp_service_accounts\Service\ServiceAccountsInterface;
use Drupal\Tests\UnitTestCase;
use UniversityOfAdelaide\OpenShift\Client;
use UniversityOfAdelaide\OpenShift\Objects\ConfigMap;
use UniversityOfAdelaide\OpenShift\Objects\NetworkPolicy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Drupal\shp_content_types\Breadcrumb;

use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\node\Entity\Node;

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

namespace Drupal\shp_custom\Controller;

use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\node\NodeInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Component\Plugin\PluginManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
* Provides JSON responses for site environment(s).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getPageTitle() {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $site = NULL, NodeInterface $environment = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $site = NULL, ?NodeInterface $environment = NULL) {
$form_state->set('site', $site);
$form_state->set('environment', $environment);

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

namespace Drupal\shp_custom\Plugin\Menu\LocalAction;

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\group\Plugin\Menu\LocalAction\WithDestination;
use Drupal\node\Entity\Node;
use Drupal\Core\Routing\RouteMatchInterface;

/**
* Defines a local action plugin with a dynamic title.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\shp_custom\Plugin\views\field;

use Drupal\shp_orchestration\Service\Status;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\shp_orchestration\Service\Status;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ class Environment {
* @param \Drupal\shp_custom\Service\Site $site
* Site service.
*/
public function __construct(RequestStack $requestStack,
EntityTypeManagerInterface $entityTypeManager,
AccountProxyInterface $currentUser,
Site $site) {
public function __construct(
RequestStack $requestStack,
EntityTypeManagerInterface $entityTypeManager,
AccountProxyInterface $currentUser,
Site $site,
) {
$this->requestStack = $requestStack;
$this->entityTypeManager = $entityTypeManager;
$this->currentRequest = $this->requestStack->getCurrentRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\Tests\shp_custom\Unit;

use Drupal\shp_custom\Service\StringGenerator;
use Drupal\Tests\UnitTestCase;
use Drupal\shp_custom\Service\StringGenerator;

/**
* Tests the RandomString service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\Tests\shp_custom\Unit;

use Drupal\shp_custom\Plugin\views\field\SiteEnvironmentStatus;
use Drupal\Tests\UnitTestCase;
use Drupal\shp_custom\Plugin\views\field\SiteEnvironmentStatus;

/**
* Tests the ActiveJobManagerService class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(
ConfigFactoryInterface $configFactory,
OrchestrationProviderPluginManagerInterface $orchestrationProviderPluginManager,
Environment $environmentService,
StringGenerator $stringGenerator
StringGenerator $stringGenerator,
) {
$this->configFactory = $configFactory;
$this->orchestrationProviderPlugin = $orchestrationProviderPluginManager->getProviderInstance();
Expand Down Expand Up @@ -153,7 +153,7 @@ public function setSecret(
string $database,
string $username,
string $password,
string $deployment_name
string $deployment_name,
) {
// Add database credentials to deployment secret.
// Create the secret if it doesn't exist, otherwise add it to the existing.
Expand Down Expand Up @@ -238,7 +238,7 @@ public function createUser(
string $username,
string $password,
\mysqli $db,
string $options = ''
string $options = '',
): bool {
$query = sprintf(
"GRANT ALL PRIVILEGES ON `%s`.* TO `%s`@`%%` IDENTIFIED BY '%s'",
Expand Down Expand Up @@ -271,7 +271,7 @@ public function createUser(
*/
public function dropUser(
string $username,
\mysqli $db
\mysqli $db,
): bool {
$query = sprintf(
"DROP USER `%s`@`%%`",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace Drupal\Tests\shp_database_provisioner\Unit;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\shp_custom\Service\Environment;
use Drupal\shp_custom\Service\StringGenerator;
use Drupal\shp_database_provisioner\Service\Provisioner;
use Drupal\shp_orchestration\OrchestrationProviderInterface;
use Drupal\shp_orchestration\OrchestrationProviderPluginManagerInterface;
use Drupal\Tests\UnitTestCase;

/**
* Tests the OrchestrationEvents class constants.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ class OrchestrationProviderSettingsController extends ControllerBase {
* @param \Drupal\Core\Entity\EntityFormBuilderInterface $entity_form_builder
* Entity Form Builder.
*/
public function __construct(ConfigFactoryInterface $config_factory,
OrchestrationProviderPluginManagerInterface $orchestration_provider_manager,
EntityTypeManagerInterface $entity_type_manager,
EntityFormBuilderInterface $entity_form_builder) {
public function __construct(
ConfigFactoryInterface $config_factory,
OrchestrationProviderPluginManagerInterface $orchestration_provider_manager,
EntityTypeManagerInterface $entity_type_manager,
EntityFormBuilderInterface $entity_form_builder,
) {

$this->configFactory = $config_factory;
$this->orchestrationProviderManager = $orchestration_provider_manager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class OrchestrationEnvironmentEvent extends Event {
* @param \Drupal\node\NodeInterface $project
* The project for this environment.
*/
public function __construct(OrchestrationProviderInterface $orchestrationProvider, string $deploymentName, NodeInterface $site = NULL, NodeInterface $environment = NULL, NodeInterface $project = NULL) {
public function __construct(OrchestrationProviderInterface $orchestrationProvider, string $deploymentName, ?NodeInterface $site = NULL, ?NodeInterface $environment = NULL, ?NodeInterface $project = NULL) {
$this->orchestrationProvider = $orchestrationProvider;
$this->deploymentName = $deploymentName;
$this->site = $site;
Expand Down
Loading

0 comments on commit a0d1c75

Please sign in to comment.