Fix the issues reported by phpcs

Created on 10 April 2023, about 2 years ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

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

Merge Requests

Comments & Activities

  • Issue created by @sidharth_soman
  • Status changed to Needs work about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

    Finding coding standard issues as detailed in the issue summary. I will work on fixing them.

  • Merge request !7Fixed phpcs issues. โ†’ (Closed) created by sidharth_soman
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

    I have fixed all of the issues except for those relating to documentation. I have issued the MR against the 8.x-1.x branch.
    Please review.

  • Issue was unassigned.
  • Status changed to RTBC about 2 years ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines kenyoOwen

    Hi sidharth_soman

    I applied your MR and confirmed that it resolved the issues except for those related to documentation. Please see the screenshots attached.

    For your review.
    Thank you.

  • Status changed to Needs work about 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
      * @param $form
    - * @param FormStateInterface $form_state
    + * @param \Drupal\Core\Form\FormStateInterface $form_state
      * @param $form_id
      */
     function field_config_cardinality_form_alter(&$form, FormStateInterface $form_state, $form_id) {

    What the report says is that for hook implementation, parameters are not described. In fact, the short description for a hook implementation and sole part of its documentation comment is totally different.

    - * @param FormStateInterface $form_state
    + * @param \Drupal\Core\Form\FormStateInterface $form_state
      */
    -function field_config_cardinality_form_builder($entity_type, \Drupal\field\Entity\FieldConfig $config, &$form, FormStateInterface $form_state) {
    +function field_config_cardinality_form_builder($entity_type, FieldConfig $config, &$form, FormStateInterface $form_state) {
       if ($form_state->getValue('cardinality') === 'number' && $form_state->getValue('cardinality_number')) {
         $cardinality_config = $form_state->getValue('cardinality_number');
       }

    The same holds true here.

     /**
    - * Implements hook_form_alter().
    + * Implements hook_form_FORM_ID_alter().
      *
      * @param $elements
    - * @param FormStateInterface $form_state
    + * @param \Drupal\Core\Form\FormStateInterface $form_state
      * @param $context
      */
     function field_config_cardinality_field_widget_multivalue_form_alter(&$elements, FormStateInterface $form_state, $context) {

    Those @param tags are not necessary.

    -  // Implementation for multi managed_file
    +  // Implementation for multi managed_file.
       if (!empty($elements['#type']) && $elements['#type'] == 'managed_file') {
         if (!empty($cardinality_config) && $cardinality_config >= 1) {
           if ($elements['#delta'] > $cardinality_config - 1) {
    @@ -215,7 +216,7 @@ function field_config_cardinality_field_widget_multivalue_form_alter(&$elements,
         }
       }
     
    -  // Implementation for multi select type
    +  // Implementation for multi select type.
       if (!empty($elements['#type']) && $elements['#type'] == 'select') {

    I would rather remove those comments, since they describe something that is already clear from the code.

    +/**
    + *
    + */
     class CardinalityMediaLibraryWidget extends MediaLibraryWidget {

    Either the documentation comment is not empty or it is not added.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    zkhan.aamir โ†’ made their first commit to this issueโ€™s fork.

  • First commit to issue fork.
  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Addressed the comment in #8. Please review.

  • Status changed to Closed: outdated 19 days ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
Production build 0.71.5 2024