Problem/Motivation

This is a child issue of #3376057: [META] Add declare(strict_types=1) to all tests. After adding enabling strict types to all tests there were around 3000 errors. Fixing them all in one issue will lead to an enormous merge request that's difficult to review, as per the issue scope guidelines.

Steps to reproduce

See #3400018: Add declare(strict_types=1) to all Functional JavaScript tests

Run the test suite:

./vendor/bin/phpunit -c core/phpunit.xml.dist --bootstrap=core/tests/bootstrap.php --testsuite=functional-javascript

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3399754

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
mstrelan’s picture

Issue summary: View changes

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

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

MR 5296 contains the results of adding strict type to the all the tests and the fixes you made in MR 5273. Gitlab is faster then my local but all green.

mstrelan’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Active

FWIW (I didn't make it clear) but the earlier commits in the MR will demonstrate all the fails and all the fixes. MR 5296 is good verification that the fixes resolve all the issues. Once this is committed we can move over to #3400018: Add declare(strict_types=1) to all Functional JavaScript tests.

smustgrave’s picture

So should it be in review or rtbc?

mstrelan’s picture

Status: Active » Reviewed & tested by the community

Didn't mean to change the status.

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Nice work on this.

There are any number of unnecessary sprintf() calls being added where we can just embed the variables in the string. It seems nowadays array values don't even require {} anymore also. Also one place where the comparison operator should probably be improved to go along with this.

Thanks!

mstrelan’s picture

Status: Needs work » Needs review

Thanks for the review, these have all been addressed. I'm not sure about removing the {} from array values, it doesn't work in https://3v4l.org/nk9So unless I remove the single quotes as well in https://3v4l.org/iaBCO, which my IDE didn't like.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Seems sprintf have been removed

xjm’s picture

Title: Fix strict type errors in functional javascript tests » Fix strict type errors in functional JavaScript tests

#12 is interesting!

These changes work for me. Also I forgot to mention before that the comments on the MR explaining the specific changes were quite helpful; thanks for those.

Saving credits.

  • xjm committed 35cfa709 on 11.x
    Issue #3399754 by mstrelan, smustgrave, xjm: Fix strict type errors in...

  • xjm committed d76ca17c on 10.2.x
    Issue #3399754 by mstrelan, smustgrave, xjm: Fix strict type errors in...

  • xjm committed 8d0385f8 on 10.1.x
    Issue #3399754 by mstrelan, smustgrave, xjm: Fix strict type errors in...
xjm’s picture

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

Committed to 11.x, 10.2.x, and 10.1.x as a test improvement. Thanks!

Status: Fixed » Closed (fixed)

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

mstrelan’s picture

Issue summary: View changes