Problem/Motivation
Php 8 is not supporting a required parameter after an optional one in method declaration and giving the below warnings in phpcs compatibility check
FILE: /var/www/docroot/sites/all/modules/contrib/migrate/migrate_ui/migrate_ui.pages.inc
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------
568 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter
| | $force is optional, while parameter $context is required.
------------------------------------------------------------------------------------------Proposed resolution
Proposing the attached patch to fix the issue
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | migrate-php8-compatibility-3272530.patch | 627 bytes | suvasish.manna |
Comments
Comment #2
suvasish.manna commentedComment #3
suvasish.manna commentedComment #4
liam morlandComment #5
damienmckennaComment #6
joelpittetIf the argument is NULL it should be converted
$force = $force ? $force : FALSE;to be equivalent.Comment #7
liam morlandThe patch is fine as it is.
$forcealways has to be set anyway because$contexthas to be set. Dropping the default does not change how the code behaves.Comment #8
joelpittet@Liam Morland, oh I was under the assumption
NULLas the argument value and prior to this patch it would have defaulted toFALSE, but the default keeps the the value asNULL.TIL https://3v4l.org/nih2k
Comment #9
joseph.olstadComment #11
pifagor commentedComment #12
joseph.olstadhttps://www.drupal.org/project/migrate/releases/7.x-2.12