Problem/Motivation

This is a child issue of #3404246: [META] Fix strict type errors detected by phpstan

The scope includes any @param docs identified by the checkFunctionArgumentTypes phpstan parameter. This may include changing the array type from concrete class to an interface, or an incorrect scalar type such as string to string[], and other similar fixes.

This does not include any actual parameter typing, only the @param docs.

Steps to reproduce

See parent

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3463440

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mstrelan created an issue. See original summary.

mstrelan’s picture

Status: Active » Needs review

Annotated the MR to make it easy to understand why each of the param docs needed changing.

mstrelan’s picture

Title: Fix array param docs identified by phpstan » Fix param docs identified by phpstan
Issue summary: View changes
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Much appreciate @mstrelan for doing the review also :)

I agree the type updates are correct in the comments. Now if the functions really shouldn't accept these types believe those can all be follow ups as your findings show code uses them in a certain way.

  • nod_ committed e07e27a6 on 11.x
    Issue #3463440 by mstrelan, smustgrave: Fix param docs identified by...

nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed e07e27a and pushed to 11.x. Thanks!

longwave’s picture

Version: 11.x-dev » 11.0.x-dev
Status: Fixed » Reviewed & tested by the community

IMHO as a docs fix this can be backported down, to help make future cherry-picks easier.

  • nod_ committed 1d1669b4 on 11.x
    Revert "Issue #3463440 by mstrelan, smustgrave: Fix param docs...
nod_’s picture

Status: Reviewed & tested by the community » Needs work

actually one change doesn't conform to our coding standard spoke too soon, I'm not comfortable enough with this to make the call. reverting for now

nod_’s picture

Status: Needs work » Reviewed & tested by the community
nod_’s picture

nod_’s picture

Version: 11.0.x-dev » 11.x-dev

sorry for the noise, last update

mstrelan’s picture

Curious which change was non-conformant? I'm guessing maybe array<string, string|false>. If that's the case, we need to change our coding standards, or rather, we shouldn't be the ones dictating how to write @param docs, we should rely on what phpcs and phpstan accepts.

quietone’s picture

Status: Reviewed & tested by the community » Needs work

Setting to NW for another look at one comment.

mstrelan’s picture

Status: Needs work » Needs review

Opened #3468236: Adopt phpstan phpdoc types as canonical reference of allowed types for follow up. Left some responses on the MR. Personally I feel it should go in as-is and anything else should be a follow-up.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

If I'm understanding correct there is no official coding standard around the one change in question. So would agree that probably makes sense to go in as is to get some net improvement. And if the rule gets adopted can update, would assume there would then be a whole other set of files that will need to be updated. Just my 2cents.

  • nod_ committed c7a2f294 on 10.3.x
    Issue #3463440 by mstrelan, smustgrave, quietone, longwave: Fix param...

  • nod_ committed 224c7ea5 on 10.4.x
    Issue #3463440 by mstrelan, smustgrave, quietone, longwave: Fix param...

  • nod_ committed 948c9327 on 11.0.x
    Issue #3463440 by mstrelan, smustgrave, quietone, longwave: Fix param...

  • nod_ committed fa418559 on 11.x
    Issue #3463440 by mstrelan, smustgrave, quietone, longwave: Fix param...
nod_’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed
Related issues: +#3468236: Adopt phpstan phpdoc types as canonical reference of allowed types

Discussed on slack, +1 from longwave for commit. Follow-up for coding standard is created.

Committed and pushed fa418559a4 to 11.x and 948c93276e to 11.0.x and 224c7ea5f0 to 10.4.x and c7a2f29450 to 10.3.x. Thanks!

Status: Fixed » Closed (fixed)

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