Fix the issues reported by phpcs

Created on 28 February 2019, over 6 years ago
Updated 13 May 2023, over 2 years ago

Fix the following coding standard errors, where appropriate. I removed some that might affect backwards compatibility.

'/users/local/bin/phpcs' --standard=vendor/drupal/coder/coder_sniffer/Drupal/'

FILE: /Users/oknate/dev/drupal/entity_browser/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 20 | WARNING | Line exceeds 80 characters; contains 101 characters
----------------------------------------------------------------------


FILE: ...ate/dev/drupal/entity_browser/src/Ajax/SelectEntitiesCommand.php
----------------------------------------------------------------------
FOUND 1 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------
  9 | ERROR | Doc comment short description must be on a single line,
    |       | further text should be a separate paragraph

----------------------------------------------------------------------

FILE: .../drupal/entity_browser/src/Element/EntityBrowserPagerElement.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 28 | ERROR | Tags must be grouped together in a doc comment
 30 | ERROR | Tags must be grouped together in a doc comment
----------------------------------------------------------------------

FILE: .../oknate/dev/drupal/entity_browser/src/EntityBrowserInterface.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
 53 | ERROR | Parameter $widget_selector is not described in comment
 56 | ERROR | Doc comment for parameter $display does not match
    |       | actual variable name $widget_selector
 64 | ERROR | Parameter $selection_display is not described in
    |       | comment
 67 | ERROR | Doc comment for parameter $display does not match
    |       | actual variable name $selection_display
----------------------------------------------------------------------

FILE: ...upal/entity_browser/src/Events/AlterEntityBrowserDisplayData.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 90 | ERROR | Type hint "array" missing for $data
----------------------------------------------------------------------

FILE: ...te/dev/drupal/entity_browser/src/Events/EntitySelectionEvent.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 35 | ERROR | Description for the @return value is missing
----------------------------------------------------------------------

FILE: /Users/oknate/dev/drupal/entity_browser/src/Events/Events.php
----------------------------------------------------------------------
FOUND 4 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
 12 | ERROR   | Doc comment short description must be on a single
    |         | line, further text should be a separate paragraph
 19 | WARNING | Line exceeds 80 characters; contains 82 characters
 20 | WARNING | Line exceeds 80 characters; contains 85 characters
 20 | ERROR   | Doc comment short description must be on a single
    |         | line, further text should be a separate paragraph
 27 | WARNING | Line exceeds 80 characters; contains 82 characters
 29 | ERROR   | Doc comment short description must be on a single
    |         | line, further text should be a separate paragraph
 36 | WARNING | Line exceeds 80 characters; contains 81 characters
 37 | ERROR   | Doc comment short description must be on a single
    |         | line, further text should be a separate paragraph
----------------------------------------------------------------------



FILE: /Users/oknate/dev/drupal/entity_browser/src/Permissions.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 34 | ERROR | Missing parameter comment
----------------------------------------------------------------------


FILE: ...drupal/entity_browser/src/Plugin/EntityBrowser/Widget/Upload.php
----------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------
 101 | ERROR   | If the line declaring an array spans longer than 80
     |         | characters, each element should be broken into its
     |         | own line
 102 | ERROR   | If the line declaring an array spans longer than 80
     |         | characters, each element should be broken into its
     |         | own line
 102 | ERROR   | If the line declaring an array spans longer than 80
     |         | characters, each element should be broken into its
     |         | own line
 157 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------


FILE: ...er/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 772 | ERROR | If the line declaring an array spans longer than 80
     |       | characters, each element should be broken into its own
     |       | line
----------------------------------------------------------------------


FILE: ...ntity_browser/src/Plugin/Field/FieldWidget/FileBrowserWidget.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
 100 | ERROR | Doc comment for parameter $mime_type_guesser does not
     |       | match actual variable name <undefined>
 388 | ERROR | If the line declaring an array spans longer than 80
     |       | characters, each element should be broken into its own
     |       | line
 405 | ERROR | If the line declaring an array spans longer than 80
     |       | characters, each element should be broken into its own
     |       | line
----------------------------------------------------------------------

FILE: ...upal/entity_browser/src/Plugin/views/filter/ContextualBundle.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
  53 | ERROR | Parameter $selection_storage is not described in
     |       | comment
 198 | ERROR | Type hint "array" missing for $input
----------------------------------------------------------------------

FILE: /Users/oknate/dev/drupal/entity_browser/src/RouteSubscriber.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 50 | ERROR | Inline doc block comments are not allowed; use "/*
    |       | Comment */" or "// Comment" instead
----------------------------------------------------------------------

FILE: /Users/oknate/dev/drupal/entity_browser/src/WidgetBase.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 360 | ERROR | Doc comment short description must be on a single
     |       | line, further text should be a separate paragraph
----------------------------------------------------------------------

FILE: /Users/oknate/dev/drupal/entity_browser/src/WidgetInterface.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 77 | WARNING | Line exceeds 80 characters; contains 83 characters
----------------------------------------------------------------------

FILE: ...sers/oknate/dev/drupal/entity_browser/src/WidgetSelectorBase.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 28 | ERROR | Class property $widgets_ids should use lowerCamel
    |       | naming without underscores
----------------------------------------------------------------------

FILE: ...rowser/tests/fixtures/update/entity_browser.update-hook-test.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 4 | ERROR | [x] Doc comment short description must be on the first
   |       |     line
----------------------------------------------------------------------


FILE: ...sts/src/FunctionalJavascript/EntityBrowserJavascriptTestBase.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 18 | WARNING | Line exceeds 80 characters; contains 95 characters
----------------------------------------------------------------------

FILE: ...ity_browser/tests/src/FunctionalJavascript/EntityBrowserTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 116 | WARNING | Line exceeds 80 characters; contains 96 characters
----------------------------------------------------------------------

FILE: ...browser/tests/src/FunctionalJavascript/FieldWidgetConfigTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 148 | WARNING | Line exceeds 80 characters; contains 104 characters
----------------------------------------------------------------------
šŸ“Œ Task
Status

RTBC

Version

2.0

Component

Miscellaneous

Created by

šŸ‡®šŸ‡³India jigish.addweb

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    I am not sure why only the Drupal ruleset is used, when there is also the DrupalPractice ruleset.

  • Status changed to Needs work over 2 years ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Assigned to Kaustab_Roy
  • Issue was unassigned.
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    Issues should be assigned to somebody who creates a patch or a MR in the next hours, not after more than 12 hours. This means blocking an issue for which somebody else could have worked on.

  • šŸ‡®šŸ‡³India sakthi_dev

    Created a patch after verifying with DrupalPractice ruleset with . Please review.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
      * @addtogroup hooks
    - * @{

    The last line is necessary and it should not be removed.

     /**
    - * Alter the information provided in \Drupal\entity_browser\Annotation\EntityBrowserDisplay.
    + * Alter the information provided in.
    + *
    + * \Drupal\entity_browser\Annotation\EntityBrowserDisplay.

    Short descriptions cannot be split like that.
    Alter must use the third person singular.

    - * TODO see if we can get away without overriding entire IEF function.
    + * @todo see if we can get away without overriding entire IEF function.

    What follows @todo is a sentence: It starts with a capitalized word and ends with a period (preferable), a question mark, or an exclamation mark.

     /**
    - * AJAX command to rerender a formatted text field without any transformation
    - * filters.
    + * AJAX command to rerender a formatted text without transformation filters.
      */

    I am not sure that removing field is correct. The existing comment is about a field, while the changed comment is about a formatted text (which is not a field).

       /**
    -   * The ID for the details element.
    +   * Details element ID.
    

    That description is missing a definite article.

     /**
    - * Class EntityBrowserEditForm.
    + * Entity browser edit form class.
      */
     class EntityBrowserEditForm extends EntityForm {

    That description does not say what the class does.

    -    if ($storage = $this->selectionStorage->get($form_state->get(['entity_browser', 'instance_uuid']))) {
    +    if ($storage = $this->selectionStorage->get($form_state->get([
    +      'entity_browser',
    +      'instance_uuid',
    +    ]))) {

    As per Drupal coding standards, control structure conditions can be written on a single line, if they are more readable. In this case, the existing code is more readable.

    -  /**
    -   * {@inheritdoc}
    -   */
    -  public function displayEntityBrowser(array $element, FormStateInterface $form_state, array &$complete_form, array $persistent_data = []) {
    -    parent::displayEntityBrowser($element, $form_state, $complete_form, $persistent_data);
    -    // @TODO Implement it.
    -  }
    -
       /**
        * {@inheritdoc}
        */
       public function selectionCompleted(array $entities) {
    -    // @TODO Implement it.
    +    // @todo Implement it.
       }

    The first method cannot be removed, exactly for the same reason the other one has not been removed: It contains a @todo tag.

    +  /**
    +   * Turns a render array into an HTML string.
    +   *
    +   * @var Drupal\Core\Render\RendererInterface
    +   */
    +  public $renderer;

    That description says for what that property is used; it needs to say what that property contains.

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

    The description for a constructor must start with Constructs a new followed by the class name (including its namespace), and end with object.

    +   * @param string $plugin_id
    +   *   The plugin_id for the plugin instance.

    plugin_id is not an English word.
    It is not necessary to say for the plugin instance, since that is a plugin ID.

    +   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
    +   *   Event dispatcher service.

    The description is missing a definite article.

    +   * @param \Drupal\entity_browser\WidgetValidationManager $validation_manager
    +   *   The Widget Validation Manager service.

    Only the first word in the description must be capitalized.
    There is no need to say service.

    +   * @param Drupal\Core\Render\RendererInterface $renderer
    +   *   Turns a render array into an HTML string.

    That is not the description of what $render contains.

    +    /*
    +     * @deprecated and removed in entity_browser:8.x-2.2.
    +     *   Use ::supportsPreselection instead.
    +     *   @see
    +     */

    @deprecated must be added to the method documentation comment, not inside the method.

    +   * @param \Drupal\Core\Form\FormStateInterface $form_state
    +   *   Drupal form_state.

    There is no need to say Drupal.
    form_state is not an English word.

    -  protected $widgets_ids;
    +  protected $widgetsIds;
     
       /**
        * ID of the default widget.
    @@ -40,7 +40,7 @@ abstract class WidgetSelectorBase extends PluginBase implements WidgetSelectorIn
       public function __construct($configuration, $plugin_id, $plugin_definition) {
         parent::__construct($configuration, $plugin_id, $plugin_definition);
         $this->setConfiguration($configuration);
    -    $this->widget_ids = isset($this->configuration['widget_ids']) ? $this->configuration['widget_ids'] : [];
    +    $this->widget_ids = isset($this->configuration['widget_ids']) ?? [];

    Since the property name has been changed, $this->widget_ids is setting the wrong property.

  • Assigned to imustakim
  • šŸ‡ØšŸ‡¦Canada imustakim Canada
  • Issue was unassigned.
  • Status changed to Needs review about 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MariaDB 10.3.22
    last update about 2 years ago
    4 pass, 42 fail
  • šŸ‡ØšŸ‡¦Canada imustakim Canada

    As per suggestions by @apaderno, Changes have been made, and to address some of the concern mentioned in #31 šŸ“Œ Fix the issues reported by phpcs RTBC , only these errors are remaining.
    Assuming these can be ignored. Rest of the errors are fixed.
    Patch is updated, please review.

    FILE: /Users/specbee/Sites/Projects/entity_browser/src/Form/EntityBrowserForm.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
     131 | ERROR | The array declaration extends to column 100 (the limit is 80). The array content should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/specbee/Sites/Projects/entity_browser/src/Plugin/EntityBrowser/Widget/View.php
    -------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------
     41 | WARNING | Line exceeds 80 characters; contains 85 characters
    -------------------------------------------------------------------------------------------
    
    
    FILE: /Users/specbee/Sites/Projects/entity_browser/src/Plugin/EntityBrowser/Display/Standalone.php
    --------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------
     48 | WARNING | Possible useless method overriding detected
    --------------------------------------------------------------------------------------------------
    
    Time: 3.16 secs; Memory: 18MB
    
  • First commit to issue fork.
  • Status changed to Needs work over 1 year ago
  • First commit to issue fork.
  • Hi,
    I tried applying #37 patch. The patch throws

    error: corrupt patch at line 16

    Please check.

  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India dev16.addweb

    Fixed the issues reported by phpcs.

  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    I applied the patch #40 and verified that the issues reported by phpcs are fixed.

     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 84340  100 84340    0     0   168k      0 --:--:-- --:--:-- --:--:--  168k
    Checking patch entity_browser.api.php...
    Checking patch entity_browser.module...
    Checking patch entity_browser.views.inc...
    Checking patch modules/entity_form/entity_browser_entity_form.module...
    Checking patch modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php...
    Checking patch src/Ajax/SelectEntitiesCommand.php...
    Checking patch src/Ajax/ValueUpdatedCommand.php...
    Checking patch src/Controllers/EntityBrowserController.php...
    Checking patch src/Controllers/EntityBrowserFormController.php...
    Checking patch src/Controllers/EntityBrowserListBuilder.php...
    Checking patch src/DisplayBase.php...
    Checking patch src/DisplayInterface.php...
    Checking patch src/Element/EntityBrowserElement.php...
    Checking patch src/Entity/EntityBrowser.php...
    Checking patch src/EntityBrowserInterface.php...
    Checking patch src/Events/AlterEntityBrowserDisplayData.php...
    Checking patch src/Events/EntitySelectionEvent.php...
    Checking patch src/Events/EventBase.php...
    Checking patch src/Events/Events.php...
    Checking patch src/Events/RegisterJSCallbacks.php...
    Checking patch src/Form/EntityBrowserEditForm.php...
    Checking patch src/Form/EntityBrowserForm.php...
    Checking patch src/Plugin/EntityBrowser/Display/Modal.php...
    Checking patch src/Plugin/EntityBrowser/Display/Standalone.php...
    Checking patch src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php...
    Checking patch src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php...
    Checking patch src/Plugin/EntityBrowser/SelectionDisplay/MultiStepDisplay.php...
    Checking patch src/Plugin/EntityBrowser/SelectionDisplay/View.php...
    Checking patch src/Plugin/EntityBrowser/Widget/Upload.php...
    Checking patch src/Plugin/EntityBrowser/Widget/View.php...
    Checking patch src/Plugin/EntityBrowser/WidgetSelector/DropDown.php...
    Checking patch src/Plugin/EntityBrowser/WidgetSelector/Single.php...
    Checking patch src/Plugin/EntityBrowser/WidgetSelector/Tabs.php...
    Checking patch src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php...
    Checking patch src/Plugin/Field/FieldWidget/FileBrowserWidget.php...
    Checking patch src/Plugin/views/display/EntityBrowser.php...
    Checking patch src/Plugin/views/field/SelectForm.php...
    Checking patch src/Plugin/views/filter/ContextualBundle.php...
    Checking patch src/RouteSubscriber.php...
    Checking patch src/SelectionDisplayBase.php...
    Checking patch src/SelectionDisplayInterface.php...
    Checking patch src/WidgetBase.php...
    Checking patch src/WidgetInterface.php...
    Checking patch src/WidgetSelectorBase.php...
    Checking patch tests/modules/entity_browser_test/entity_browser_test.routing.yml...
    Checking patch tests/modules/entity_browser_test/src/Form/FormElementTest.php...
    Checking patch tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php...
    Checking patch tests/src/Functional/EntityBrowserUITest.php...
    Checking patch tests/src/Functional/FormElementTest.php...
    Checking patch tests/src/FunctionalJavascript/CardinalityTest.php...
    Checking patch tests/src/FunctionalJavascript/ConfigurationTest.php...
    Checking patch tests/src/FunctionalJavascript/EntityBrowserTest.php...
    Checking patch tests/src/FunctionalJavascript/EntityBrowserViewsWidgetTest.php...
    Checking patch tests/src/FunctionalJavascript/EntityBrowserWebDriverTestBase.php...
    Checking patch tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php...
    Checking patch tests/src/FunctionalJavascript/FieldWidgetConfigTest.php...
    Checking patch tests/src/FunctionalJavascript/InlineEntityFormTest.php...
    Checking patch tests/src/FunctionalJavascript/ParagraphsTest.php...
    Checking patch tests/src/FunctionalJavascript/PluginsTest.php...
    Checking patch tests/src/Kernel/Plugin/FieldWidgetDisplayTest.php...
    Applied patch entity_browser.api.php cleanly.
    Applied patch entity_browser.module cleanly.
    Applied patch entity_browser.views.inc cleanly.
    Applied patch modules/entity_form/entity_browser_entity_form.module cleanly.
    Applied patch modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php cleanly.
    Applied patch src/Ajax/SelectEntitiesCommand.php cleanly.
    Applied patch src/Ajax/ValueUpdatedCommand.php cleanly.
    Applied patch src/Controllers/EntityBrowserController.php cleanly.
    Applied patch src/Controllers/EntityBrowserFormController.php cleanly.
    Applied patch src/Controllers/EntityBrowserListBuilder.php cleanly.
    Applied patch src/DisplayBase.php cleanly.
    Applied patch src/DisplayInterface.php cleanly.
    Applied patch src/Element/EntityBrowserElement.php cleanly.
    Applied patch src/Entity/EntityBrowser.php cleanly.
    Applied patch src/EntityBrowserInterface.php cleanly.
    Applied patch src/Events/AlterEntityBrowserDisplayData.php cleanly.
    Applied patch src/Events/EntitySelectionEvent.php cleanly.
    Applied patch src/Events/EventBase.php cleanly.
    Applied patch src/Events/Events.php cleanly.
    Applied patch src/Events/RegisterJSCallbacks.php cleanly.
    Applied patch src/Form/EntityBrowserEditForm.php cleanly.
    Applied patch src/Form/EntityBrowserForm.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Display/Modal.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Display/Standalone.php cleanly.
    Applied patch src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php cleanly.
    Applied patch src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php cleanly.
    Applied patch src/Plugin/EntityBrowser/SelectionDisplay/MultiStepDisplay.php cleanly.
    Applied patch src/Plugin/EntityBrowser/SelectionDisplay/View.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Widget/Upload.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Widget/View.php cleanly.
    Applied patch src/Plugin/EntityBrowser/WidgetSelector/DropDown.php cleanly.
    Applied patch src/Plugin/EntityBrowser/WidgetSelector/Single.php cleanly.
    Applied patch src/Plugin/EntityBrowser/WidgetSelector/Tabs.php cleanly.
    Applied patch src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php cleanly.
    Applied patch src/Plugin/Field/FieldWidget/FileBrowserWidget.php cleanly.
    Applied patch src/Plugin/views/display/EntityBrowser.php cleanly.
    Applied patch src/Plugin/views/field/SelectForm.php cleanly.
    Applied patch src/Plugin/views/filter/ContextualBundle.php cleanly.
    Applied patch src/RouteSubscriber.php cleanly.
    Applied patch src/SelectionDisplayBase.php cleanly.
    Applied patch src/SelectionDisplayInterface.php cleanly.
    Applied patch src/WidgetBase.php cleanly.
    Applied patch src/WidgetInterface.php cleanly.
    Applied patch src/WidgetSelectorBase.php cleanly.
    Applied patch tests/modules/entity_browser_test/entity_browser_test.routing.yml cleanly.
    Applied patch tests/modules/entity_browser_test/src/Form/FormElementTest.php cleanly.
    Applied patch tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php cleanly.
    Applied patch tests/src/Functional/EntityBrowserUITest.php cleanly.
    Applied patch tests/src/Functional/FormElementTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/CardinalityTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/ConfigurationTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityBrowserTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityBrowserViewsWidgetTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityBrowserWebDriverTestBase.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/FieldWidgetConfigTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/InlineEntityFormTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/ParagraphsTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/PluginsTest.php cleanly.
    Applied patch tests/src/Kernel/Plugin/FieldWidgetDisplayTest.php cleanly.
    āžœ  entity_browser git:(85a79c7) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml entity_browser
    āžœ  contrib git:(main) āœ—

    Retaining the status to needs review so that others can give their feedback.
    Thank you.

  • Status changed to RTBC about 1 year ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    I applied the patch #40 and verified that the issues reported by phpcs are fixed.

     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 84340  100 84340    0     0   168k      0 --:--:-- --:--:-- --:--:--  168k
    Checking patch entity_browser.api.php...
    Checking patch entity_browser.module...
    Checking patch entity_browser.views.inc...
    Checking patch modules/entity_form/entity_browser_entity_form.module...
    Checking patch modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php...
    Checking patch src/Ajax/SelectEntitiesCommand.php...
    Checking patch src/Ajax/ValueUpdatedCommand.php...
    Checking patch src/Controllers/EntityBrowserController.php...
    Checking patch src/Controllers/EntityBrowserFormController.php...
    Checking patch src/Controllers/EntityBrowserListBuilder.php...
    Checking patch src/DisplayBase.php...
    Checking patch src/DisplayInterface.php...
    Checking patch src/Element/EntityBrowserElement.php...
    Checking patch src/Entity/EntityBrowser.php...
    Checking patch src/EntityBrowserInterface.php...
    Checking patch src/Events/AlterEntityBrowserDisplayData.php...
    Checking patch src/Events/EntitySelectionEvent.php...
    Checking patch src/Events/EventBase.php...
    Checking patch src/Events/Events.php...
    Checking patch src/Events/RegisterJSCallbacks.php...
    Checking patch src/Form/EntityBrowserEditForm.php...
    Checking patch src/Form/EntityBrowserForm.php...
    Checking patch src/Plugin/EntityBrowser/Display/Modal.php...
    Checking patch src/Plugin/EntityBrowser/Display/Standalone.php...
    Checking patch src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php...
    Checking patch src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php...
    Checking patch src/Plugin/EntityBrowser/SelectionDisplay/MultiStepDisplay.php...
    Checking patch src/Plugin/EntityBrowser/SelectionDisplay/View.php...
    Checking patch src/Plugin/EntityBrowser/Widget/Upload.php...
    Checking patch src/Plugin/EntityBrowser/Widget/View.php...
    Checking patch src/Plugin/EntityBrowser/WidgetSelector/DropDown.php...
    Checking patch src/Plugin/EntityBrowser/WidgetSelector/Single.php...
    Checking patch src/Plugin/EntityBrowser/WidgetSelector/Tabs.php...
    Checking patch src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php...
    Checking patch src/Plugin/Field/FieldWidget/FileBrowserWidget.php...
    Checking patch src/Plugin/views/display/EntityBrowser.php...
    Checking patch src/Plugin/views/field/SelectForm.php...
    Checking patch src/Plugin/views/filter/ContextualBundle.php...
    Checking patch src/RouteSubscriber.php...
    Checking patch src/SelectionDisplayBase.php...
    Checking patch src/SelectionDisplayInterface.php...
    Checking patch src/WidgetBase.php...
    Checking patch src/WidgetInterface.php...
    Checking patch src/WidgetSelectorBase.php...
    Checking patch tests/modules/entity_browser_test/entity_browser_test.routing.yml...
    Checking patch tests/modules/entity_browser_test/src/Form/FormElementTest.php...
    Checking patch tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php...
    Checking patch tests/src/Functional/EntityBrowserUITest.php...
    Checking patch tests/src/Functional/FormElementTest.php...
    Checking patch tests/src/FunctionalJavascript/CardinalityTest.php...
    Checking patch tests/src/FunctionalJavascript/ConfigurationTest.php...
    Checking patch tests/src/FunctionalJavascript/EntityBrowserTest.php...
    Checking patch tests/src/FunctionalJavascript/EntityBrowserViewsWidgetTest.php...
    Checking patch tests/src/FunctionalJavascript/EntityBrowserWebDriverTestBase.php...
    Checking patch tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php...
    Checking patch tests/src/FunctionalJavascript/FieldWidgetConfigTest.php...
    Checking patch tests/src/FunctionalJavascript/InlineEntityFormTest.php...
    Checking patch tests/src/FunctionalJavascript/ParagraphsTest.php...
    Checking patch tests/src/FunctionalJavascript/PluginsTest.php...
    Checking patch tests/src/Kernel/Plugin/FieldWidgetDisplayTest.php...
    Applied patch entity_browser.api.php cleanly.
    Applied patch entity_browser.module cleanly.
    Applied patch entity_browser.views.inc cleanly.
    Applied patch modules/entity_form/entity_browser_entity_form.module cleanly.
    Applied patch modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php cleanly.
    Applied patch src/Ajax/SelectEntitiesCommand.php cleanly.
    Applied patch src/Ajax/ValueUpdatedCommand.php cleanly.
    Applied patch src/Controllers/EntityBrowserController.php cleanly.
    Applied patch src/Controllers/EntityBrowserFormController.php cleanly.
    Applied patch src/Controllers/EntityBrowserListBuilder.php cleanly.
    Applied patch src/DisplayBase.php cleanly.
    Applied patch src/DisplayInterface.php cleanly.
    Applied patch src/Element/EntityBrowserElement.php cleanly.
    Applied patch src/Entity/EntityBrowser.php cleanly.
    Applied patch src/EntityBrowserInterface.php cleanly.
    Applied patch src/Events/AlterEntityBrowserDisplayData.php cleanly.
    Applied patch src/Events/EntitySelectionEvent.php cleanly.
    Applied patch src/Events/EventBase.php cleanly.
    Applied patch src/Events/Events.php cleanly.
    Applied patch src/Events/RegisterJSCallbacks.php cleanly.
    Applied patch src/Form/EntityBrowserEditForm.php cleanly.
    Applied patch src/Form/EntityBrowserForm.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Display/Modal.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Display/Standalone.php cleanly.
    Applied patch src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php cleanly.
    Applied patch src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php cleanly.
    Applied patch src/Plugin/EntityBrowser/SelectionDisplay/MultiStepDisplay.php cleanly.
    Applied patch src/Plugin/EntityBrowser/SelectionDisplay/View.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Widget/Upload.php cleanly.
    Applied patch src/Plugin/EntityBrowser/Widget/View.php cleanly.
    Applied patch src/Plugin/EntityBrowser/WidgetSelector/DropDown.php cleanly.
    Applied patch src/Plugin/EntityBrowser/WidgetSelector/Single.php cleanly.
    Applied patch src/Plugin/EntityBrowser/WidgetSelector/Tabs.php cleanly.
    Applied patch src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php cleanly.
    Applied patch src/Plugin/Field/FieldWidget/FileBrowserWidget.php cleanly.
    Applied patch src/Plugin/views/display/EntityBrowser.php cleanly.
    Applied patch src/Plugin/views/field/SelectForm.php cleanly.
    Applied patch src/Plugin/views/filter/ContextualBundle.php cleanly.
    Applied patch src/RouteSubscriber.php cleanly.
    Applied patch src/SelectionDisplayBase.php cleanly.
    Applied patch src/SelectionDisplayInterface.php cleanly.
    Applied patch src/WidgetBase.php cleanly.
    Applied patch src/WidgetInterface.php cleanly.
    Applied patch src/WidgetSelectorBase.php cleanly.
    Applied patch tests/modules/entity_browser_test/entity_browser_test.routing.yml cleanly.
    Applied patch tests/modules/entity_browser_test/src/Form/FormElementTest.php cleanly.
    Applied patch tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php cleanly.
    Applied patch tests/src/Functional/EntityBrowserUITest.php cleanly.
    Applied patch tests/src/Functional/FormElementTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/CardinalityTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/ConfigurationTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityBrowserTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityBrowserViewsWidgetTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityBrowserWebDriverTestBase.php cleanly.
    Applied patch tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/FieldWidgetConfigTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/InlineEntityFormTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/ParagraphsTest.php cleanly.
    Applied patch tests/src/FunctionalJavascript/PluginsTest.php cleanly.
    Applied patch tests/src/Kernel/Plugin/FieldWidgetDisplayTest.php cleanly.
    āžœ  entity_browser git:(85a79c7) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml entity_browser
    āžœ  contrib git:(main) āœ—

    Thank you.

  • Status changed to Needs work about 1 year ago
  • šŸ‡ØšŸ‡­Switzerland berdir Switzerland

    This is overwhelmingly large, has some bad changes and needs to be done as a merge request.

    Many of these changes probably already have existing dedicated issues, or multiple, it likely makes more sense to focus on these, this will likely never get committed in this form.

    1. +++ b/entity_browser.api.php
      @@ -3,15 +3,14 @@
       /**
      - * Alter the information provided in \Drupal\entity_browser\Annotation\EntityBrowserDisplay.
      + * Alter the information provided in.
      + *
      + * \Drupal\entity_browser\Annotation\EntityBrowserDisplay.
        *
        * @param array $displays
        *   The array of display plugins, keyed on the machine-readable name.
      @@ -21,7 +20,9 @@ function hook_entity_browser_display_info_alter(array &$displays) {
      

      this doesn't make sense, coder might be happy, but this isn't valid documentation.

    2. +++ b/modules/entity_form/entity_browser_entity_form.module
      @@ -155,7 +155,8 @@ function entity_browser_entity_form_reference_form_submit(array $reference_form,
         $form_state->setValueForElement($reference_form['entity_browser']['entity_ids'], '');
         $input = &$form_state->getUserInput();
      -  NestedArray::unsetValue($input, array_merge($reference_form['#parents'], ['entity_browser', 'entity_ids']));
      +  NestedArray::unsetValue($input, array_merge($reference_form['#parents'],
      +  ['entity_browser', 'entity_ids']));
       }
       
      

      this is not more readable and this coder rule is controversial and not enabled by core. We could copy the core phpcs rules, see šŸ“Œ Fix the issues reported by phpcs Needs review

    3. +++ b/modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php
      @@ -152,8 +152,20 @@ class EntityForm extends WidgetBase {
           $parents = ['table', $this->uuid(), 'form'];
           $entity_type = $form_state->hasValue(array_merge($parents, ['entity_type'])) ? $form_state->getValue(array_merge($parents, ['entity_type'])) : $this->configuration['entity_type'];
      -    $bundle = $form_state->hasValue(array_merge($parents, ['bundle', 'select'])) ? $form_state->getValue(array_merge($parents, ['bundle', 'select'])) : $this->configuration['bundle'];
      -    $form_mode = $form_state->hasValue(array_merge($parents, ['form_mode', 'form_select'])) ? $form_state->hasValue(array_merge($parents, ['form_mode', 'form_select'])) : $this->configuration['form_mode'];
      +    $bundle = $form_state->hasValue(array_merge($parents, [
      +      'bundle',
      +      'select',
      +    ])) ? $form_state->getValue(array_merge($parents, [
      +      'bundle',
      +      'select',
      +    ])) : $this->configuration['bundle'];
      +    $form_mode = $form_state->hasValue(array_merge($parents, [
      +      'form_mode',
      +      'form_select',
      +    ])) ? $form_state->hasValue(array_merge($parents, [
      +      'form_mode',
      +      'form_select',
      +    ])) : $this->configuration['form_mode'];
       
           $definitions = $this->entityTypeManager->getDefinitions();
      

      same, this doesn't make it more readable. getValue() has a default argument, not sure why this code isn't using that.

    4. +++ b/src/Ajax/ValueUpdatedCommand.php
      @@ -10,11 +10,11 @@ use Drupal\Core\Ajax\CommandInterface;
       class ValueUpdatedCommand implements CommandInterface {
       
         /**
      -   * The ID for the details element.
      +   * Details element ID.
          *
          * @var string
          */
      -  protected $details_id;
      +  protected $detailsIds;
       
      

      This can be considered an API change.

    5. +++ b/src/Events/Events.php
      @@ -8,33 +8,36 @@ namespace Drupal\entity_browser\Events;
         const SELECTED = 'entity_browser.selected';
       
         /**
      -   * The DONE event occurs when selection process is done. While it can be emitted
      -   * by any part of the system that will usually be done by selection display plugin.
      +   * The DONE event occurs when selection process is done.
      +   *
      +   * While it can be emitted by any part of the system.
      +   *
      +   * That will usually be done by selection display plugin.
          *
      

      same here, this blindly makes phpstan happy, but the result is no longer English.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    While it can be emitted by any part of the system that will usually be done by selection display plugin. cannot be split in While it can be emitted by any part of the system. and That will usually be done by selection display plugin. because While it can be emitted by any part of the system. is not a sentence; it is a clause that requires another clause to be a sentence (and to be understandable).
    You cannot randomly split sentences and put a period in random places just because PHP_CodeSniffer wants a shorter sentence.

  • šŸ‡ØšŸ‡­Switzerland berdir Switzerland

    @apaderno: Maybe it's meant to be a Haiku? ;) ( don't actually have any clue about how Haikus work)

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    I wish I could write a Haiku about using the correct punctuation. šŸ˜…šŸ˜‰šŸ–Šļø

  • First commit to issue fork.
  • šŸ‡©šŸ‡ŖGermany Anybody Porta Westfalica

    anybody → changed the visibility of the branch 8.x-2.x to hidden.

  • Merge request !96Resolve #3036556 "Coding standards fixes" → (Open) created by Anybody
Production build 0.71.5 2024