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/admin_menu/tests/admin_menu.test
---------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------
51 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter
   |         | $arguments is optional, while parameter $message is required.
72 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter
   |         | $arguments is optional, while parameter $message is required.
---------------------------------------------------------------------------------------------------------------

Proposed resolution

Proposing the attached patch to fix the issue

Issue fork admin_menu-3272088

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

suvasish.manna created an issue. See original summary.

suvasish.manna’s picture

suvasish.manna’s picture

Assigned: suvasish.manna » Unassigned
Status: Active » Needs review
marciaibanez’s picture

Assigned: Unassigned » marciaibanez

I'll review this.

marciaibanez’s picture

Assigned: marciaibanez » Unassigned
Status: Needs review » Reviewed & tested by the community

Hi! I reviewed your patch and I got other errors, but the reported warnings are gone. As the errors I got may be from the Drupal version I'm using or something like that, I'm moving this issue to RTBC and I'll create an issue with the errors not related to this one. Thanks!

renatog’s picture

It really makes sense. +1 to #RTBC

renatog’s picture

Status: Reviewed & tested by the community » Fixed

Committed to the 7.x-3.x branch

Thank you so much for your fix @suvasishmanna and @marciaibanez to validating this. Great job

Best regards

Status: Fixed » Closed (fixed)

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

joelpittet’s picture

This would be nice to have in a release if you have a moment. (I know, I have a few releases to make too 😅)