Problem/Motivation

Get ride of the php deprecated message

Steps to reproduce

Whenever we use the command drush for the marketwebsite project we get the error message below :
Deprecated: Optional parameter $mapping declared before required parameter $form_state is implicitly treated as a required parameter in /var/www/html/web/modules/contrib/hubspot_integration/src/Form/HubspotMappingForm.php on line 157
Deprecated: Optional parameter $mapping declared before required parameter $form_state is implicitly treated as a required parameter in /var/www/html/web/modules/contrib/hubspot_integration/src/Form/HubspotMappingForm.php on line 176
PHP Deprecated: Optional parameter $mapping declared before required parameter $form_state is implicitly treated as a required parameter in /var/www/html/web/modules/contrib/hubspot_integration/src/Form/HubspotMappingForm.php on line 157
PHP Deprecated: Optional parameter $mapping declared before required parameter $form_state is implicitly treated as a required parameter in /var/www/html/web/modules/contrib/hubspot_integration/src/Form/HubspotMappingForm.php on line 176

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

nichal created an issue. See original summary.

avpaderno’s picture

Title: PHP Deprecated: Optional parameter $mapping declared before required parameter $form_state is implicitly treated as a required parameter » PHP Deprecated: Optional parameter $mapping declared before required parameter $form_state is implicitly treated as a required parameter
j0s3’s picture

This patch fix the Deprecated warnings about function parameters order.

avpaderno’s picture

Assigned: nichal » Unassigned
Status: Active » Needs review
nichal’s picture

StatusFileSize
new1.68 KB

Hello I am submitting a new fix for this issue since the fix fix-deprecated-warning-mapping-3310390-3.patch is not enough (we should change the way we call the function, the parameter order since we change the definition of the function.)

avpaderno’s picture

Status: Needs review » Needs work
-  protected function mappingItemForm($property, $mapping=NULL, FormStateInterface $form_state) {
+  protected function mappingItemForm($property, FormStateInterface $form_state, $mapping=NULL) {

Instead of changing the parameters order, $mapping should be made a required parameter (remove =NULL).

j0s3’s picture

Actually, this function parameters are unused so can be cleaned up.

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

romainj’s picture

Status: Needs work » Needs review

  • romainj committed bee04f4 on 2.1.x
    Issue #3310390 by romainj, j0s3: PHP Deprecated: Optional parameter $...
romainj’s picture

Status: Needs review » Fixed

  • romainj committed bee04f4 on 2.x
    Issue #3310390 by romainj, j0s3: PHP Deprecated: Optional parameter $...

Status: Fixed » Closed (fixed)

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