InlineComment, VariableComment and NewlineAfterCloseBrace Rules removed#1062
Conversation
Codecov Report
@@ Coverage Diff @@
## 8.x-4.x #1062 +/- ##
==========================================
Coverage 50.38% 50.38%
Complexity 683 683
==========================================
Files 118 118
Lines 1820 1820
==========================================
Hits 917 917
Misses 903 903
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
@Dylan203 looks already very good, thanks! found minor things, but also found a bigger issue with the test we need to fix, please follow the comments below
| class EntityBufferTest extends GraphQLTestBase { | ||
|
|
||
| /** | ||
| * @var NodeIDsArray |
There was a problem hiding this comment.
Actually I found out that the test is written incorrectly. Problem is with the following code in the file below:
foreach (range(1, 3) as $i) {
$this->nodeIds[] = Node::create([
'title' => 'Node ' . $i,
'type' => 'test',
])->save();
}
Because save method below does not return entity (node) id, it returns the status of saving the entity (for new entities it returns 1, for updated entities returns 2, for deleted entities it returns 3). So the array is filled with three 1's which is something we don't want. Let's first fix the foreach loop bellow with the following form:
foreach (range(1, 3) as $i) {
$node = Node::create([
'title' => 'Node ' . $i,
'type' => 'test',
]);
$node->save();
$this->nodeIds[] = $node->id();
}
And now let's fix this @var annotation. @var is describing the type of the variable, so it can be string, int, bool, or some specific object like \Drupal\Tests\graphql\Kernel\EntityBufferTest. In this case it's array. For array we always want to be as specific as possible. If it's array of booleans then we'll use bool[]. Here we know that $node->id() returns id as a string, so let's use this:
* @var string[]
| class PersistedQueriesTest extends GraphQLTestBase { | ||
|
|
||
| /** | ||
| * @var ModulesArray |
There was a problem hiding this comment.
here again, it's array of strings so lets use:
* @var string[]
rthideaway
left a comment
There was a problem hiding this comment.
@Dylan203 thank you, now looks perfect! :)
now let's wait for the Travis builds and if they pass I will merge it :)
|
@klausi I just noticed I cannot merge PRs in this module :( could you merge it instead? |
exclude name="Drupal.Commenting.InlineComment.InvalidEndChar"
exclude name="Drupal.Commenting.InlineComment.NoSpaceBefore"
exclude name="Drupal.Commenting.InlineComment.SpacingAfter"
exclude name="Drupal.Commenting.InlineComment.SpacingBefore"
exclude name="Drupal.Commenting.InlineComment.SpacingBefore"
exclude name="Drupal.Commenting.VariableComment.IncorrectVarType"
exclude name="Drupal.Commenting.VariableComment.Missing"
exclude name="Drupal.ControlStructures.ControlSignature.NewlineAfterCloseBrace"