Drupal-check main issue

Created on 27 July 2023, over 1 year ago
Updated 2 September 2024, 2 months ago

Problem/Motivation

I open this issue to track drupal-check issues and to regroup other issues about it:

Steps to reproduce

composer require mglaman/drupal-check --dev
./vendor/bin/drupal-check --php8 web/modules/contrib/fivestar
 22/22 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------
  Line   fivestar.install
 ------ ---------------------------------------------
  55     Variable $display_map might not be defined.
 ------ ---------------------------------------------

 ------ ---------------------------------------------------------------------
  Line   fivestar.module
 ------ ---------------------------------------------------------------------
  106    Function field_read_fields not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
  113    Function field_read_instances not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
 ------ ---------------------------------------------------------------------

 ------ ---------------------------------------------------------------------
  Line   includes/fivestar.theme.inc
 ------ ---------------------------------------------------------------------
  22     Variable $stars might not be defined.
  23     Variable $unvote might not be defined.
  24     Variable $revote might not be defined.
  25     Variable $ownvote might not be defined.
  26     Variable $style might not be defined.
  27     Variable $text might not be defined.
  28     Variable $title might not be defined.
  33     Function drupal_get_form not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
 ------ ---------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------
  Line   src/Element/Fivestar.php
 ------ -----------------------------------------------------------------------------------------------------------------------
  215    Method Drupal\fivestar\Element\Fivestar::getElementDescription() should return array but return statement is missing.
  293    Call to an undefined method Drupal\Core\Entity\EntityInterface::getOwner().
 ------ -----------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------
  Line   src/Plugin/Field/FieldFormatter/PercentageFormatter.php
 ------ ---------------------------------------------------------
  51     Variable $item might not be defined.
 ------ ---------------------------------------------------------

 ------ -----------------------------------------------------
  Line   src/Plugin/Field/FieldFormatter/RatingFormatter.php
 ------ -----------------------------------------------------
  51     Variable $item might not be defined.
 ------ -----------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldFormatter/StarsFormatter.php
 ------ ------------------------------------------------------------------------------------------------
  126    Method Drupal\Core\Form\FormBuilderInterface::getForm() invoked with 2 parameters, 1 required.
  142    Method Drupal\Core\Form\FormBuilderInterface::getForm() invoked with 2 parameters, 1 required.
 ------ ------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldType/FivestarItem.php
 ------ --------------------------------------------------------------------------------------------------------------------------
  242    Access to an undefined property Drupal\Core\Field\FieldItemListInterface<Drupal\Core\Field\FieldItemInterface>::$rating.
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
  274    Call to an undefined method Drupal\Core\Entity\FieldableEntityInterface::isPublished().
  335    Call to an undefined method Drupal\Core\Entity\EntityInterface::getOwnerId().
  336    Call to an undefined method Drupal\Core\Entity\EntityInterface::getValue().
  337    Call to an undefined method Drupal\Core\Entity\EntityInterface::getSource().
 ------ --------------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldWidget/SelectWidget.php
 ------ ---------------------------------------------------------------------------------------------
  25     Call to an undefined method Drupal\Core\TypedData\TypedDataInterface::getFieldDefinition().
  46     Call to an undefined method Drupal\Core\TypedData\TypedDataInterface::getFieldDefinition().
 ------ ---------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldWidget/StarsWidget.php
 ------ ---------------------------------------------------------------------------------------------
  113    Call to an undefined method Drupal\Core\TypedData\TypedDataInterface::getFieldDefinition().
 ------ ---------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------
  Line   src/VoteManager.php
 ------ ---------------------------------------------------------------------------------------
  82     Call to an undefined method Drupal\Core\Entity\EntityInterface::setVotedEntityId().
  83     Call to an undefined method Drupal\Core\Entity\EntityInterface::setVotedEntityType().
  84     Call to an undefined method Drupal\Core\Entity\EntityInterface::setOwnerId().
  85     Call to an undefined method Drupal\Core\Entity\EntityInterface::setValue().
 ------ ---------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------
  Line   tests/src/Functional/FivestarTest.php
 ------ ----------------------------------------------------------------
  61     Variable $displayRepository in PHPDoc tag @var does not exist.
 ------ ----------------------------------------------------------------

 ------ ----------------------------------------------------------------
  Line   tests/src/FunctionalJavascript/FivestarAjaxTestBase.php
 ------ ----------------------------------------------------------------
  60     Variable $displayRepository in PHPDoc tag @var does not exist.
 ------ ----------------------------------------------------------------

 [ERROR] Found 31 errors

Proposed resolution

Fix all errors and test them with one MR.

Remaining tasks

9 errors:

  • field_read_fields no longer exist: use entity_load() or entity_load_multiple_by_properties(). see https://www.drupal.org/project/drupal/issues/2018319 (x2)
  • EntityInterface::getOwner() undefined => <a href="https://www.drupal.org/project/fivestar/issues/3226149#comment-14178979">#3226149</a>
  • PercentageFormatter => #2918679 📌 Rating and Percentage Formatter Needs review
  • RatingFormatter => #2918679 📌 Rating and Percentage Formatter Needs review
  • getForm invoked with 2 parameters, 1 required (x2)
  • Access to an undefined property Drupal\Core\Field\FieldItemListInterface::$rating.
  • Call to an undefined method Drupal\votingapi\VoteResultInterface::setOwnerId().
  • Test this MR
📌 Task
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇫🇷France O'Briat Nantes

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

Comments & Activities

  • Issue created by @O'Briat
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    4 pass
  • @obriat opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    PHPLint Failed
  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States tr Cascadia

    I really don't find this helpful. You have one huge patch that duplicates all the sub issues where specific parts of the drupal-check output is being addressed. If this is meant to be a meta issue, then there should be NO patch, just a collection of links to the open issues. If there are problems that don't have open issues, then you should open new issues for those problems. But throwing all these unrelated problems into one patch is not helpful because all these things have different causes and different solutions.

    Your drupal-check output is also wrong - all those "errors" related to the test cases are because of how you've configured your site, not because the test cases are wrong.

    drupal-check can be a useful tool to identify POSSIBLE problems - I've used it for years. The goal is NOT to eliminate all drupal-check messages, but to use it as a tool to identify possible problems then examine those possible problems in more detail to see if they really are problems.

    If you're going to do this, then please take the time to look into each message, determine why that message is being shown, and if something needs to be changed first find out if there is another issue handling that change. If not, THEN you should open a new issue focused on that one message (or group of similar messages) - that issue should explain what the problem is and why it is a problem and hopefully present a proposed solution. The only thing in your output that I hadn't seen before is the PHP 8.2 issue with dynamic properties. But like all the other problems this doesn't affect the operation of the module.

    I'm not going to go through this patch in detail because I've already done that in all the other issues.

    As a matter of process, when you submit a patch please set the status to "Needs review", which acts as a flag to indicate that you have proposed a solution with a patch and need others to look at it. "Active" does not indicate that a patch is available.

    Likewise, when you submit a patch, please check the DrupalCI automated test output. If your patch fails like the above (PHP 7.3 & MySQL 5.7, D9.5.5 PHPLint Failed) then please figure out why it failed and correct the errors. Here, it's because you're trying to use a PHP feature that isn't supported by all the versions of PHP that Drupal supports.

    Also, it is much more useful if you would actually review and comment on the existing issues and fix the problems in those existing issues so they can be committed.

  • 🇫🇷France O'Briat Nantes

    Thanks for the advices, I'll try to follow them.
    My goal was to track minor issues in issue and point to other issues for the major ones.
    The status was left to Active as it's a WIP.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    4 pass
  • Status changed to Closed: outdated 2 months ago
  • 🇺🇸United States tr Cascadia
Production build 0.71.5 2024