PHP 8.0 deprecation notice on ProtectedFileWidget class

Created on 24 February 2023, over 1 year ago
Updated 18 March 2023, over 1 year ago

Problem/Motivation

I am seeing this deprecation notice when using this module in PHP 8.1:

Deprecated: Required parameter $form_state follows optional parameter $input in /var/www/html/docroot/modules/contrib/protected_file/src/Plugin/Field/FieldWidget/ProtectedFileWidget.php on line 34

Steps to reproduce

Install and use as per module design using PHP 8.0 or above.

Proposed resolution

This is the offending line:

public static function value($element, $input = FALSE, FormStateInterface $form_state)

Refactor so that the optional $input parameter follows all mandatory ones, in this case $form_state.
See: https://php.watch/versions/8.0/deprecate-required-param-after-optional

πŸ› Bug report
Status

Fixed

Version

1.3

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia jaydee1818 Melbourne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024