Problem/Motivation
FILE: ...ution/drupal10/web/modules/contrib/graphql_compose/graphql_compose.api.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
141 | ERROR | Expected type hint "EntityTypeInterface"; found
| | "\Drupal\Core\Field\FieldDefinitionInterface" for $field
--------------------------------------------------------------------------------
FILE: ...contribution/drupal10/web/modules/contrib/graphql_compose/js/uuid.admin.js
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
55 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...al10/web/modules/contrib/graphql_compose/src/Wrapper/EntityTypeWrapper.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
69 | ERROR | Unknown type hint "mixed" found for $entity
--------------------------------------------------------------------------------
FILE: ...ose/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
147 | ERROR | Type hint "array" missing for $element
--------------------------------------------------------------------------------
FILE: ...graphql_compose_comments/src/Plugin/GraphQL/DataProducer/CreateComment.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
98 | ERROR | Expected type hint "EntityInterface"; found "?EntityInterface"
| | for $entity
--------------------------------------------------------------------------------
FILE: ...trib/graphql_compose/modules/graphql_compose_edges/src/Wrappers/Cursor.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
37 | ERROR | Unknown type hint "mixed" found for $sortValue
--------------------------------------------------------------------------------
FILE: ...ontrib/graphql_compose/modules/graphql_compose_edges/src/Wrappers/Edge.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
20 | ERROR | Unknown type hint "mixed" found for $node
--------------------------------------------------------------------------------
Time: 9.16 secs; Memory: 16MB
Steps to reproduce
Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig graphql_compose/
Proposed resolution
Fix all the issues and warnings for Drupal and DrupalPractice standards.
Remaining tasks
Patch review.
Ignored this errors, as I believe these are false positives:
FILE: ...al10/web/modules/contrib/graphql_compose/src/Wrapper/EntityTypeWrapper.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
69 | ERROR | Unknown type hint "mixed" found for $entity
--------------------------------------------------------------------------------
FILE: ...trib/graphql_compose/modules/graphql_compose_edges/src/Wrappers/Cursor.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
37 | ERROR | Unknown type hint "mixed" found for $sortValue
--------------------------------------------------------------------------------
FILE: ...ontrib/graphql_compose/modules/graphql_compose_edges/src/Wrappers/Edge.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
20 | ERROR | Unknown type hint "mixed" found for $node
--------------------------------------------------------------------------------
Time: 9.07 secs; Memory: 16MB
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | CreateComment.php_.jpg | 130.07 KB | urvashi_vora |
| #13 | GraphQLFieldRow.php_.jpg | 133.93 KB | urvashi_vora |
| coding-standard-fixes.patch | 5.81 KB | urvashi_vora |
Issue fork graphql_compose-3360955
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3360955-fix-the-issues
changes, plain diff MR !47
Comments
Comment #2
avpadernoThe report shows errors/warnings for 10 files, but the patch changes only four files.
Comment #3
imustakim commentedComment #4
almunningsAre you running PHPCS with PHP 8.1?
Comment #6
almunningsThank you for helping out on this module,
@apaderno and @imustakim,
Can you elaborate on your PHP/PHPCS settings and versions used? I am using the PHPCS shipped with "drupal/core-dev": "^10.0"
On dev, latest, I no longer see issues, and definitely cant see issues with 20 files.
I'm unsure what further requirements you have noticed
Comment #9
avpaderno@AlMunnings I am referring to the
phpcsreport shown in the issue summary. It shows warnings/errors for 10 files, but the patch changes only four files.Either the patch is not changing all the files that should be fixed, or the report is not for the branch for which the patch has been created.
Comment #10
urvashi_vora commented@apaderno, the report shows issue in 7 files only and not for 10 files, those are:
1. graphql_compose.api.php
2. uuid.admin.js
3. contriEntityTypeWrapper.php
4. GraphQLFieldRow.php
5. CreateComment.php
6. Cursor.php
7. Edge.php
Out of which, patch fixed errors for 4 files and if you see remaining tasks section in issue summary it mentions the issues present in the remaining 3 files.
Hope this helps.
Comment #11
avpaderno@AlMunnings I just ran
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twigfor the 2.0.x branch. I do not get any warning/error either.Comment #12
avpadernoLet's check some of the changes done from the patch.
diff --git a/modules/graphql_compose_comments/src/Plugin/GraphQL/DataProducer/CreateComment.php b/modules/graphql_compose_comments/src/Plugin/GraphQL/DataProducer/CreateComment.php index 3529526..bf7b4c7 100644 --- a/modules/graphql_compose_comments/src/Plugin/GraphQL/DataProducer/CreateComment.php +++ b/modules/graphql_compose_comments/src/Plugin/GraphQL/DataProducer/CreateComment.php @@ -95,7 +95,7 @@ class CreateComment extends DataProducerPluginBase implements ContainerFactoryPl * @throws \GraphQL\Error\UserError * First error violation returned from the comment entity validation. */ - public function resolve(array $data, ?EntityInterface $entity, RefinableCacheableDependencyInterface $metadata): ?CommentInterface { + public function resolve(array $data, EntityInterface $entity, RefinableCacheableDependencyInterface $metadata): ?CommentInterface {The src/Plugin/GraphQL/DataProducer/CreateComment.php file does not exist in the 2.0.x branch.
diff --git a/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php b/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php index 08af8fa..fd8fe9e 100644 --- a/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php +++ b/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php @@ -144,7 +144,7 @@ class GraphQLFieldRow extends RowPluginBase { * @param \Drupal\Core\Form\FormStateInterface $form_state * The form state. */ - public function validateAliasName($element, FormStateInterface $form_state) { + public function validateAliasName(array $element, FormStateInterface $form_state) { if (preg_match('@[^A-Za-z0-9]+@', $element['#value'])) { $form_state->setError($element, $this->t('The machine-readable name must contain only letters and numbers.')); }The src/Plugin/views/row/GraphQLFieldRow.php does not exist in the 2.0.x branch.
Comment #13
urvashi_vora commented@apaderno, I'm unsure of the reviewing process at your end. In order to assist you, please find the path for the files mentioned below, and I can confirm that both files do indeed exist:
1. "modules/graphql_compose_comments/src/Plugin/GraphQL/DataProducer/CreateComment.php"
2. "modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php"
Hope this helps you.
Marking the status to "RTBC", because it seems that there has been a slight oversight in the review process before updating it to "needs work" and now, you are finding a empty report on phpcs because @AlMunnings already committed the changes done by me for those files.
Thanks for wanting to help.
Comment #14
avpaderno@urvashi_vora Since you provided the patch, you cannot change the status to Reviewed & tested by the community.
I apologize: I was looking for the files in the wrong directory.
Still, replacing
?EntityInterface $entitywithEntityInterface $entityis not correct, since a parameter declared as instance of a class implemented by a module or a parameter declared as implementing an interface can be declared as nullable.Then, I do not get any error/warning when I run
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twigfor the 2.0.x branch.Comment #15
avpadernoNotice that AlMunnings has already done a commit, reported in comment #5. If there is anything left, the patch needs to be rerolled.
Comment #16
urvashi_vora commentedThanks for the feedback @apaderno
Comment #17
almunningsYeppers, I think we can mark this one as fixed with no further work required.
Comment #18
almunningsComment #20
avpaderno