Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
In #169, return types were added to a few methods to address some deprecation notices showing up if you were using PHP 8.1. We also bumped our minimum PHP version to 7.4 in #170. The problem here is we used the
mixed
return type in a few places and full support for that wasn't added until PHP 8.This means anyone running the latest version of this plugin (v4.3.4) and still running PHP 7.4, will end up with fatal errors that cause the plugin to not function.
This PR addresses this by removing the
mixed
return type and adding the#[\ReturnTypeWillChange]
attribute to suppress the deprecation notices for those running PHP 8.1. This should solve both the original issue as well as the newly introduced issue on PHP 7.4.One thing to note here is once we do bump our minimum PHP version to 8.0, we'll want to remove the use of these attributes.
How to test the Change
In an environment running PHP 7.4, go and configure the plugin. Prior to the changes here, you'll end up with a fatal error when the container settings are rendered. After this change, things should load as expected.
In an environment running PHP 8.0+, go and configure the plugin. Everything should work as expected and no deprecation warnings should be logged.
Changelog Entry
Credits
Props @dkotter
Checklist: