Skip to content

Commit

Permalink
Fix SPL ArrayObject::__construct(, $flags, $iteratorClass)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ktomk committed Nov 1, 2023
1 parent 1720f96 commit be8958a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SPL/SPL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
) {}

/**
Expand Down
19 changes: 19 additions & 0 deletions tests/TestData/mutedProblems.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down

0 comments on commit be8958a

Please sign in to comment.