Get PHPStan level 1 passing and enable automated test job

Created on 7 January 2024, 12 months ago
Updated 4 February 2024, 11 months ago

Problem/Motivation

Even at level 1, the phpstan job is failing for IEF.
https://git.drupalcode.org/issue/inline_entity_form-3410055/-/jobs/588375

 ------ ------------------------------------------------------------------- 
  Line   src/Element/InlineEntityForm.php                                   
 ------ ------------------------------------------------------------------- 
  200    Variable $inline_form_handler in empty() always exists and is not  
         falsy.                                                             
 ------ ------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------- 
  Line   src/Form/EntityInlineForm.php                                          
 ------ ----------------------------------------------------------------------- 
  282    Method Drupal\inline_entity_form\Form\EntityInlineForm::save() should  
         return int but return statement is missing.                            
 ------ ----------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   src/MigrationHelper.php                                               
 ------ ---------------------------------------------------------------------- 
  29     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
  155    Call to static method load() on an unknown class                      
         Drupal\migrate_plus\Entity\MigrationGroup.                            
         πŸ’‘ Learn more at https://phpstan.org/user-guide/discovering-symbols   
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/Field/FieldWidget/InlineEntityFormBase.php                 
 ------ ---------------------------------------------------------------------- 
  471    \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
  472    \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 ------ -------------------------------------------------------------------- 
  Line   tests/src/FunctionalJavascript/SimpleWidgetTest.php                 
 ------ -------------------------------------------------------------------- 
  177    Variable $host_node in isset() always exists and is not nullable.   
  184    Variable $child_node in isset() always exists and is not nullable.  
 ------ -------------------------------------------------------------------- 
 [ERROR] Found 8 errors   

Steps to reproduce

Proposed resolution

  1. Fix the 8 errors above.
  2. Remove SKIP_PHPSTAN: 1 from .gitlab-ci.yml to get automated PHPStan tests passing again (at level 1).
  3. Open a follow-up to raise this to level 2 and fix those errors.
  4. Rinse + repeat.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

RTBC

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dww

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

Merge Requests

Comments & Activities

  • Issue created by @dww
  • First commit to issue fork.
  • Merge request !102Fix level 1 PHPStan warnings β†’ (Open) created by dcam
  • Pipeline finished with Success
    12 months ago
    Total: 472s
    #73153
  • Pipeline finished with Failed
    12 months ago
    Total: 272s
    #73160
  • Pipeline finished with Success
    12 months ago
    Total: 392s
    #73200
  • Pipeline finished with Success
    12 months ago
    Total: 390s
    #73201
  • Pipeline finished with Success
    12 months ago
    Total: 393s
    #73236
  • Status changed to Needs review 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    All issues have been resolved except for two which I felt were best ignored for now.

  • Status changed to Needs work 12 months ago
  • πŸ‡·πŸ‡ΊRussia zniki.ru

    Thanks for the MR, I provide a feedback. Please check.

  • πŸ‡©πŸ‡ͺGermany geek-merlin Freiburg, Germany
  • Pipeline finished with Success
    11 months ago
    Total: 551s
    #73976
  • First commit to issue fork.
  • Pipeline finished with Success
    11 months ago
    #83813
  • Pipeline finished with Success
    11 months ago
    Total: 392s
    #83817
  • Assigned to benjifisher
  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    I rebased and resolved merge conflicts caused by πŸ“Œ Fix the issues reported by phpcs Needs work .

    I made some changes to MigrationHelper in order to keep phpcs happy.

    I am going to provide a BC layer, following Drupal deprecation policy > Constructor parameter additions β†’ .

  • Status changed to Needs review 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    The MR is ready for review.

    There are one or two open threads on the MR, but I think the intention is to open follow-up issues for them, As far as I am concerned, we do not need any more code changes for this issue.

  • Pipeline finished with Success
    11 months ago
    Total: 502s
    #84563
  • Issue was unassigned.
  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area
  • Status changed to Needs work 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Almost there, thanks! Resolved a few MR threads, but opened a couple more.

  • Status changed to Needs review 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Applied a few of my own suggestions πŸ˜…, responded to and resolved all threads.

    I think this is RTBC now, but maybe I'll let someone else say so and I can then commit it. πŸ˜‰

    Cheers,
    -Derek

  • Assigned to benjifisher
  • Status changed to RTBC 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    @dww:

    Congratulations on/thanks for joining as a co-maintainer of this module! I have a client who would like to see a stable release, so you can ping me in Slack if there is a task you would like me to do on the way there.

    I reviewed the two commits that you added, and I updated the change record https://www.drupal.org/node/3417929 β†’ to match. LGTM

    I am in the same boat as you: I have not stuck to the reviewer role on this issue. But if we are allowed to review each other's work, then I think we can (jointly) declare this issue to be RTBC.

  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I've reviewed the recent changes that have been made. They look good to me too. Thank you both for the help. RTBC+1.

  • Issue was unassigned.
  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    oops

  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    In #3413233-8: Drop PHP7 support to help with code cleanup β†’ , I pointed out that there is another constructor update (from ✨ Allow themes to alter inline entity forms Fixed ) that should have a BC layer. Since we already handle something similar for the MigrationHelper class in this issue, we might want to fix that here.

Production build 0.71.5 2024