Problem/Motivation

We use PHPStan to scan our code base. We found that the return value of ListInterface::first() can also be NULL, which is not documented on the interface. PHPStan uses the doc comments to infer types.

Proposed resolution

Update doc comments to also indicate NULL as return value.

Remaining tasks

Review patch.

No API or user facing changes, this just fixes the doc block comment type.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klausi created an issue. See original summary.

klausi’s picture

Status: Active » Needs review
FileSize
741 bytes

Patch.

hideaway’s picture

Status: Needs review » Reviewed & tested by the community

Looks perfectly legit to me, RTBC! :)

klausi’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Quickfix

Thanks, adding the quickfix tag for core committers :)

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Did not mean to change the status.

alexpott’s picture

Version: 9.2.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed
Issue tags: +Documentation

Committed and pushed 7655860e43 to 9.2.x and 4be9653093 to 9.1.x and 88cd63fde5 to 9.0.x and 4055b4ad1d to 8.9.x. Thanks!

Backported to 8.9.x because this is true there too.

  • alexpott committed 7655860 on 9.2.x
    Issue #3177765 by klausi: ListInterface::first() return value is...

  • alexpott committed 4be9653 on 9.1.x
    Issue #3177765 by klausi: ListInterface::first() return value is...

  • alexpott committed 88cd63f on 9.0.x
    Issue #3177765 by klausi: ListInterface::first() return value is...

  • alexpott committed 4055b4a on 8.9.x
    Issue #3177765 by klausi: ListInterface::first() return value is...
klausi’s picture

Issue tags: +PHPStan

starting to tag with phpstan so that we can coordinate a bit more on phpstan issues.

Status: Fixed » Closed (fixed)

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