Skip to content

TypeHintMissing and ReturnTypeSpaces Rules removed#1063

Merged
rthideaway merged 3 commits intodrupal-graphql:8.x-4.xfrom
Dylan203:fix/cs-fixes-iteration-4
Aug 11, 2020
Merged

TypeHintMissing and ReturnTypeSpaces Rules removed#1063
rthideaway merged 3 commits intodrupal-graphql:8.x-4.xfrom
Dylan203:fix/cs-fixes-iteration-4

Conversation

@Dylan203
Copy link
Copy Markdown
Contributor

exclude name="Drupal.Commenting.FunctionComment.ReturnTypeSpaces"
exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 11, 2020

Codecov Report

Merging #1063 into 8.x-4.x will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             8.x-4.x    #1063   +/-   ##
==========================================
  Coverage      50.38%   50.38%           
  Complexity       683      683           
==========================================
  Files            118      118           
  Lines           1820     1820           
==========================================
  Hits             917      917           
  Misses           903      903           
Impacted Files Coverage Δ Complexity Δ
src/GraphQL/Resolver/Context.php 0.00% <ø> (ø) 5.00 <0.00> (ø)
src/GraphQL/Utility/Introspection.php 0.00% <ø> (ø) 1.00 <0.00> (ø)
...lugin/GraphQL/DataProducer/Entity/EntityAccess.php 100.00% <ø> (ø) 1.00 <0.00> (ø)
.../Plugin/GraphQL/DataProducer/Entity/EntityLoad.php 95.00% <ø> (ø) 13.00 <0.00> (ø)
...n/GraphQL/DataProducer/Entity/EntityLoadByUuid.php 60.00% <ø> (ø) 12.00 <0.00> (ø)
...GraphQL/DataProducer/Entity/EntityLoadMultiple.php 65.21% <ø> (ø) 14.00 <0.00> (ø)
...gin/GraphQL/DataProducer/Field/EntityReference.php 56.66% <ø> (ø) 18.00 <0.00> (ø)
src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php 41.50% <ø> (ø) 19.00 <0.00> (ø)
...L/SchemaExtension/SdlSchemaExtensionPluginBase.php 0.00% <ø> (ø) 5.00 <0.00> (ø)
src/Plugin/GraphQL/DataProducer/XML/XMLXpath.php 100.00% <100.00%> (ø) 1.00 <1.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5852b8a...4935e30. Read the comment docs.

Copy link
Copy Markdown
Contributor

@rthideaway rthideaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! found just some small things :)

Comment thread tests/src/Traits/HttpRequestTrait.php Outdated
* The http response object.
*/
protected function batchedQueries(array $queries, $server = NULL) {
protected function batchedQueries(array $queries, \Drupal\graphql\Entity\Server $server = NULL) {
Copy link
Copy Markdown
Contributor

@rthideaway rthideaway Aug 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two problems with $server argument here. First we shouldn't add a full namespace (fully qualified domain name) for method arguments. And second, we should use interface instead of specific class. Let's use interface instead, because if somebody wants to extend default Server class and use it, they wouldn't be able to do so. Let's use here ServerInterface, and make sure namespace is added to the top of the file:

use Drupal\graphql\Entity\ServerInterface;

Comment thread tests/src/Traits/SchemaPrinterTrait.php Outdated
* The printed version of the schema.
*/
protected function getPrintedSchema($server = NULL) {
protected function getPrintedSchema(\Drupal\graphql\Entity\ServerInterface $server = NULL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar here, let's use just ServerInterface and make sure namespace is added to the top of the file:

use Drupal\graphql\Entity\ServerInterface;

Copy link
Copy Markdown
Contributor

@rthideaway rthideaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dylan203 one more very small leftover


use Drupal\graphql\Entity\Server;
use Symfony\Component\HttpFoundation\Request;
use Drupal\graphql\Entity\ServerInterface;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, what is usually done in the list of used namespaces is, that they are ordered alphabetically, so it's easier for a developer to look through the list. sometimes the list is really huge and if we are checking some namespaces it's harder to go through unordered list.

Hint: your IDE will most certainly help you with that. Almost every IDE is able to add a namespace with some shortcut to the correct position. If you are using PHPstorm you can try it yourself. Just delete the namespace here and go the method which is using it and click on it. Then you can use a shortcut Alt + Enter which pops up a dialog where you choose Import class:
phpstorm-import-class-dialog

You click on it and just select proper class from the list:
phpstorm-class-selection

And boom the namespace is added to the top of the file to the correct position :)


use Drupal\graphql\Entity\Server;
use GraphQL\Utils\SchemaPrinter;
use Drupal\graphql\Entity\ServerInterface;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, let's keep the list in alphabetical order

Copy link
Copy Markdown
Contributor

@rthideaway rthideaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! thanks! :)

@rthideaway rthideaway merged commit 557a925 into drupal-graphql:8.x-4.x Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants