As per the core issue #3376057: [META] Add declare(strict_types=1) to all tests
Now that all tests are running green (thank you @ivnish!) I think it would be useful to strengthen them by declaring strict_types in all tests/test modules. This is the new core standard, and I have found it useful because it tends to find problems in the test cases, and even problems in the code being tested. Since strict_types will be turned on only for testing and not the module code (yet), this should not have any impact on any sites.
I'm going to make a MR with this, then add commits to clean up any problems this reveals in the tests.
Issue fork flag-3486525
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
Comment #3
tr commentedWith the (temporary) modification of phpstan.neon, I can see there is an unused test method (
doFlagUiFieldPlugin()) that uses an undefined core method (drupalPostAjaxForm()). I opened up #3486527: drupalPostAjaxForm() does not exist anymore for that issue.Comment #4
tr commentedOpened up a new issue for this:
Installing the table sequences with the method KernelTestBase::installSchema() is deprecated in drupal:10.2.0 and is removed from drupal:12.0.0.See #3486530: [10.2] Drupal\Core\Database\Connection::nextId(), the {sequences} table and schema are deprecated
Comment #6
tr commentedAll phpstan issue related to turning on strict_types in the tests have now been resolved, with the exception of #3486527: drupalPostAjaxForm() does not exist anymore, which requires changes that IMO are outside the scope of this issue.
Comment #8
ivnishGood job, TR!
Comment #9
ivnishComment #10
ivnish