Skip to content

Commit f8d403b

Browse files
authored
style(phpcs): Fix white space and test method naming coding standards (drupal-graphql#1061)
1 parent 766b8f8 commit f8d403b

28 files changed

+41
-34
lines changed

examples/graphql_example/src/Plugin/GraphQL/DataProducer/QueryArticles.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,5 @@ public function resolve($offset, $limit, RefinableCacheableDependencyInterface $
105105

106106
return new QueryConnection($query);
107107
}
108-
}
108+
109+
}

examples/graphql_example/src/Wrappers/QueryConnection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ public function items() {
4545
return $callback();
4646
});
4747
}
48-
}
48+
49+
}

graphql.libraries.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ persisted_queries:
3232
dependencies:
3333
- core/drupal
3434
- core/jquery
35-
- core/jquery.once
35+
- core/jquery.once

phpcs.xml.dist

-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
<exclude name="Drupal.Commenting.VariableComment.IncorrectVarType"/>
5656
<exclude name="Drupal.Commenting.VariableComment.Missing"/>
5757
<exclude name="Drupal.ControlStructures.ControlSignature.NewlineAfterCloseBrace"/>
58-
<exclude name="Drupal.Files.EndFileNewline.NoneFound"/>
59-
<exclude name="Drupal.Files.EndFileNewline.TooMany"/>
60-
<exclude name="Drupal.Files.LineLength.TooLong"/>
61-
<exclude name="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
6258
</rule>
6359

6460
</ruleset>

src/Cache/Context/StaticCacheContext.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ public function getCacheableMetadata($parameter = NULL) {
2828
return new CacheableMetadata();
2929
}
3030

31-
}
31+
}

src/Config/LanguageConfigOverride.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ public function getCacheableMetadata($name) {
8484
return new CacheableMetadata();
8585
}
8686

87-
}
87+
}

src/Event/OperationEvent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ public function getContext() {
5757
return $this->context;
5858
}
5959

60-
}
60+
}

src/EventSubscriber/CurrentLanguageResetTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ protected function resetLanguageContext() {
5252
}
5353
}
5454

55-
}
55+
}

src/GraphQL/Buffers/BufferBase.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,5 @@ protected function resolveBuffer(\SplObjectStorage $buffer) {
145145
protected function resolveBufferArray(array $buffer) {
146146
throw new \LogicException('Method not implemented.');
147147
}
148-
}
148+
149+
}

src/GraphQL/Execution/Executor.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ protected function cachePrefix() {
267267
// TODO: Should we try to sort these recursively?
268268
$variables = $this->variables ?: [];
269269
ksort($variables);
270-
// TODO: Should we submit a pull request to also pass the extensions in the executor?
270+
// TODO: Should we submit a pull request to also pass the extensions in the
271+
// executor?
271272
$extensions = $this->context->getOperation()->extensions ?: [];
272273
ksort($extensions);
273274

src/GraphQL/ResolverRegistryInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ public function addTypeResolver($abstract, callable $resolver);
6363
*/
6464
public function getTypeResolver($type);
6565

66-
}
66+
}

src/GraphQL/Utility/DeferredUtility.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ public static function containsDeferred(array $values) {
116116
return FALSE;
117117
}
118118

119-
}
119+
}

src/GraphQL/Utility/DocumentSerializer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ public static function sanitizeRecursive(array $item) {
3232

3333
return $item;
3434
}
35-
}
35+
36+
}

src/GraphqlServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ public function alter(ContainerBuilder $container) {
2020
}
2121
}
2222

23-
}
23+
}

src/Plugin/GraphQL/DataProducer/DataProducerPluginCachingTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ public function edgeCachePrefix() {
2626
*/
2727
abstract public function getContextValues();
2828

29-
}
29+
}

src/Plugin/GraphQL/DataProducer/Entity/EntityLoad.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ public function resolve($type, $id, $language, ?array $bundles, ?bool $access, ?
144144

145145
return new Deferred(function () use ($type, $id, $language, $bundles, $resolver, $context, $access, $accessUser, $accessOperation) {
146146
if (!$entity = $resolver()) {
147-
// If there is no entity with this id, add the list cache tags so that the
148-
// cache entry is purged whenever a new entity of this type is saved.
147+
// If there is no entity with this id, add the list cache tags so that
148+
// the cache entry is purged whenever a new entity of this type is
149+
// saved.
149150
$type = $this->entityTypeManager->getDefinition($type);
150151
/** @var \Drupal\Core\Entity\EntityTypeInterface $type */
151152
$tags = $type->getListCacheTags();

src/Plugin/GraphQL/DataProducer/Entity/EntityLoadByUuid.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ public function resolve($type, $uuid, $language, $bundles, ?bool $access, ?Accou
144144

145145
return new Deferred(function () use ($type, $language, $bundles, $resolver, $context, $access, $accessUser, $accessOperation) {
146146
if (!$entity = $resolver()) {
147-
// If there is no entity with this id, add the list cache tags so that the
148-
// cache entry is purged whenever a new entity of this type is saved.
147+
// If there is no entity with this id, add the list cache tags so that
148+
// the cache entry is purged whenever a new entity of this type is
149+
// saved.
149150
$type = $this->entityTypeManager->getDefinition($type);
150151
/** @var \Drupal\Core\Entity\EntityTypeInterface $type */
151152
$tags = $type->getListCacheTags();

src/Plugin/GraphQL/DataProducer/Field/EntityReferenceLayoutRevisions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function __construct(
123123
}
124124

125125
/**
126-
* Resolves entity reference layout revisions for a given field of a given entity.
126+
* Resolves entity reference layout revisions for a field of a given entity.
127127
*
128128
* May optionally respect the entity bundles and language.
129129
*

src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkAttribute.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class MenuLinkAttribute extends DataProducerPluginBase {
3636
*/
3737
public function resolve(MenuLinkInterface $link, $attribute) {
3838
$options = $link->getOptions();
39-
// Certain attributes like class can be arrays. Check for that and implode them.
39+
// Certain attributes like class can be arrays. Check for that and implode
40+
// them.
4041
$attributeValue = NestedArray::getValue($options, ['attributes', $attribute]);
4142
if (is_array($attributeValue)) {
4243
return implode(" ", $attributeValue);

src/Plugin/LanguageNegotiation/OperationLanguageNegotiation.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ public function getLangcode(Request $request = NULL) {
5454
public static function setContext(ResolveContext $context = NULL) {
5555
static::$context = $context;
5656
}
57-
}
57+
58+
}

src/SubRequestResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ public function getResult() {
4141
return $this->result;
4242
}
4343

44-
}
44+
}

tests/src/Kernel/DataProducer/Entity/Fields/Image/ImageDerivativeTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public function testImageDerivative() {
7777
);
7878

7979
// TODO: Add cache checks.
80-
// $this->assertContains('config:image.style.test_style', $metadata->getCacheTags());
80+
// $this->assertContains('config:image.style.test_style',
81+
// $metadata->getCacheTags());
8182
// $this->assertContains('test_tag', $metadata->getCacheTags());
8283

8384
// Test that we don't get the derivative if we don't have access to the
@@ -90,7 +91,8 @@ public function testImageDerivative() {
9091
$this->assertNull($result);
9192

9293
// TODO: Add cache checks.
93-
// $this->assertContains('test_tag_forbidden', $metadata->getCacheTags());
94+
// $this->assertContains('test_tag_forbidden',
95+
// $metadata->getCacheTags());
9496
}
9597

9698
}

tests/src/Kernel/DataProducer/Entity/Fields/Image/ImageUrlTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public function testImageUrl() {
6161
$this->assertNull($result);
6262

6363
// TODO: Add cache checks.
64-
// $this->assertContains('test_tag_forbidden', $metadata->getCacheTags());
64+
// $this->assertContains('test_tag_forbidden',
65+
// $metadata->getCacheTags());
6566
}
6667

6768
}

tests/src/Kernel/DataProducer/XML/XMLAttributeTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class XMLAttributeTest extends XMLTestBase {
1212
/**
1313
* @covers \Drupal\graphql\Plugin\GraphQL\DataProducer\XML\XMLAttribute::resolve
1414
*/
15-
public function testXMLAttribute() {
15+
public function testXmlAttribute() {
1616
$document = $this->loadDocument();
1717
$xpath = new \DOMXPath($document->ownerDocument);
1818
$div = iterator_to_array($xpath->query('//div/div', $document));

tests/src/Kernel/DataProducer/XML/XMLContentTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class XMLContentTest extends XMLTestBase {
1212
/**
1313
* @covers \Drupal\graphql\Plugin\GraphQL\DataProducer\XML\XMLContent::resolve
1414
*/
15-
public function testXMLContent() {
15+
public function testXmlContent() {
1616
$document = $this->loadDocument();
1717
$xpath = new \DOMXPath($document->ownerDocument);
1818
$h1 = iterator_to_array($xpath->query('//div/h1', $document));

tests/src/Kernel/DataProducer/XML/XMLParseTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class XMLParseTest extends XMLTestBase {
1212
/**
1313
* @covers \Drupal\graphql\Plugin\GraphQL\DataProducer\XML\XMLParse::resolve
1414
*/
15-
public function testXMLParse() {
15+
public function testXmlParse() {
1616
$result = $this->executeDataProducer('xml_parse', [
1717
'input' => $this->getDocumentSource(),
1818
]);

tests/src/Kernel/DataProducer/XML/XMLXpathTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class XMLXpathTest extends XMLTestBase {
1212
/**
1313
* @covers \Drupal\graphql\Plugin\GraphQL\DataProducer\XML\XMLXpath::resolve
1414
*/
15-
public function testXMLXpath() {
15+
public function testXmlXpath() {
1616
$document = $this->loadDocument();
1717

1818
$result = $this->executeDataProducer('xml_xpath', [

tests/src/Kernel/ResolverBuilderTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -432,4 +432,3 @@ public function testDeferredDefaultValue() {
432432
}
433433

434434
}
435-

0 commit comments

Comments
 (0)