From a899790dfde3c5b75468315925ee1134af7720fd Mon Sep 17 00:00:00 2001 From: Kedar Khaire Date: Thu, 9 Jan 2025 13:12:03 +0530 Subject: [PATCH] Fixes for Naming Convention ValidClassName.NoUpperAcronyms PHPCS --- src/Plugin/ApigeeFieldStorageFormat/CSV.php | 3 ++- src/Plugin/ApigeeFieldStorageFormat/JSON.php | 3 ++- tests/src/Functional/DeveloperAppFieldTest.php | 2 +- tests/src/Functional/DeveloperSyncTest.php | 12 ++++++------ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Plugin/ApigeeFieldStorageFormat/CSV.php b/src/Plugin/ApigeeFieldStorageFormat/CSV.php index b40bbbe5b..b44f75b15 100644 --- a/src/Plugin/ApigeeFieldStorageFormat/CSV.php +++ b/src/Plugin/ApigeeFieldStorageFormat/CSV.php @@ -49,7 +49,8 @@ * * @see https://github.com/symfony/symfony/issues/27447 */ -class Csv implements FieldStorageFormatInterface { +// @phpcs:ignore Drupal.NamingConventions.ValidClassName.NoUpperAcronyms +class CSV implements FieldStorageFormatInterface { /** * {@inheritdoc} diff --git a/src/Plugin/ApigeeFieldStorageFormat/JSON.php b/src/Plugin/ApigeeFieldStorageFormat/JSON.php index ffc9bd271..eb18b1496 100644 --- a/src/Plugin/ApigeeFieldStorageFormat/JSON.php +++ b/src/Plugin/ApigeeFieldStorageFormat/JSON.php @@ -31,7 +31,8 @@ * weight = 1000, * ) */ -class Json implements FieldStorageFormatInterface { +// @phpcs:ignore Drupal.NamingConventions.ValidClassName.NoUpperAcronyms +class JSON implements FieldStorageFormatInterface { /** * {@inheritdoc} diff --git a/tests/src/Functional/DeveloperAppFieldTest.php b/tests/src/Functional/DeveloperAppFieldTest.php index 9012a2556..909c0f064 100644 --- a/tests/src/Functional/DeveloperAppFieldTest.php +++ b/tests/src/Functional/DeveloperAppFieldTest.php @@ -150,7 +150,7 @@ public function testFieldableDeveloperApp() { } /** - * Tests field storage formatters (Csv and Json). + * Tests field storage formatters (CSV and JSON). */ protected function fieldStorageFormattersTest() { $field_name_prefix = (string) $this->config('field_ui.settings')->get('field_prefix'); diff --git a/tests/src/Functional/DeveloperSyncTest.php b/tests/src/Functional/DeveloperSyncTest.php index ebe619c53..7c190c2b9 100644 --- a/tests/src/Functional/DeveloperSyncTest.php +++ b/tests/src/Functional/DeveloperSyncTest.php @@ -23,8 +23,8 @@ use Drupal\Core\Url; use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; use Drupal\apigee_edge\Entity\Developer; -use Drupal\apigee_edge\Plugin\ApigeeFieldStorageFormat\Csv; -use Drupal\apigee_edge\Plugin\ApigeeFieldStorageFormat\Json; +use Drupal\apigee_edge\Plugin\ApigeeFieldStorageFormat\CSV; +use Drupal\apigee_edge\Plugin\ApigeeFieldStorageFormat\JSON; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\user\Entity\User; @@ -579,11 +579,11 @@ protected function verify() { foreach ($this->fields as $field_type => $data) { $formatter = $this->formatManager->lookupPluginForFieldType($field_type); - if ($formatter instanceof Json) { + if ($formatter instanceof JSON) { $this->assertJsonStringEqualsJsonString($developer->getAttributeValue($data['name']), $formatter->encode($user->get($this->fieldNamePrefix . $data['name'])->getValue())); $this->assertJsonStringEqualsJsonString($developer->getAttributeValue($data['name']), $formatter->encode($data['data_changed'])); } - elseif ($formatter instanceof Csv) { + elseif ($formatter instanceof CSV) { $this->assertEquals($developer->getAttributeValue($data['name']), $formatter->encode($user->get($this->fieldNamePrefix . $data['name'])->getValue())); $this->assertEquals($developer->getAttributeValue($data['name']), $formatter->encode($data['data_changed'])); } @@ -592,11 +592,11 @@ protected function verify() { else { foreach ($this->fields as $field_type => $data) { $formatter = $this->formatManager->lookupPluginForFieldType($field_type); - if ($formatter instanceof Json) { + if ($formatter instanceof JSON) { $this->assertJsonStringEqualsJsonString($developer->getAttributeValue($data['name']), $formatter->encode($user->get($this->fieldNamePrefix . $data['name'])->getValue())); $this->assertJsonStringEqualsJsonString($developer->getAttributeValue($data['name']), $formatter->encode($data['data'])); } - elseif ($formatter instanceof Csv) { + elseif ($formatter instanceof CSV) { $this->assertEquals($developer->getAttributeValue($data['name']), $formatter->encode($user->get($this->fieldNamePrefix . $data['name'])->getValue())); $this->assertEquals($developer->getAttributeValue($data['name']), $formatter->encode($data['data'])); }