Problem/Motivation
Run a standard check against the Drupal coding standards (./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md):
FILE: /app/web/modules/contrib/field_encrypt/src/Form/SettingsForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
136 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...pp/web/modules/contrib/field_encrypt/src/Form/EntityTypeForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
184 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: .../field_encrypt/src/Plugin/QueueWorker/UpdateEntityEncryption.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...encrypt/src/Plugin/Field/FieldType/EncryptedFieldStorageItem.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
95 | ERROR | unserialize() is insecure unless allowed classes are
| | limited. Use a safe format like JSON or use the
| | allowed_classes option.
----------------------------------------------------------------------
FILE: ...les/contrib/field_encrypt/tests/src/Functional/KeyChangeTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
38 | WARNING | [x] '@TODO: Simplify setUp() by extending
| | EncryptTestBase when
| | https://www.drupal.org/node/2692387 lands.'
| | should match the format '@todo Fix problem X
| | here.'
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...trib/field_encrypt/tests/src/Functional/FieldEncryptTestBase.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
58 | WARNING | [x] '@TODO: Simplify setUp() by extending
| | EncryptTestBase when
| | https://www.drupal.org/node/2692387 lands.'
| | should match the format '@todo Fix problem X
| | here.'
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...s/contrib/field_encrypt/tests/src/Functional/EntityHooksTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
36 | WARNING | [x] '@TODO: Simplify setUp() by extending
| | EncryptTestBase when
| | https://www.drupal.org/node/2692387 lands.'
| | should match the format '@todo Fix problem X
| | here.'
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...les/contrib/field_encrypt/tests/src/Functional/BaseFieldTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
43 | WARNING | [x] '@TODO: Simplify setUp() by extending
| | EncryptTestBase when
| | https://www.drupal.org/node/2692387 lands.'
| | should match the format '@todo Fix problem X
| | here.'
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...s/contrib/field_encrypt/tests/src/Functional/EncryptUserTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
36 | WARNING | [x] '@TODO: Simplify setUp() by extending
| | EncryptTestBase when
| | https://www.drupal.org/node/2692387 lands.'
| | should match the format '@todo Fix problem X
| | here.'
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...crypt/tests/modules/field_encrypt_test/field_encrypt_test.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
80 | ERROR | [x] Data types in @var tags need to be fully namespaced
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: /app/web/modules/contrib/field_encrypt/field_encrypt.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
69 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------Issue fork field_encrypt-3312771
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:
- 3312771-fix_coding_standards
changes, plain diff MR !34
Comments
Comment #3
ptmkenny commentedThis MR fixes all the above-reported issues except
I'm not sure what the best way to fix this is because according to a comment in the PHP manual, "allowed_classes does not use inheritance" (https://www.php.net/manual/en/function.unserialize.php#125543) so it seems we would have to somehow generate an exhaustive list...
Comment #4
LeoAlcci commentedI will review and work on it!
Comment #5
LeoAlcci commentedThanks for the contribution @ptmkenny, I fixed all phpcs issues, please kindly review It.
Comment #6
LeoAlcci commentedComment #7
Arturo-q commentedHi, I will review it.
Comment #8
Arturo-q commented@leoAlcci thanks for the contribution, I reviewed it and all CS errors/warnings are gone and all the test passed as well.
Moving to RTBC.
Comment #9
ptmkenny commented@Arturo1007 Did you test actually using this module and enabling encryption for some content types? Simply saying "the tests passed" isn't really an RTBC review, because the tests are run automatically anyway.
Comment #11
alexpottComment #12
alexpott