Problem/Motivation

The return variable of function _responsive_image_build_source_attributes in responsive_image.module doesn't have the correct return type.

Steps to reproduce

1. Call the _responsive_image_build_source_attributes()
2. Try to get the offset of an attribute.
3. Analyse with PHPStan.

Cannot call method offsetGet() on array<Drupal\Core\Template\Attribute>
Return type in PHPDoc does not match the actual return type \Drupal\Core\Template\Attribute

Proposed resolution

Update _responsive_image_build_source_attributes PHPDoc to * @return \Drupal\Core\Template\Attribute .

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#3 3312883-1.patch856 bytessmavri
#2 3312883.patch736 bytessmavri

Issue fork drupal-3312883

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

smavri created an issue. See original summary.

smavri’s picture

StatusFileSize
new736 bytes
smavri’s picture

StatusFileSize
new856 bytes

Change the description of the return type.

cilefen’s picture

Component: typed data system » responsive_image.module
Status: Active » Needs review

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Can the MR be updated for 9.5 please. Will need a separate one for 10.1 also.

rpayanm made their first commit to this issue’s fork.

rpayanm’s picture

Status: Needs work » Needs review

I created the MR for 9.5.x and 10.1.x, please review.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

  • lauriii committed 5bfa2eee on 10.1.x
    Issue #3312883 by smavri, rpayanm, smustgrave: Update variable type...

  • lauriii committed 8e88e7fb on 10.0.x
    Issue #3312883 by smavri, rpayanm, smustgrave: Update variable type...

  • lauriii committed 49ec5343 on 9.5.x
    Issue #3312883 by smavri, rpayanm, smustgrave: Update variable type...

lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5bfa2ee and pushed to 10.1.x. Cherry-picked to 10.0.x and 9.5.x as a docs improvement. Thanks!

Status: Fixed » Closed (fixed)

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