fix: remove mixed type hints from RawData trait for PHP 7.4 compatibility#280
Open
daniolivet8 wants to merge 1 commit intopipedrive:masterfrom
Open
Conversation
…lity The `mixed` type was introduced in PHP 8.0. Using it as a property type, parameter type, or return type causes a fatal error on PHP 7.4, where it is interpreted as a class name within the current namespace. Since `composer.json` declares `"php": "^7.4 || ^8.0"`, this change removes the native `mixed` type hints while keeping the PHPDoc annotations (`@var mixed`, `@param mixed`, `@return mixed`) intact. This is fully backward compatible: omitting a type hint in PHP 8.x is equivalent to accepting any type, same as `mixed`. Fixes pipedrive#279
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
mixednative type hints fromRawDatatrait (v1 and v2) to restore PHP 7.4 compatibility@var mixed,@param mixed, and@return mixedannotations for documentationmixed)Problem
composer.jsondeclares"php": "^7.4 || ^8.0", but themixedtype (property, parameter, and return type) was introduced in PHP 8.0. On PHP 7.4, it causes a fatal error:PHP 7.4 interprets
mixedas a class name in the current namespace instead of the native type.Files changed
lib/versions/v1/Traits/RawData.phplib/versions/v2/Traits/RawData.phpCloses #279