Skip to content

Commit

Permalink
Lint error fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Fernandes committed Nov 8, 2024
1 parent 0fe4ea0 commit f7a1074
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions tests/behat/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function iScrollToElementWithId(string $id): void {
*
* @todo Remove with next behat-steps release.
*/
public function linkAssertTextHrefNotExists(string $text, string $href, string $locator = NULL): void {
public function linkAssertTextHrefNotExists(string $text, string $href, ?string $locator = NULL): void {
/** @var \Behat\Mink\Element\DocumentElement $page */
$page = $this->getSession()->getPage();

Expand Down Expand Up @@ -357,7 +357,7 @@ public function setThemeAsDefault(string $name): void {
*
* @SuppressWarnings(PHPMD.StaticAccess)
*/
public function themeVisitSettings(string $name = NULL): void {
public function themeVisitSettings(?string $name = NULL): void {
if (!$name || $name === 'current') {
$name = \Drupal::theme()->getActiveTheme()->getName();
}
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/ScriptUnitTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected function fixtureFile(string $filename): string {
/**
* Path to a temporary file.
*/
protected function toTmpPath(string $filename, string $prefix = NULL): string {
protected function toTmpPath(string $filename, ?string $prefix = NULL): string {
return $prefix ? $this->tmpDir . DIRECTORY_SEPARATOR . $prefix . DIRECTORY_SEPARATOR . $filename : $this->tmpDir . DIRECTORY_SEPARATOR . $filename;
}

Expand All @@ -122,7 +122,7 @@ protected function printTempDir(): void {
/**
* Create a random unique temporary directory.
*/
protected function tempdir(string $dir = NULL, string $prefix = 'tmp_', int $mode = 0700, int $max_attempts = 1000): string {
protected function tempdir(?string $dir = NULL, string $prefix = 'tmp_', int $mode = 0700, int $max_attempts = 1000): string {
if (is_null($dir)) {
$dir = sys_get_temp_dir();
}
Expand Down Expand Up @@ -180,7 +180,7 @@ protected function arrayReplaceValue(array $array, callable|array $cb): array {
* - key: (string) Source path (the key from $file_structure).
* - value: (string) Path to a fixture file to use.
*/
protected function createTmpFilesFromFixtures(array $fixture_map, string $prefix = NULL): array {
protected function createTmpFilesFromFixtures(array $fixture_map, ?string $prefix = NULL): array {
$files = [];
foreach ($fixture_map as $path => $fixture_file) {
$tmp_path = $this->toTmpPath($path, $prefix);
Expand Down Expand Up @@ -229,7 +229,7 @@ protected function createTmpFilesFromFixtures(array $fixture_map, string $prefix
*
* @SuppressWarnings(PHPMD.ElseExpression)
*/
protected function replaceFixturePaths(array $fixture_map, string $prefix = NULL): array {
protected function replaceFixturePaths(array $fixture_map, ?string $prefix = NULL): array {
foreach ($fixture_map as $k => $v) {
if (is_array($v)) {
$fixture_map[$k] = $this->replaceFixturePaths($v, $prefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

declare(strict_types=1);

use Drupal\Core\Installer\Exception\InstallerException;
use Drupal\civictheme\CivicthemeConfigImporter;
use Drupal\civictheme_content\Helper;
use Drupal\Core\Installer\Exception\InstallerException;

/**
* Implements hook_install().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

declare(strict_types=1);

use Drupal\civictheme_content\Helper;
use Drupal\Core\Utility\UpdateException;
use Drupal\civictheme_content\Helper;

/**
* Common updates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

declare(strict_types=1);

use Drupal\civictheme_content\Helper;
use Drupal\Core\Utility\UpdateException;
use Drupal\civictheme_content\Helper;

/**
* Common updates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

declare(strict_types=1);

use Drupal\civictheme_content\Helper;
use Drupal\Core\Utility\UpdateException;
use Drupal\civictheme_content\Helper;

/**
* Common updates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

declare(strict_types=1);

use Drupal\civictheme_content\Helper;
use Drupal\Core\Utility\UpdateException;
use Drupal\civictheme_content\Helper;

/**
* Common updates.
Expand Down
2 changes: 1 addition & 1 deletion web/modules/custom/civictheme_content/src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function log(string|\Stringable $message): void {
*
* @SuppressWarnings(PHPMD.StaticAccess)
*/
public static function loadNodeByTitle(string $title, string $type = NULL): ?Node {
public static function loadNodeByTitle(string $title, ?string $type = NULL): ?Node {
$query = \Drupal::entityQuery('node')->accessCheck(FALSE);
$query->condition('title', $title);
if ($type) {
Expand Down
2 changes: 1 addition & 1 deletion web/modules/custom/civictheme_dev/civictheme_dev.module
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

declare(strict_types=1);

use Drupal\Core\Site\Settings;
use Drupal\civictheme\CivicthemeConstants;
use Drupal\civictheme\CivicthemeVersionManager;
use Drupal\Core\Site\Settings;
use Drupal\views\ViewExecutable;

require_once __DIR__ . '/styleguide.inc';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

declare(strict_types=1);

use Drupal\block\Entity\Block;
use Drupal\Core\Utility\UpdateException;
use Drupal\block\Entity\Block;
use Drupal\redirect\Entity\Redirect;
use Drupal\user\Entity\User;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Drupal\civictheme_dev\EventSubscriber;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\config_devel\Event\ConfigDevelEvents;
use Drupal\config_devel\Event\ConfigDevelSaveEvent;
use Drupal\config_devel\EventSubscriber\ConfigDevelSubscriberBase;
use Drupal\config_filter\Plugin\ConfigFilterPluginManager;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\ConfigManagerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static function civicthemeSizeLarge(): string {
* @return array<int, \Drupal\taxonomy\TermInterface>
* Array of topics.
*/
public static function civicthemeStaticTopics(int $count = NULL): array {
public static function civicthemeStaticTopics(?int $count = NULL): array {
return static::staticTerms('civictheme_topics', $count);
}

Expand Down Expand Up @@ -257,7 +257,7 @@ public static function civicThemeExposeMultipleFilters(): array {
* @return array<int, \Drupal\taxonomy\TermInterface>
* Array of site sections.
*/
public static function civicthemeStaticSiteSections(int $count = NULL): array {
public static function civicthemeStaticSiteSections(?int $count = NULL): array {
return static::staticTerms('civictheme_site_sections', $count);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function randomRealWebform(): ?EntityInterface {
* @return string
* URL with a path.
*/
public static function staticUrl(string $domain = NULL): string {
public static function staticUrl(?string $domain = NULL): string {
$parts = [];
$parts[] = 'https://';
$parts[] = $domain ? rtrim($domain, '/') : 'www.example.com';
Expand Down

0 comments on commit f7a1074

Please sign in to comment.