Repository navigation
fix(stubs): ArrayObject and ArrayIterator use the PHP 8 parameter names - #14324
Conversation
vimeo#14130 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
✅ Performance: unchanged · Types: decreased
How to read this table
✅ symfony: issues +1 −0Memory 3 600 → 3 600 MB (<0.1 %) · Wall 252.7 → 256.5 s (+1.5 %) Weighted 98 405 → 98 412 (+7, +0.01 %): L7 +1
Added (1)
✅ psl: issues +0 −1Memory 617 → 617 MB (<0.1 %) · Wall 24.9 → 25.0 s (+0.4 %) Weighted 5 615 → 5 608 (−7, −0.12 %): L7 −1
Removed (1)
✅ drupal: issues +1 −5Memory 4 841 → 4 841 MB (<0.1 %) · Wall 255.6 → 252.6 s (−1.2 %) Weighted 169 293 → 169 265 (−28, −0.02 %): L7 −4
Added (1)
Removed (5)
head 0421a97 · base c5f4dfd (merge-base) · workflow run |
|
Behaviour change
|
orklah
left a comment
There was a problem hiding this comment.
Thanks. The renames match CallMap_80.php and the perf report confirms it: the removed ParamNameMismatch in drupal/psl are fixed false positives and the added ones (symfony FormErrorIterator::seek($position), drupal DeprecatedArray::unserialize($serialized)) are real PHP 8 mismatches.
One thing needs changing: the offset* methods. ArrayAccess and ArrayObject::offset* carry @no-named-arguments because of conflict with ArrayAccess, since PHP 8 names the parameter $offset in the interface and $key in the classes, and a subclass can't match both. ArrayIterator::offset* has the same conflict but no tag, so this PR moves the ParamNameMismatch from $key overrides to $offset ones, the common name:
<?php
/** @extends ArrayIterator<int, int> */
final class Items extends ArrayIterator {
public function offsetGet(mixed $offset): mixed { return parent::offsetGet($offset); }
// master: no issue
// this PR: ParamNameMismatch: Argument 1 of Items::offsetGet has wrong name $offset, expecting $key as defined by ArrayIterator::offsetGet
}Could you add the same @no-named-arguments because of conflict with ArrayAccess tag to the four ArrayIterator::offset* stubs, so both names are accepted as for ArrayObject, and add tests for it:
- a valid case with an
ArrayIteratorsubclass overridingoffsetGet($offset)and another overridingoffsetGet($key)(php_version8.0); - an invalid case pinning that the old names are now rejected, e.g.
$o->uasort(cmp_function: ...)→InvalidNamedArgument.
…rayObject's Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Pushed 0421a97. The four After merging master the existing |
Named arguments with the PHP 8 parameter names of
ArrayObject,ArrayIteratorandSeekableIterator::seek()reportInvalidNamedArgument, because the stubs keep the PHP 7 names.Before
After
Fixes #14130