Fix the issues reported by phpcs

Created on 2 February 2023, almost 2 years ago
Updated 24 May 2024, 6 months ago

Problem/Motivation

Getting the following phpcs errors/warnings:

FILE: /Documents/simple_popup_blocks/simple_popup_blocks.libraries.yml
---------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 10 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/simple_popup_blocks.info.yml
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
 6 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 38 | WARNING | Line exceeds 80 characters; contains 227 characters
----------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/simple_popup_blocks.module
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AFFECTING 9 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------
 41 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 41 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 1
 46 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 46 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
 47 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 47 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
 48 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 48 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 3
 49 | ERROR | [x] Closing brace indented incorrectly; expected 3 spaces, found 6
 55 | ERROR | [ ] unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
 62 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 62 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 1
 63 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 63 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 1
 64 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
 64 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 1
-----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/simple_popup_blocks.install
---------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------
 181 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 192 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/src/Form/SimplePopupBlocksEditForm.php
--------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 17 ERRORS AND 2 WARNINGS AFFECTING 14 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------
  21 | ERROR   | [x] Missing function doc comment
  25 | ERROR   | [x] Expected 1 blank line after function; 2 found
  33 | ERROR   | [x] Concat operator must be surrounded by a single space
  43 | ERROR   | [ ] unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
  59 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
  59 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 1
  66 | ERROR   | [x] Spaces must be used for alignment; tabs are not allowed
  66 | ERROR   | [x] Whitespace found at end of line
 123 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 150 | WARNING | [ ] Unused variable $first.
 215 | ERROR   | [x] Concat operator must be surrounded by a single space
 226 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 226 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 3
 226 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 3
 227 | ERROR   | [x] Object operator not indented correctly; expected 3 spaces but found 6
 234 | ERROR   | [x] Spaces must be used for alignment; tabs are not allowed
 234 | ERROR   | [x] Whitespace found at end of line
 238 | ERROR   | [x] Expected 1 blank line after function; 0 found
 239 | ERROR   | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/src/Form/SimplePopupBlocksAddForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 20 ERRORS AND 10 WARNINGS AFFECTING 21 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   6 | WARNING | [x] Unused use statement
   9 | WARNING | [x] Unused use statement
  11 | WARNING | [x] Unused use statement
  26 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  33 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  40 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  47 | ERROR   | [ ] Missing parameter comment
  47 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  48 | ERROR   | [ ] Missing parameter comment
  48 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  49 | ERROR   | [ ] Missing parameter comment
  49 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  51 | ERROR   | [x] There should be no white space before a closing ")"
  51 | ERROR   | [x] Expected 0 spaces before closing parenthesis; 1 found
 116 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 127 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 213 | WARNING | [ ] #options values usually have to run through t() for translation
 213 | WARNING | [ ] #options values usually have to run through t() for translation
 221 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 221 | ERROR   | [x] Whitespace found at end of line
 274 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 279 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 284 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 380 | ERROR   | [x] Expected one space after the comma, 0 found
 380 | ERROR   | [x] Expected one space after the comma, 0 found
 382 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 382 | ERROR   | [x] Concat operator must be surrounded by a single space
 398 | ERROR   | [x] Spaces must be used for alignment; tabs are not allowed
 398 | ERROR   | [x] Whitespace found at end of line
 403 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 21 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/src/SimplePopupBlocksStorage.php
---------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 1 WARNING AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------
  6 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
 11 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 21 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
 21 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 24 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
 24 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 35 | ERROR   | [x] Expected 1 blank line before function; 2 found
 58 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
 58 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 61 | ERROR   | [ ] Parameter tags must be grouped together in a doc comment
 61 | ERROR   | [x] Data types in @param tags need to be fully namespaced
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------


FILE: /Documents/simple_popup_blocks/src/Controller/SimplePopupBlocksController.php
----------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 2 WARNINGS AFFECTING 11 LINES
----------------------------------------------------------------------------------------------------------
  20 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  27 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  47 | ERROR   | [x] Expected 1 blank line after function; 2 found
  66 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  74 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
  78 | ERROR   | [x] Expected 1 space before "=="; 0 found
 115 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 118 | ERROR   | [x] Case breaking statements must be followed by a single blank line
 150 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 150 | ERROR   | [x] Concat operator must be surrounded by a single space
 153 | ERROR   | [x] Expected 1 blank line after function; 0 found
 154 | ERROR   | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------

Steps to reproduce

Run the following command from the module folder:

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .

Proposed resolution

Fix the errors and warnings.

๐Ÿ“Œ Task
Status

RTBC

Version

3.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia mrinalini9 New Delhi

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mrinalini9
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mrinalini9 New Delhi

    Added patch for the above fixes here, please review it.

  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines kenyoOwen

    Hi mrinalini9

    I applied patch #2 to the โ€œSimple Popup Blocksโ€ module and confirmed that the mentioned PHPCS issues are resolved. Please see the screenshots attached.

    For your review.
    Thank you.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
       /**
        * Messenger object.
        *
    -   * @var Messenger
    +   * @var \Drupal\Core\Messenger\Messenger
        */
       protected $messenger;
     
       /**
        * Connection object.
        *
    -   * @var Connection
    +   * @var \Drupal\Core\Database\Connection
        */
       private $database;

    Since those documentation comments are edited, the descriptions must be edited too, since they are missing an article each.
    It is not necessary to say Connection object; connection is sufficient.

       /**
    +   * The Config Factory object.
    +   *
    +   * @var \Drupal\Core\Config\ConfigFactoryInterface
    +   */
    +  protected $configFactory;

    Only the first word in the description is capitalized. The other words are not capitalized.

    +  /**
        * {@inheritdoc}
        */
    -  public function __construct(Messenger $messenger, Connection $database) {
    +  public function __construct(Messenger $messenger, Connection $database, ConfigFactoryInterface $config_factory) {

    {@inheritdoc} is not used for class constructors.

       /**
        * Messanger object.
        *
    -   * @var Messenger
    +   * @var \Drupal\Core\Messenger\Messenger
        */
       protected $messenger;

    Since that documentation comment is edited, also the short description need to be edited. It misses an article and there is a typo in Messanger.

    +  /**
        * SimplePopupBlocksAddForm constructor.
        *
    -   * @param EntityTypeManager $typeManager
    -   * @param Messenger $messenger
    -   * @param Connection $database
    +   * @param \Drupal\Core\Entity\EntityTypeManager $typeManager
    +   *   The entity type manager.
    +   * @param \Drupal\Core\Messenger\Messenger $messenger
    +   *   The messenger service.
    +   * @param \Drupal\Core\Database\Connection $database
    +   *   The database connection.
    +   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    +   *   The Config Factory.
        */
    -  public function __construct(EntityTypeManager $typeManager, Messenger $messenger, Connection $database ) {
    +  public function __construct(EntityTypeManager $typeManager, Messenger $messenger, Connection $database, ConfigFactoryInterface $config_factory) {

    The short description for a constructor starts with Constructs a new followed by the class name (namespace included) and ends with object.

    -    $config = \Drupal::service('config.factory')->getEditable('simple_popup_blocks.popup_'.$form_state->getValue('uid'));
    +    $config = \Drupal::service('config.factory')->getEditable('simple_popup_blocks.popup_' . $form_state->getValue('uid'));

    Form classes should use dependency injection, not calls to \Drupal methods. The configuration factory has been already injected and it should be used.

       /**
        * Save an entry in the simple_popup_blocks table.
        *
        * @param array $entry
        *   An array containing all the fields of the database record.
    -   *
    -   * @param Connection $database
    +   * @param \Drupal\Core\Database\Connection $database
        *   Connection object.

    Since that documentation comment is edited, the verb used in the short description needs to be edited too, as it needs to use the third person singular.

  • Assigned to sourabhjain
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    Fixed the issues mentioned in #4. Please review.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
       /**
    -   * Connection object.
    +   * Connection.

    The article is missing. Since the constructor parameter is described as The database connection. the same description should be used here.

       /**
    -   * {@inheritdoc}
    +   * The Config Factory object.
    +   *
    +   * @var \Drupal\Core\Config\ConfigFactoryInterface
    +   */
    +  protected $configFactory;
    

    That property is already defined from the parent class. This class does not need to define it again.

    +  /**
    +   * Constructs a new SimplePopupBlocksController object.
    +   *

    The short description is missing the class namespace.

    -    $configFactory = \Drupal::service('config.factory');
    +    $configFactory = $this->configFactory();
         $configs = $configFactory->listAll('simple_popup_blocks');

    There is not a configFactory() method. The method is ControllerBase::config().

       /**
    -   * Messanger object.
    +   * The messenger service.
        *
    -   * @var Messenger
    +   * @var \Drupal\Core\Messenger\Messenger
        */
       protected $messenger;

    That property is already defined by the parent class. Check which methods are inherited from the parent classes and verify which ones should be used.

    +   * @var \Drupal\Core\Config\ConfigFactoryInterface
        */
    -  public function __construct(EntityTypeManager $typeManager, Messenger $messenger, Connection $database ) {
    +  protected $configFactory;

    That property is already defined from the parent class.

    -    $config = \Drupal::service('config.factory')->getEditable('simple_popup_blocks.popup_'.$uid);
    +    $config = $this->configFactory->getEditable('simple_popup_blocks.popup_' . $uid);

    The method to use is $this->config().

     class SimplePopupBlocksEditForm extends SimplePopupBlocksAddForm {
     
    +  use StringTranslationTrait;
    +
    +  /**
    +   * The configuration factory.
    +   *
    +   * @var \Drupal\Core\Config\ConfigFactoryInterface
    +   */
    +  protected ConfigFactoryInterface $configFactory;
    +
       /**
        * {@inheritdoc}
        */
    @@ -18,19 +29,31 @@ class SimplePopupBlocksEditForm extends SimplePopupBlocksAddForm {
         return 'simple_popup_blocks_edit_form';
       }
     
    +  /**
    +   * {@inheritdoc}
    +   */
       protected function getEditableConfigNames() {
         return [
           'simple_popup_blocks_add_form.settings',
         ];
       }

    Given the defined methods, I get the parent class already has a $configFactory property this class does not need to redefine.

    +  /**
    +   * Constructs a AddToAnySettingsForm object.
    +   *
    +   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    +   *   The factory for configuration objects.
    +   */
    +  public function __construct(ConfigFactoryInterface $configFactory) {
    +    $this->configFactory = $configFactory;
    +  }

    Since that code is in the SimplePopupBlocksEditForm.php file, the constructor cannot be for the AddToAnySettingsForm class.
    The constructor description must start with Constructs a new followed by the class name (namespace included).

    -   * @param Connection $database
    +   * @param \Drupal\Core\Database\Connection $database
        *   Connection object.

    Since the description used in another file is The database connection. that should be the description used in this case too.

    -   * @param Messenger $messenger
    +   * @param \Drupal\Core\Messenger\Messenger $messenger
        *   Messenger object.

    The article is missing from the description.

  • Assigned to imustakim
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Working on this.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Update patch and interdiff file attached.

    Including the class namespace in constructor description exceeds the character limit and show and error in phpcs.
    Assuming this can be ignored. All the suggestion mentioned in #7 ๐Ÿ“Œ Fix the issues reported by phpcs Needs review are updated in the patch.

    Please review.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
     function simple_popup_blocks_update_8104(&$sandbox) {
     
    -    $trigger_width = [
    -      'type' => 'int',
    -      'not null' => FALSE,
    -      'default' => NULL,
    -      'description' => "Trigger width in px",
    -    ];
    +  $trigger_width = [
    +    'type' => 'int',
    +    'not null' => FALSE,
    +    'default' => NULL,
    +    'description' => "Trigger width in px",
    +  ];

    Since that code is changed, the empty line after the function declaration must be removed.

     use Drupal\Core\Database\Connection;
    -use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
     use Drupal\Core\Entity\EntityTypeManager;
     use Drupal\Core\Messenger\Messenger;
    -use Drupal\Core\Url;
     use Drupal\Core\Form\ConfigFormBase;
    -use Drupal\Core\Form\FormInterface;
     use Drupal\Core\Form\FormStateInterface;
     use Drupal\Core\StringTranslation\StringTranslationTrait;
     use Symfony\Component\DependencyInjection\ContainerInterface;
    +use Drupal\Core\Config\ConfigFactoryInterface;

    use statements must be ordered alphabetically. This is also reported from the recent rulesets for Drupal.

        * Object of EntityTypeManager.
        *
    -   * @var EntityTypeManager
    +   * @var \Drupal\Core\Entity\EntityTypeManager

    Since that comment has been changed, even the description must be changed.

    -   * Messanger object.
    +   * The messenger service.
        *
    -   * @var Messenger
    +   * @var \Drupal\Core\Messenger\Messenger

    It is not necessary to say service.

       /**
    -   * Database object.
    +   * Connection.
        *
    -   * @var Connection
    +   * @var \Drupal\Core\Database\Connection
        */
       protected $database;

    The usual description is The database connection.

    +  /**
    +   * Constructs a new SimplePopupBlocksAddForm object.
    +   *
    +   * @param \Drupal\Core\Entity\EntityTypeManager $typeManager
    +   *   The entity type manager.
    +   * @param \Drupal\Core\Messenger\Messenger $messenger
    +   *   The messenger service.
    +   * @param \Drupal\Core\Database\Connection $database
    +   *   The database connection.
    +   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    +   *   The Config Factory.
    +   */

    The documentation comment for constructors is not mandatory anymore. If it is added, the class name in the description must include the namespace.

    +   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    +   *   The factory for configuration objects.

    The configuration factory. is sufficient.

        * Save an entry in the simple_popup_blocks table.
        *
        * @param array $entry
        *   An array containing all the fields of the database record.
    -   *
    -   * @param Connection $database
    -   *   Connection object.
    -   *
    -   * @param Messenger $messenger
    -   *   Messenger object.
    +   * @param \Drupal\Core\Database\Connection $database
    +   *   The database connection.
    +   * @param \Drupal\Core\Messenger\Messenger $messenger
    +   *   The messenger service.

    Since that comment is changed, Save must be replaced with Saves.

    -   * @param Connection $database
    +   * @param \Drupal\Core\Database\Connection $database
        *   Connection object.
    -   *
    -   * @param Messenger $messenger
    +   * @param \Drupal\Core\Messenger\Messenger $messenger
        *   Messenger object.

    Those descriptions are each missing a definite article.

  • Assigned to imustakim
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Patch updated.
    Please review.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Please ignore the #13 patch.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sanjayk

    I have tested and got one phpcs issue. I have fixed in new patch.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -      if (windowWidth < values.trigger_width) {return null;};
    +      if (windowWidth < values.trigger_width) {return NULL;};

    In Javascript, null, true, and false are used.

    +   * Constructs a new.
    +   *
    +   * Drupal\simple_popup_blocks\Controller\SimplePopupBlocksController.
    +   * object.

    A method description goes on a single line.

    +   * @param \Drupal\Core\Messenger\Messenger $messenger
    +   *   The messenger.
    +   * @param \Drupal\Core\Database\Connection $database
    +   *   The messenger.

    The second parameter is not the messenger, which is the first parameter.

    +   * The config factory.
    +   *
    +   * @var \Drupal\Core\Config\ConfigFactoryInterface

    There is no need to define that property, as it is already provided by the parent class.

    + $data = $this->configFactory->get($config);

    The parent class provides config() for exactly that purpose.

    +  /**
    +   * The config factory.
    +   *
    +   * @var \Drupal\Core\Config\ConfigFactoryInterface
    +   */
    +  protected $configFactory;
    +

    That property is already defined from the parent class (ConfigFormBase).

    -      '#default_value' => t("custom-css-id"),
    +      '#default_value' => $this->t("custom-css-id"),

    The default value must be the previously entered value, which is stored in the configuration object.

    -    $config = \Drupal::service('config.factory')->getEditable('simple_popup_blocks.popup_'.$uid);
    +    $config = $this->configFactory->getEditable('simple_popup_blocks.popup_' . $uid);

    In a class that extends ConfigFormBase, the correct method to call is $this->config().

  • Assigned to Dharmendra.s
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Dharmendra.s Delhi India
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    @Dharmendra.s any update on this? Can I make this unassigned?

  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    I am resetting the Assigned field, since the assigned person has not worked on the issue in the past 24 hours.

  • Assigned to zniki.ru
  • @znikiru opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    It looks like changes in # 3291171 ๐Ÿ“Œ Coding standards problems Fixed (commit ed93d92a) was only applied to 8.x-2.x and was not applied to 8.x-3.x.
    Do we need to cherry-pick it?

    I create MR #15, please make a review.

  • First commit to issue fork.
  • Merge request !188.x 3.x โ†’ (Closed) created by chaitanyadessai
  • Status changed to RTBC 6 months ago
  • Hi @Nikolay Shapovalov,

    Applied MR !15 against version 8.x-3.x-dev, no issues found.

    contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig simple_popup_blocks/
    โžœ  contrib git:(main) โœ—

    Will change the status to RTBC
    Thank you.

Production build 0.71.5 2024