Skip to content

Commit

Permalink
Fixes PHPCS issues (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
kedarkhaire authored Oct 1, 2024
1 parent 8c02a94 commit 1a2b851
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
use Drupal\file\Entity\File;
use Drupal\node\NodeInterface;
use GraphQL\GraphQL;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
use GraphQL\Type\Schema;
use GraphQL\Utils\BuildSchema;
use Symfony\Component\HttpFoundation\JsonResponse;

Expand All @@ -55,7 +52,7 @@ public function build(NodeInterface $node) {
$field_graphql_spec = $node->get('field_graphql_spec');

if ($field_graphql_spec && $field_graphql_spec->target_id) {
/* @var \Drupal\file\Entity\File $file */
/** @var \Drupal\file\Entity\File $file */
$file = File::load($field_graphql_spec->target_id);

if ($file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ private function attachLibraries(array $element, array $graphql_urls) {
'apigeeGraphqlDocFormatter' => [
$this->fieldDefinition->getName() => [
'graphqlUrls' => $graphql_urls,
]
]
]
],
],
],
];
}
return $element;
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Form/ApiDocReimportSpecForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

namespace Drupal\apigee_api_catalog\Entity\Form;

use Drupal\apigee_api_catalog\SpecFetcherInterface;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
Expand All @@ -30,6 +29,7 @@
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Drupal\apigee_api_catalog\SpecFetcherInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down Expand Up @@ -135,7 +135,7 @@ public function getDescription() {
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
/* @var \Drupal\node\NodeInterface $entity */
/** @var \Drupal\node\NodeInterface $entity */
$entity = $this->getEntity();

if ($entity->get('field_apidoc_spec_file_source')->value != SpecFetcherInterface::SPEC_AS_URL) {
Expand Down
5 changes: 1 addition & 4 deletions src/Plugin/Field/FieldFormatter/SmartDocsFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@

namespace Drupal\apigee_api_catalog\Plugin\Field\FieldFormatter;

use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Serialization\Yaml;
use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -133,7 +130,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
'library' => [
'apigee_api_catalog/js_yaml',
'apigee_api_catalog/smartdocs_integration',
'apigee_api_catalog/smartdocs'
'apigee_api_catalog/smartdocs',
],
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function validate($items, Constraint $constraint) {
];

// Perform only a HEAD method to save bandwidth.
/* @var $response \Psr\Http\Message\ResponseInterface */
/** @var \Psr\Http\Message\ResponseInterface $response */
$response = $this->httpClient->head($url, $options);
}
catch (RequestException $request_exception) {
Expand Down
4 changes: 2 additions & 2 deletions src/SpecFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Request;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Psr\Log\LoggerInterface;

/**
* Class SpecFetcher.
Expand Down Expand Up @@ -108,7 +108,7 @@ public function fetchSpec(NodeInterface $apidoc): string {
if ($apidoc->get('field_apidoc_spec_file_source')->value === static::SPEC_AS_URL) {

// If the file_link field is empty, return without changes.
// TODO: The file link shouldn't be empty. Consider throwing an error.
// @todo The file link shouldn't be empty. Consider throwing an error.
if ($apidoc->get('field_apidoc_file_link')->isEmpty()) {
return FALSE;
}
Expand Down
1 change: 0 additions & 1 deletion src/UpdateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Utility\UpdateException;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
Expand Down
8 changes: 4 additions & 4 deletions tests/src/Functional/ApiDocsAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Url;
use Drupal\file\Entity\File;
use Drupal\file\FileInterface;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\TestFileCreationTrait;
use Drupal\file\Entity\File;
use Drupal\file\FileInterface;

/**
* Simple test to ensure that main page loads with module enabled.
Expand All @@ -50,7 +50,7 @@ class ApiDocsAdminTest extends BrowserTestBase {
'views',
'apigee_api_catalog',
'block',
'field_ui'
'field_ui',
];

/**
Expand Down Expand Up @@ -144,7 +144,7 @@ public function testApiDocAdministration() {
$assert->pageTextContains(new FormattableMarkup(
'OpenAPI Doc @name has been created.',
[
'@name' => $random_name
'@name' => $random_name,
]
)
);
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/ApidocEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testEntity() {
* Test revisioning functionality on an apidocs entity.
*/
public function testRevisions() {
/* @var \Drupal\node\NodeInterface $entity */
/** @var \Drupal\node\NodeInterface $entity */

$description_v1 = 'Test API';
$entity = $this->nodeStorage->create([
Expand Down

0 comments on commit 1a2b851

Please sign in to comment.