From cc8a0fc672c38254a6ba4f095b8a57723135f7b2 Mon Sep 17 00:00:00 2001 From: Rajeshreeputra Date: Thu, 22 Jun 2023 10:30:06 +0530 Subject: [PATCH] ACMS-1861: Fix Drupal Check notices for Drupal 10.1 --- .../src/Service/AcquiaCmsConfigSyncService.php | 8 ++++++++ modules/acquia_cms_common/src/Commands/AcmsCommands.php | 3 ++- .../src/Services/ConfigImporterService.php | 3 ++- .../tests/src/Unit/DefaultContentUpdateEventTest.php | 1 + tests/src/ExistingSite/InstallStateTest.php | 4 ++-- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/acquia_cms_common/modules/acquia_cms_support/src/Service/AcquiaCmsConfigSyncService.php b/modules/acquia_cms_common/modules/acquia_cms_support/src/Service/AcquiaCmsConfigSyncService.php index 284201864c..381f321124 100644 --- a/modules/acquia_cms_common/modules/acquia_cms_support/src/Service/AcquiaCmsConfigSyncService.php +++ b/modules/acquia_cms_common/modules/acquia_cms_support/src/Service/AcquiaCmsConfigSyncService.php @@ -82,9 +82,17 @@ public function getParity($configFile, StorageInterface $syncStorage) { $diff = new Diff($original_configuration, $active_configuration); $totalLines = count($active_configuration); $editedLines = 0; + // @todo remove phpstan-ignore-next-line once we have the replcement + // for the deprecations in Drupal\Component\Diff\Diff, update accordingly + // in ACMS-1868. + // @phpstan-ignore-next-line if (!$diff->isEmpty()) { foreach ($diff->getEdits() as $diffOp) { if ($diffOp->type !== 'copy') { + // @todo remove phpstan-ignore-next-line once we have the replcement + // for the deprecations in Drupal\Component\Diff\Diff, update + // accordingly in ACMS-1868. + // @phpstan-ignore-next-line $editedLines += $diffOp->nclosing(); } } diff --git a/modules/acquia_cms_common/src/Commands/AcmsCommands.php b/modules/acquia_cms_common/src/Commands/AcmsCommands.php index 7b2cdd2f46..f04f33fd44 100644 --- a/modules/acquia_cms_common/src/Commands/AcmsCommands.php +++ b/modules/acquia_cms_common/src/Commands/AcmsCommands.php @@ -270,7 +270,7 @@ public function importSiteStudioPackages() { public function starterKit($filter = '', $options = [ 'project' => self::REQ, 'format' => 'table', - ]) { + ]): bool|string|array { if ($starter_kit = $this->acmsUtilityService->getStarterKit()) { $data['starter-kit'] = $starter_kit; $result = new PropertyList($data); @@ -286,6 +286,7 @@ function ($key, $cellData, FormatterOptions $options, $rowData) { return $result; } $this->output()->writeln('Starter-kit is not installed yet.'); + return FALSE; } } diff --git a/modules/acquia_cms_common/src/Services/ConfigImporterService.php b/modules/acquia_cms_common/src/Services/ConfigImporterService.php index 6e3af00c0d..608e13df47 100644 --- a/modules/acquia_cms_common/src/Services/ConfigImporterService.php +++ b/modules/acquia_cms_common/src/Services/ConfigImporterService.php @@ -15,6 +15,7 @@ use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\StringTranslation\TranslationInterface; +use Drupal\Core\Utility\Error; use Drush\Log\DrushLoggerManager; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; @@ -209,7 +210,7 @@ public function doImport(StorageComparer $storage_comparer, DrushLoggerManager $ $message = 'The import failed due to the following reasons:' . "\n"; $message .= implode("\n", $config_importer->getErrors()); - watchdog_exception('config_import', $e); + Error::logException('config_import', $e); throw new \Exception($message); } } diff --git a/modules/acquia_cms_event/tests/src/Unit/DefaultContentUpdateEventTest.php b/modules/acquia_cms_event/tests/src/Unit/DefaultContentUpdateEventTest.php index 869246267a..d29c37c833 100644 --- a/modules/acquia_cms_event/tests/src/Unit/DefaultContentUpdateEventTest.php +++ b/modules/acquia_cms_event/tests/src/Unit/DefaultContentUpdateEventTest.php @@ -27,6 +27,7 @@ class DefaultContentUpdateEventTest extends UnitTestCase { * Before a test method is run, setUp() is invoked. */ public function setUp(): void { + parent::setUp(); $this->updateEvent = new DefaultContentEventUpdate(); } diff --git a/tests/src/ExistingSite/InstallStateTest.php b/tests/src/ExistingSite/InstallStateTest.php index d208714eb1..79dae8fa56 100644 --- a/tests/src/ExistingSite/InstallStateTest.php +++ b/tests/src/ExistingSite/InstallStateTest.php @@ -97,8 +97,8 @@ public function testConfig(): void { // Check page caching set for one year and css/js are aggregated. $performance_config = $this->config('system.performance'); $this->assertSame(31536000, $performance_config->get('cache.page.max_age')); - $this->assertSame(TRUE, $performance_config->get('css.preprocess')); - $this->assertSame(TRUE, $performance_config->get('js.preprocess')); + $this->assertTrue(TRUE, $performance_config->get('css.preprocess')); + $this->assertTrue(TRUE, $performance_config->get('js.preprocess')); // Check purge configurations incorporating acquia purge. $purge_plugin_config = $this->config('purge.plugins');