Skip to content

Add explicit @return to ArrayCollection::offsetGet() - #1161

Merged
colinodell merged 4 commits into
2.10from
claude/project-thread-tzubj0
Oct 17, 2026
Merged

colinodell merged 4 commits into
2.10from
claude/project-thread-tzubj0

Conversation

@colinodell

Copy link
Copy Markdown
Member

Requested by Colin · project thread

Fixes #1158.

Symfony's DebugClassLoader emits a deprecation notice for ArrayAccess::offsetGet() implementations that have neither a native mixed return type nor a plain @return annotation. ArrayCollection::offsetGet() already has #[\ReturnTypeWillChange] (which silences PHP itself) but only had @phpstan-return, which Symfony doesn't read.

A native mixed return type isn't possible in 2.x since mixed requires PHP 8.0 and we still support 7.4, so this adds @return mixed|null alongside the existing @phpstan-return T|null, matching how getIterator() is already documented. Docblock-only change; no runtime or BC impact.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CymVyjcg2P4vuyxLC1FHoE


Generated by Claude Code

Symfony's DebugClassLoader reports a deprecation for ArrayAccess::offsetGet()
implementations lacking a native return type or a plain @return annotation.
A native mixed type isn't possible while PHP 7.4 is supported.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CymVyjcg2P4vuyxLC1FHoE
claude and others added 3 commits October 6, 2026 02:35
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CymVyjcg2P4vuyxLC1FHoE
php-code-coverage 14.4 (PHPUnit 13.4) exceeds the default 128M limit
when collecting coverage on PHP 8.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PHPUnit 12+ ignores docblock annotations, so @runInSeparateProcess tests ran
in-process. CursorTest's ini_set('memory_limit', '128M') then leaked into the
rest of the suite, which exceeds that limit when collecting coverage with
php-code-coverage 14.4. Add the equivalent attribute alongside the annotation.
It is aliased on import because Slevomat's UnusedUses sniff otherwise flags
the annotation as a case mismatch with the class name.

PHPStan 2.3 no longer reports arrayValues.list here, so don't fail when that
ignore goes unmatched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@colinodell
colinodell merged commit e407ccc into 2.10 Oct 17, 2026
33 checks passed
@colinodell
colinodell deleted the claude/project-thread-tzubj0 branch October 17, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecated: Method ArrayAccess::offsetGet()

2 participants