Page MenuHomePhabricator

mediawiki/libs/Zest phan issues under 8.1
Closed, ResolvedPublic

Description

https://gerrit.wikimedia.org/r/c/mediawiki/libs/Zest/+/734381
https://integration.wikimedia.org/ci/job/composer-package-php81-docker/99/console

23:27:26 src/ZestInst.php:305 PhanCoalescingNeverNullInLoop Using non-null $el->getAttribute('id') of type string as the left hand side of a null coalescing (??) operation. The right hand side may be unnecessary. (in a loop body - this is likely a false positive)

(Not sure how to tag Zest)

Event Timeline

Change 790413 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/libs/Zest@master] Suppress PhanCoalescingNeverNullInLoop

https://gerrit.wikimedia.org/r/790413

Change 790413 abandoned by Arlolra:

[mediawiki/libs/Zest@master] Suppress PhanCoalescingNeverNullInLoop

Reason:

Meh

https://gerrit.wikimedia.org/r/790413

This seems intractable; disabling PhanCoalescingNeverNullInLoop on that line makes phan pass on 8.1 but fail on 7.4/8.0 with an UnusedPluginSuppression; suppressing UnusedPluginSuppression makes it then fail on 8.1.

How about if you set $elid = $el->getAttribute( 'id' ); and set a '@phan-var $elid ?string` phan type hint above?

Change 842826 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/libs/Zest@master] WIP: Work around Phan issues in 8.1 and 7.4

https://gerrit.wikimedia.org/r/842826

How about if you set $elid = $el->getAttribute( 'id' ); and set a '@phan-var $elid ?string` phan type hint above?

Very neat. :-)

Change 842826 merged by jenkins-bot:

[mediawiki/libs/Zest@master] Work around Phan issues in 8.1 and 7.4

https://gerrit.wikimedia.org/r/842826