[2.0.0-alpha2] Field Formatters: Code quality improvments

Created on 5 April 2024, 8 months ago
Updated 23 April 2024, 7 months ago

vendor/bin/phpcs --standard=Drupal docroot/modules/custom

FILE: modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldPropertiesSourceSlot.php
  57 | ERROR | Missing short description in doc comment
  57 | ERROR | Parameter $field_index is not described in comment
  58 | ERROR | Missing parameter comment
  59 | ERROR | Missing parameter comment
  59 | ERROR | Missing parameter type
  60 | ERROR | Missing parameter comment
  60 | ERROR | Missing parameter type
  62 | ERROR | Description for the @return value is missing
 100 | ERROR | Parameter $field_index is not described in comment
 112 | ERROR | Description for the @return value is missing
 213 | ERROR | Missing parameter comment
 214 | ERROR | Missing parameter comment
 215 | ERROR | Missing parameter comment
 217 | ERROR | Description for the @return value is missing

FILE: modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/EntityReferenceFormBase.php
  74 | ERROR   | Missing parameter comment
  76 | ERROR   | Description for the @return value is missing
 118 | WARNING | Line exceeds 80 characters; contains 194 characters
 126 | ERROR   | Description for the @return value is missing

FILE: modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/UiPatternsFieldFormattersSourceBase.php
 132 | ERROR | Missing parameter comment
 134 | ERROR | Description for the @return value is missing
 205 | ERROR | Missing parameter comment
 206 | ERROR | Missing parameter comment
 208 | ERROR | Description for the @return value is missing
 229 | ERROR | Missing parameter comment
 231 | ERROR | Description for the @return value is missing
 250 | ERROR | Description for the @return value is missing
 263 | ERROR | Missing parameter comment
 265 | ERROR | Description for the @return value is missing

FILE: modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldFormatterFormSourceBase.php
  80 | ERROR | Description for the @return value is missing
 110 | ERROR | Missing parameter comment
 112 | ERROR | Description for the @return value is missing
 176 | ERROR | Missing parameter comment
 180 | ERROR | Description for the @return value is missing
 222 | ERROR | Missing parameter comment
 224 | ERROR | Description for the @return value is missing
 275 | ERROR | Missing parameter comment
 277 | ERROR | Description for the @return value is missing
 295 | ERROR | Missing parameter comment

FILE: modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldPropertiesSourceBase.php
 142 | ERROR | Missing parameter comment
 160 | ERROR | Missing parameter type
 165 | ERROR | Description for the @return value is missing

FILE: modules/ui_patterns_field_formatters/src/Plugin/Derivative/FieldPropertiesSourceDeriverBase.php
  94 | ERROR   | Missing parameter comment
  95 | ERROR   | Missing parameter comment
 138 | WARNING | Line exceeds 80 characters; contains 110 characters
 141 | WARNING | Line exceeds 80 characters; contains 118 characters
 142 | ERROR   | Comment indentation error, expected only 1 spaces
 148 | WARNING | Line exceeds 80 characters; contains 101 characters
 149 | WARNING | Line exceeds 80 characters; contains 114 characters
 149 | ERROR   | Comment indentation error, expected only 1 spaces
 182 | ERROR   | Missing parameter comment
 182 | ERROR   | Missing parameter type
 267 | ERROR   | Missing parameter comment
 268 | ERROR   | Missing parameter comment
 269 | ERROR   | Missing parameter comment
 270 | ERROR   | Missing parameter comment
 271 | ERROR   | Missing parameter comment
 272 | ERROR   | Missing parameter comment
 274 | ERROR   | Description for the @return value is missing

FILE: modules/ui_patterns_field_formatters/tests/src/Kernel/PluginTest.php
  26 | ERROR   | Missing member variable doc comment
  39 | ERROR   | Description for the @return value is missing
  96 | ERROR   | Description for the @return value is missing
 118 | ERROR   | Missing parameter comment
 119 | ERROR   | Missing parameter comment
 119 | ERROR   | Missing parameter type
 121 | ERROR   | Description for the @return value is missing
 128 | WARNING | Line exceeds 80 characters; contains 104 characters
 131 | WARNING | Line exceeds 80 characters; contains 112 characters
 132 | ERROR   | Comment indentation error, expected only 1 spaces
 138 | WARNING | Line exceeds 80 characters; contains 95 characters
 139 | WARNING | Line exceeds 80 characters; contains 108 characters
 139 | ERROR   | Comment indentation error, expected only 1 spaces
 155 | ERROR   | Missing parameter comment
 156 | ERROR   | Missing parameter comment
 157 | ERROR   | Missing parameter comment
 159 | ERROR   | Description for the @return value is missing
 170 | ERROR   | Description for the @return value is missing

FILE: modules/ui_patterns_field_formatters/tests/src/Kernel/RenderTest.php
  10 | ERROR   | Missing short description in doc comment
  26 | ERROR   | Missing short description in doc comment
  28 | ERROR   | Missing @var tag in member variable comment
  40 | ERROR   | Missing member variable doc comment
  40 | ERROR   | Class property $source_id should use lowerCamel naming without underscores
  67 | WARNING | Line exceeds 80 characters; contains 174 characters
  82 | ERROR   | Description for the @return value is missing
 117 | ERROR   | Missing short description in doc comment
 117 | ERROR   | Parameter $type is not described in comment
 118 | ERROR   | Missing parameter comment
 119 | ERROR   | Missing parameter comment
 120 | ERROR   | Missing parameter comment
 121 | ERROR   | Missing parameter comment
 122 | ERROR   | Missing parameter comment
 123 | ERROR   | Missing parameter comment
 125 | ERROR   | Description for the @return value is missing
 155 | ERROR   | Description for the @return value is missing
 158 | WARNING | '@todo' should match the format '@todo Fix problem X here.'

FILE: modules/ui_patterns_field_formatters/tests/src/Kernel/UIPatternsFieldFormattersTestBase.php
 37 | ERROR   | Missing short description in doc comment
 42 | ERROR   | Missing member variable doc comment
 42 | ERROR   | There must not be more than one property declared per statement
 42 | ERROR   | Missing member variable doc comment
 44 | ERROR   | Missing short description in doc comment
 48 | ERROR   | Missing short description in doc comment
 64 | WARNING | Line exceeds 80 characters; contains 174 characters
 72 | ERROR   | Description for the @return value is missing

PHPMD

Trait method setComponentConfiguration has not been applied, because there are collisions with other trait methods on Drupal\ui_patterns_field_formatters\Plugin\Field\FieldFormatter\ComponentFormatterBase.

vendor/bin/drupal-check docroot/modules/custom

  Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/Derivative/FieldPropertiesSourceDeriverBase.php  
  369    Call to an undefined method                                                                                  
         Drupal\Core\Field\FieldStorageDefinitionInterface::getItemDefinition().                                      
  Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/Field/FieldFormatter/ComponentFormatterBase.php  
  128    Variable $generator in PHPDoc tag @var does not exist.                                                       
  Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/EntityReferenceFormBase.php  
  112    Call to an undefined method                                                                                
         Drupal\Core\Field\FieldStorageDefinitionInterface::getItemDefinition().                                    
  Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldPropertiesSourceBase.php  
  70     Variable $field in PHPDoc tag @var does not exist.                                                           
  177    Call to an undefined method                                                                                  
         Drupal\Core\Entity\EntityInterface::hasField().                                                              
  187    Call to an undefined method                                                                                  
         Drupal\Core\Entity\EntityInterface::get().                                                                   
  Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldPropertiesSourceSlot.php  
  71     Call to an undefined method                                                                                  
         Drupal\Core\Field\FieldDefinitionInterface::get().                                                           
  117    Call to an undefined method                                                                                  
         Drupal\Core\Field\FieldItemListInterface::getIterator().                                                     
  153    Variable $target in empty() always exists and is not falsy.                                                  
  156    Call to an undefined method                                                                                  
         Drupal\Core\TypedData\TypedDataInterface::getEntity().                                                       
  173    Call to an undefined method                                                                                  
         Drupal\Core\Field\FieldItemInterface::getPluginId().                                                         
  174    Call to an undefined method                                                                                  
         Drupal\Core\TypedData\TypedDataInterface::toArray().                                                         
  224    Call to an undefined method                                                                                  
         Drupal\Core\Field\FieldItemListInterface::getIterator().                                                     
  Line   ui_patterns/modules/ui_patterns_field_formatters/tests/src/Kernel/RenderTest.php  
  31     Class Drupal\Tests\ui_patterns_field_formatters\Kernel\RenderTest                 
         uses unknown trait Drupal\Tests\sdc\Traits\ComponentRendererTrait.                
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols               
  38     Property                                                                          
         Drupal\Tests\ui_patterns_field_formatters\Kernel\RenderTest::$adminUser           
         has unknown class Drupal\User\UserInterface as its type.                          
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                           
📌 Task
Status

Fixed

Version

2.0

Component

UI Patterns Field Formatters [2.x only]

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @pdureau
  • First commit to issue fork.
  • Status changed to Needs review 8 months ago
  • Status changed to Needs work 8 months ago
  • 🇫🇷France pdureau Paris

    thanks you for this big piece of work, done so fast.

    However, you may have forgotten about the test/ folder:

    • modules/ui_patterns_field_formatters/tests/src/Kernel/PluginTest.php
    • modules/ui_patterns_field_formatters/tests/src/Kernel/RenderTest.php
    • modules/ui_patterns_field_formatters/tests/src/Kernel/UIPatternsFieldFormattersTestBase.php

    And about this issue:

    Trait method setComponentConfiguration has not been applied, because there are collisions with other trait methods on Drupal\ui_patterns_field_formatters\Plugin\Field\FieldFormatter\ComponentFormatterBase.

    And phpstan results:

    vendor/bin/drupal-check docroot/modules/custom
     ------ ------------------------------------------------------------------------------------------------------------- 
      Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/Derivative/FieldPropertiesSourceDeriverBase.php  
      394    Call to an undefined method                                                                                  
             Drupal\Core\Field\FieldStorageDefinitionInterface::getItemDefinition().                                      
     ------ ------------------------------------------------------------------------------------------------------------- 
      Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/Field/FieldFormatter/ComponentFormatterBase.php  
      128    Variable $generator in PHPDoc tag @var does not exist.                                                       
     ------ ------------------------------------------------------------------------------------------------------------- 
      Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/EntityReferenceFormBase.php  
      111    Call to an undefined method                                                                                
             Drupal\Core\Field\FieldStorageDefinitionInterface::getItemDefinition().                                    
     ------ ----------------------------------------------------------------------------------------------------------- 
      Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldFormatterFormSourceBase.php  
      324    Cannot unset offset 'field_link' on array<int, mixed>.                                                          
     ------ ---------------------------------------------------------------------------------------------------------------- 
      Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldPropertiesSourceBase.php  
     ------ ------------------------------------------------------------------------------------------------------------- 
      70     Variable $field in PHPDoc tag @var does not exist.                                                           
      182    Call to an undefined method                                                                                  
             Drupal\Core\Entity\EntityInterface::hasField().                                                              
      192    Call to an undefined method                                                                                  
             Drupal\Core\Entity\EntityInterface::get().                                                                   
     ------ ------------------------------------------------------------------------------------------------------------- 
      Line   ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldPropertiesSourceSlot.php  
      80     Call to an undefined method                                                                                  
             Drupal\Core\Field\FieldDefinitionInterface::get().                                                           
      131    Call to an undefined method                                                                                  
             Drupal\Core\Field\FieldItemListInterface::getIterator().                                                     
      167    Variable $target in empty() always exists and is not falsy.                                                  
      170    Call to an undefined method                                                                                  
             Drupal\Core\TypedData\TypedDataInterface::getEntity().                                                       
      187    Call to an undefined method                                                                                  
             Drupal\Core\Field\FieldItemInterface::getPluginId().                                                         
      188    Call to an undefined method                                                                                  
             Drupal\Core\TypedData\TypedDataInterface::toArray().                                                         
      239    Call to an undefined method                                                                                  
             Drupal\Core\Field\FieldItemListInterface::getIterator().                                                     
     ------ ------------------------------------------------------------------------------------------------------------- 
      Line   ui_patterns/modules/ui_patterns_field_formatters/tests/src/Kernel/RenderTest.php  
      31     Class Drupal\Tests\ui_patterns_field_formatters\Kernel\RenderTest                 
             uses unknown trait Drupal\Tests\sdc\Traits\ComponentRendererTrait.                
             💡 Learn more at https://phpstan.org/user-guide/discovering-symbols               
      38     Property                                                                          
             Drupal\Tests\ui_patterns_field_formatters\Kernel\RenderTest::$adminUser           
             has unknown class Drupal\User\UserInterface as its type.                          
             💡 Learn more at https://phpstan.org/user-guide/discovering-symbols               
    
  • Status changed to Needs review 8 months ago
  • 🇫🇷France just_like_good_vibes PARIS

    Merge request updated, please have a look.
    sorry but during phpstan and phpcs phase, i had to update some small things inside the code to minimally improve it.

  • Status changed to Fixed 8 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024