From e1649f1cbb07897d8e5ab2cf4e120055138b977f Mon Sep 17 00:00:00 2001 From: devhalls Date: Fri, 16 Oct 2026 15:19:50 +0100 Subject: [PATCH] [FIX] Clear the coding-standard errors blocking CI [UPD] Suffix the connect-flow interface names --- src/ArcClient.php | 2 +- ...ArcGateway.php => ArcGatewayInterface.php} | 2 +- src/ConnectService.php | 12 ++++----- src/ConsentMarkup.php | 4 +-- ...tLinker.php => ContentLinkerInterface.php} | 2 +- src/DrupalContentLinks.php | 2 +- src/DrupalIdGenerator.php | 2 +- src/DrupalRefreshLock.php | 2 +- src/DrupalSiteProfile.php | 2 +- src/DrupalSleeper.php | 2 +- ...Generator.php => IdGeneratorInterface.php} | 2 +- ...freshLock.php => RefreshLockInterface.php} | 2 +- ...teProfile.php => SiteProfileInterface.php} | 2 +- src/{Sleeper.php => SleeperInterface.php} | 2 +- tests/src/Unit/ConnectFlowTest.php | 26 +++++++++---------- tests/src/Unit/ConsentRulesTest.php | 12 ++++----- 16 files changed, 39 insertions(+), 39 deletions(-) rename src/{ArcGateway.php => ArcGatewayInterface.php} (98%) rename src/{ContentLinker.php => ContentLinkerInterface.php} (92%) rename src/{IdGenerator.php => IdGeneratorInterface.php} (82%) rename src/{RefreshLock.php => RefreshLockInterface.php} (87%) rename src/{SiteProfile.php => SiteProfileInterface.php} (86%) rename src/{Sleeper.php => SleeperInterface.php} (83%) diff --git a/src/ArcClient.php b/src/ArcClient.php index 36a8b2a..16f37fa 100644 --- a/src/ArcClient.php +++ b/src/ArcClient.php @@ -11,7 +11,7 @@ /** * Bearer calls and the OAuth token exchange. */ -final class ArcClient implements ArcGateway { +final class ArcClient implements ArcGatewayInterface { public function __construct( private readonly ClientInterface $http, diff --git a/src/ArcGateway.php b/src/ArcGatewayInterface.php similarity index 98% rename from src/ArcGateway.php rename to src/ArcGatewayInterface.php index de75535..5ec8c10 100644 --- a/src/ArcGateway.php +++ b/src/ArcGatewayInterface.php @@ -7,7 +7,7 @@ /** * Arc HTTP calls used by the connect flow. */ -interface ArcGateway { +interface ArcGatewayInterface { /** * @return array diff --git a/src/ConnectService.php b/src/ConnectService.php index 3afb725..afa04ac 100644 --- a/src/ConnectService.php +++ b/src/ConnectService.php @@ -17,13 +17,13 @@ final class ConnectService { public function __construct( private readonly ConnectionStoreInterface $store, - private readonly ArcGateway $client, + private readonly ArcGatewayInterface $client, private readonly ArcConfig $config, - private readonly SiteProfile $profile, - private readonly RefreshLock $lock, - private readonly Sleeper $sleeper, - private readonly IdGenerator $ids, - private readonly ContentLinker $links, + private readonly SiteProfileInterface $profile, + private readonly RefreshLockInterface $lock, + private readonly SleeperInterface $sleeper, + private readonly IdGeneratorInterface $ids, + private readonly ContentLinkerInterface $links, ) {} /** diff --git a/src/ConsentMarkup.php b/src/ConsentMarkup.php index 6a39eda..b914526 100644 --- a/src/ConsentMarkup.php +++ b/src/ConsentMarkup.php @@ -109,10 +109,10 @@ public function table(array $rows): string { /** * Accept, decline, or read-more control. * - * @param array $settings - * Settings. * @param string $action * accept, decline, or read-more. + * @param array $settings + * Settings. * @param string $label * Button label. Empty uses the saved label. * @param string $colour diff --git a/src/ContentLinker.php b/src/ContentLinkerInterface.php similarity index 92% rename from src/ContentLinker.php rename to src/ContentLinkerInterface.php index 3751129..af82cbc 100644 --- a/src/ContentLinker.php +++ b/src/ContentLinkerInterface.php @@ -7,7 +7,7 @@ /** * Adds view and edit URLs for paths on this site. */ -interface ContentLinker { +interface ContentLinkerInterface { /** * @param array> $blocks diff --git a/src/DrupalContentLinks.php b/src/DrupalContentLinks.php index ca25842..939264f 100644 --- a/src/DrupalContentLinks.php +++ b/src/DrupalContentLinks.php @@ -15,7 +15,7 @@ /** * Resolves an on-site path to a view URL and an edit URL. */ -final class DrupalContentLinks implements ContentLinker { +final class DrupalContentLinks implements ContentLinkerInterface { public function __construct( private readonly PathValidatorInterface $paths, diff --git a/src/DrupalIdGenerator.php b/src/DrupalIdGenerator.php index f4d5331..f2a618e 100644 --- a/src/DrupalIdGenerator.php +++ b/src/DrupalIdGenerator.php @@ -9,7 +9,7 @@ /** * Drupal UUID service as an idempotency key source. */ -final class DrupalIdGenerator implements IdGenerator { +final class DrupalIdGenerator implements IdGeneratorInterface { public function __construct( private readonly UuidInterface $uuid, diff --git a/src/DrupalRefreshLock.php b/src/DrupalRefreshLock.php index 9f2f8ac..991e864 100644 --- a/src/DrupalRefreshLock.php +++ b/src/DrupalRefreshLock.php @@ -9,7 +9,7 @@ /** * Drupal lock backend for the refresh rotation. */ -final class DrupalRefreshLock implements RefreshLock { +final class DrupalRefreshLock implements RefreshLockInterface { private const NAME = 'pendulum_arc_oauth_refresh'; diff --git a/src/DrupalSiteProfile.php b/src/DrupalSiteProfile.php index 8ba3be6..a255695 100644 --- a/src/DrupalSiteProfile.php +++ b/src/DrupalSiteProfile.php @@ -11,7 +11,7 @@ /** * Site name and absolute front URL for the authorize request. */ -final class DrupalSiteProfile implements SiteProfile { +final class DrupalSiteProfile implements SiteProfileInterface { public function __construct( private readonly ConfigFactoryInterface $configFactory, diff --git a/src/DrupalSleeper.php b/src/DrupalSleeper.php index 6b98268..0592386 100644 --- a/src/DrupalSleeper.php +++ b/src/DrupalSleeper.php @@ -7,7 +7,7 @@ /** * Waits 200ms between refresh polls. */ -final class DrupalSleeper implements Sleeper { +final class DrupalSleeper implements SleeperInterface { public function pause(): void { usleep(200000); diff --git a/src/IdGenerator.php b/src/IdGeneratorInterface.php similarity index 82% rename from src/IdGenerator.php rename to src/IdGeneratorInterface.php index 5244a44..db3a04d 100644 --- a/src/IdGenerator.php +++ b/src/IdGeneratorInterface.php @@ -7,7 +7,7 @@ /** * Opaque id for an idempotency key. */ -interface IdGenerator { +interface IdGeneratorInterface { public function generate(): string; diff --git a/src/RefreshLock.php b/src/RefreshLockInterface.php similarity index 87% rename from src/RefreshLock.php rename to src/RefreshLockInterface.php index e09bde2..f75f0d5 100644 --- a/src/RefreshLock.php +++ b/src/RefreshLockInterface.php @@ -7,7 +7,7 @@ /** * Single-flight lock around an OAuth refresh. */ -interface RefreshLock { +interface RefreshLockInterface { public function claim(): bool; diff --git a/src/SiteProfile.php b/src/SiteProfileInterface.php similarity index 86% rename from src/SiteProfile.php rename to src/SiteProfileInterface.php index 8bda3b7..c050594 100644 --- a/src/SiteProfile.php +++ b/src/SiteProfileInterface.php @@ -7,7 +7,7 @@ /** * This install's home URL and site name. */ -interface SiteProfile { +interface SiteProfileInterface { /** * @return array{origin: string, name: string} diff --git a/src/Sleeper.php b/src/SleeperInterface.php similarity index 83% rename from src/Sleeper.php rename to src/SleeperInterface.php index 557bcd1..d271349 100644 --- a/src/Sleeper.php +++ b/src/SleeperInterface.php @@ -7,7 +7,7 @@ /** * Pause between refresh-lock polls. */ -interface Sleeper { +interface SleeperInterface { public function pause(): void; diff --git a/tests/src/Unit/ConnectFlowTest.php b/tests/src/Unit/ConnectFlowTest.php index 13990a5..20e1ce1 100644 --- a/tests/src/Unit/ConnectFlowTest.php +++ b/tests/src/Unit/ConnectFlowTest.php @@ -6,14 +6,14 @@ use Drupal\pendulum_arc\ArcApiException; use Drupal\pendulum_arc\ArcConfig; -use Drupal\pendulum_arc\ArcGateway; +use Drupal\pendulum_arc\ArcGatewayInterface; use Drupal\pendulum_arc\ConnectService; use Drupal\pendulum_arc\ConnectionStoreInterface; -use Drupal\pendulum_arc\ContentLinker; -use Drupal\pendulum_arc\IdGenerator; -use Drupal\pendulum_arc\RefreshLock; -use Drupal\pendulum_arc\SiteProfile; -use Drupal\pendulum_arc\Sleeper; +use Drupal\pendulum_arc\ContentLinkerInterface; +use Drupal\pendulum_arc\IdGeneratorInterface; +use Drupal\pendulum_arc\RefreshLockInterface; +use Drupal\pendulum_arc\SiteProfileInterface; +use Drupal\pendulum_arc\SleeperInterface; use PHPUnit\Framework\TestCase; /** @@ -135,12 +135,12 @@ public function testReconnectUsesTheSavedApiKey(): void { self::assertSame('arc_live_example_secret', $creds['accessToken']); } - private function service(ConnectionStoreInterface $store, ArcGateway $client, RefreshLock $lock, ?callable $onPause = NULL): ConnectService { + private function service(ConnectionStoreInterface $store, ArcGatewayInterface $client, RefreshLockInterface $lock, ?callable $onPause = NULL): ConnectService { return new ConnectService( $store, $client, new ArcConfig('production', ArcConfig::CLIENT_ID, NULL, NULL, FALSE, FALSE), - new class implements SiteProfile { + new class implements SiteProfileInterface { public function get(): array { return ['origin' => 'https://example.com/', 'name' => 'Example']; @@ -148,7 +148,7 @@ public function get(): array { }, $lock, - new class($onPause) implements Sleeper { + new class($onPause) implements SleeperInterface { public function __construct(private $onPause) {} @@ -159,14 +159,14 @@ public function pause(): void { } }, - new class implements IdGenerator { + new class implements IdGeneratorInterface { public function generate(): string { return 'idempotency-key-1'; } }, - new class implements ContentLinker { + new class implements ContentLinkerInterface { public function linkReportBlocks(array $blocks): array { return $blocks; @@ -283,7 +283,7 @@ public function takeNotice(int $userId): ?array { /** * Scores fail once for the old token, then succeed. */ -final class FakeGateway implements ArcGateway { +final class FakeGateway implements ArcGatewayInterface { /** * @var array */ @@ -375,7 +375,7 @@ public function exchangeCode(string $env, string $code, string $verifier, string /** * A lock that is either free or already held. */ -final class MemoryLock implements RefreshLock { +final class MemoryLock implements RefreshLockInterface { public function __construct(private readonly bool $free) {} diff --git a/tests/src/Unit/ConsentRulesTest.php b/tests/src/Unit/ConsentRulesTest.php index c9320aa..555b4ba 100644 --- a/tests/src/Unit/ConsentRulesTest.php +++ b/tests/src/Unit/ConsentRulesTest.php @@ -49,7 +49,7 @@ public function testDefaultsMatchTheBannerFactory(): void { self::assertSame([], $settings['cookies']); } - public function testSanitizeKeepsACookieAndDropsBadValues(): void { + public function testSanitizeKeepsOneCookieAndDropsBadValues(): void { $clean = ConsentSettings::sanitize( [ 'title' => ' Hello there ', @@ -209,7 +209,7 @@ public function testPrintSlotFollowsLayout(): void { self::assertSame('footer', ConsentSettings::print_slot($settings)); } - public function testASitePathIsKeptAsTheReadMoreLink(): void { + public function testSitePathIsKeptAsTheReadMoreLink(): void { $clean = ConsentSettings::sanitize( ['read_more_url' => '/privacy'], '' @@ -245,7 +245,7 @@ public function testResetRestoresDefaultsAndBumpsTheVersion(): void { self::assertSame('fresh', $reset['custom_css']); } - public function testRemovingACatalogRowDismissesItUntilItReturns(): void { + public function testRemovingOneCatalogRowDismissesItUntilItReturns(): void { $previous = [ ['catalog_id' => 'ga'], ['catalog_id' => 'gid'], @@ -274,7 +274,7 @@ public function testCatalogMatchesKnownCookiesWithoutSwallowingNeighbours(): voi ); self::assertSame( ['drupal_session'], - ConsentCatalog::matching_ids(['SESS' . 'example'], []) + ConsentCatalog::matching_ids(['SESSexample'], []) ); self::assertSame( ['ga'], @@ -298,7 +298,7 @@ public function testCatalogMatchesKnownCookiesWithoutSwallowingNeighbours(): voi ); } - public function testALibraryIdIsNotTreatedAsAUrl(): void { + public function testLibraryIdentifierIsNotTreatedAsUrl(): void { self::assertTrue(ConsentScripts::is_library_id('google_tag/gtag')); self::assertFalse(ConsentScripts::is_library_id('https://www.googletagmanager.com/gtag/js')); self::assertFalse(ConsentScripts::is_library_id('/core/misc/drupal.js')); @@ -375,7 +375,7 @@ public function testScriptTagsBlockOnlyOptionalRowsThatAreNotAllowed(): void { ); } - public function testARequiredMatchWinsOverAnOptionalMatch(): void { + public function testRequiredMatchWinsOverAnOptionalMatch(): void { $cookies = [ [ 'id' => 'cat_ga',