Increase PHPStan level

Created on 14 April 2024, 8 months ago
Updated 15 July 2024, 5 months ago
  1. Edit the phpstan.neon file
  2. Run PHPStan locally โ†’
  3. If there are no errors raise the level again until you find some
  4. If there are errors fix them and mark this issue for review

Avoid ignores as much as possible, but if you need to ignore something because of a Drupalism, put it in the neon file by error type rather than inline in the code please.

๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @darvanen
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia amanbtr72

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

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia

    @amanmansuri72 this issue is for phpstan, not phpcs. That effort belongs on ๐Ÿ› Drupal Coding Standards Issues | phpcs Needs work .

  • First commit to issue fork.
  • ๐Ÿ‡ฒ๐Ÿ‡ฆMorocco h_kac

    Hello,
    I fixed some errors shown at level 2 to level 6 can u check that ?

    For the error below, I have checked the interface containing the signature of the function "get" we have only one param "CountryCode", I think we should remove the second param in the class

    ------ ------------------------------------------------------------------------------- 
      Line   src/Plugin/GraphQL/DataProducer/AddressFormatRepository.php                    
     ------ ------------------------------------------------------------------------------- 
      98     Method                                                                         
             CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface::get()  
             invoked with 2 parameters, 1 required.                                         
     ------ ------------------------------------------------------------------------------- 
    

    What do you think ?

  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia

    Hi h_kac, if you would like work to be reviewed, please open a MR and set the issue to 'Needs Review' :)

  • Merge request !10Resolve #3440876 "Increase phpstan level" โ†’ (Open) created by h_kac
  • Pipeline finished with Success
    6 months ago
    #206576
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฆMorocco h_kac
  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

    Changes in the MR aren't seems to be phpstan related.

    cc: @darvanen

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia

    Yeah that would be from #2, feel free to revert that commit, it belongs in another issue per #3.

    It looks like the MR doesn't contain any change to set the PHPStan level higher for the test runner too.

  • Pipeline finished with Success
    6 months ago
    #207854
  • Pipeline finished with Success
    6 months ago
    Total: 138s
    #207855
  • Pipeline finished with Success
    6 months ago
    Total: 138s
    #207859
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฆMorocco h_kac
  • Pipeline finished with Success
    6 months ago
    Total: 171s
    #207879
  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

    Still all the changes are related to phpcs.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia

    @h_kac you may find it easier to make a new fork rather than manually trying to revert changes.

    #12 is right, many phpcs related changes remain on the current MR.

  • Assigned to ankitv18
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

    I'll check for phpstan error.

  • Pipeline finished with Failed
    6 months ago
    Total: 170s
    #208390
  • Pipeline finished with Canceled
    6 months ago
    #208399
  • Pipeline finished with Failed
    6 months ago
    #208400
  • Pipeline finished with Canceled
    6 months ago
    Total: 94s
    #208412
  • Pipeline finished with Success
    6 months ago
    #208413
  • Pipeline finished with Success
    6 months ago
    Total: 233s
    #208434
  • Pipeline finished with Success
    6 months ago
    Total: 140s
    #208441
  • Pipeline finished with Success
    6 months ago
    Total: 172s
    #208444
  • Pipeline finished with Success
    6 months ago
    Total: 242s
    #208462
  • Pipeline finished with Success
    6 months ago
    Total: 139s
    #208486
  • Pipeline finished with Success
    6 months ago
    Total: 170s
    #208488
  • Pipeline finished with Success
    6 months ago
    Total: 202s
    #208491
  • Pipeline finished with Success
    6 months ago
    Total: 177s
    #208496
  • Pipeline finished with Success
    6 months ago
    Total: 203s
    #208502
  • Pipeline finished with Success
    6 months ago
    Total: 177s
    #208507
  • Pipeline finished with Success
    6 months ago
    Total: 192s
    #208516
  • Pipeline finished with Success
    6 months ago
    Total: 177s
    #208520
  • Pipeline finished with Success
    6 months ago
    Total: 170s
    #208528
  • Pipeline finished with Success
    6 months ago
    Total: 239s
    #208545
  • Pipeline finished with Success
    6 months ago
    Total: 170s
    #208557
  • Pipeline finished with Success
    6 months ago
    Total: 140s
    #208572
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

    ankitv18 โ†’ changed the visibility of the branch 3440876-increase-phpstan-level to hidden.

  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

    @darvanen MR!12 is ready for review.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia

    @ankitv18 I'm not really keen on duplicating method comments from parent classes just for the sake of passing higher levels of PHPStan. If we want to pass at that level we should see that the parent passes first (in the graphql module) and leave ours as @inheritdoc in my opinion.

    Perhaps we should postpone this on that work? Otherwise I'm happy to commit a version with a lower level.

    We will also need to comment out the various OPT_IN variables at the end of this as they are not to be run on every test in every issue. Advice I've recieved from several senior maintainers is to save those for final runs.

    Thoughts?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

    I'm also not committed with all these changes as I just pushed the commits to show the higher level of phpstan changes.

    Anyways I'm reverting the changes and put the phpstan level to 2 and left the other required changes for phpstan apart from docblock.

  • Pipeline finished with Canceled
    6 months ago
    Total: 64s
    #209519
  • Pipeline finished with Failed
    6 months ago
    Total: 140s
    #209525
  • Pipeline finished with Success
    6 months ago
    Total: 169s
    #209533
  • Pipeline finished with Success
    6 months ago
    Total: 137s
    #209542
  • Pipeline finished with Success
    6 months ago
    Total: 139s
    #209543
  • Status changed to RTBC 6 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia

    5 is great, let's leave it there for now. Thanks for this, it was quite the education for me.

    @h_kac I'm going to give you a credit because you're quite new and I can see you were trying. Keep going! There are many ways to contribute. Also join Drupal Slack โ†’ , it's a great way to see what's happening in the community.

  • Pipeline finished with Skipped
    6 months ago
    #211294
  • Status changed to Fixed 6 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia darvanen Sydney, Australia
  • ๐Ÿ‡ฒ๐Ÿ‡ฆMorocco h_kac

    @Darvanen thank you

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024