From be8958a4bd49fa54e55c6b2fcae1dc0e211f442a Mon Sep 17 00:00:00 2001 From: Tom Klingenberg Date: Wed, 1 Nov 2023 06:36:36 +0100 Subject: [PATCH] Fix SPL ArrayObject::__construct(, $flags, $iteratorClass) Element is available from PHP 5.1, not 7.0. [1] The lowest common denominator is 5.3. Phpunit reports one argument on PHP 5.6 (reflection). [1]: https://github.com/php/php-src/blob/php-5.1.0/ext/spl/spl_array.c#L787 --- SPL/SPL.php | 4 ++-- tests/TestData/mutedProblems.json | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/SPL/SPL.php b/SPL/SPL.php index abc3a6619..74420a300 100644 --- a/SPL/SPL.php +++ b/SPL/SPL.php @@ -1551,8 +1551,8 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count */ public function __construct( #[LanguageLevelTypeAware(['8.0' => 'object|array'], default: '')] $array = [], - #[PhpStormStubsElementAvailable(from: '7.0')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $flags = 0, - #[PhpStormStubsElementAvailable(from: '7.0')] #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $iteratorClass = "ArrayIterator" + #[PhpStormStubsElementAvailable(from: '5.3')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $flags = 0, + #[PhpStormStubsElementAvailable(from: '5.3')] #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $iteratorClass = "ArrayIterator" ) {} /** diff --git a/tests/TestData/mutedProblems.json b/tests/TestData/mutedProblems.json index e39bc1607..4802b4d98 100644 --- a/tests/TestData/mutedProblems.json +++ b/tests/TestData/mutedProblems.json @@ -1669,6 +1669,25 @@ } ] }, + { + "name": "ArrayObject", + "methods": [ + { + "name": "__construct", + "problems": [ + { + "description": "parameter mismatch", + "versions": [ + 5.3, + 5.4, + 5.5, + 5.6 + ] + } + ] + } + ] + }, { "name": "RecursiveRegexIterator", "methods": [