You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a deprecation notice for the ArrayCollection class:
05.10.2026 11:14:04.423|deprecation|INFO|Bibi|User Deprecated:
Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future.
Do the same in implementation "League\CommonMark\Util\ArrayCollection" now to avoid errors or add an explicit @return annotation to suppress this message.|{"exception":"[object] (ErrorException(code: 0):
User Deprecated: Method \"ArrayAccess::offsetGet()\" might add \"mixed\" as a native return type declaration in the future.
Do the same in implementation \"League\\CommonMark\\Util\\ArrayCollection\" now to avoid errors or add an explicit @return annotation to suppress this message. at vendor/symfony/error-handler/DebugClassLoader.php:363)"}
How to reproduce
Just use it.
Possible solution
Add the mixed type as return value of the ArrayAccess::offsetGet() method:
Thanks for the report! This notice comes from Symfony's DebugClassLoader rather than PHP itself. We already mark the method with #[\ReturnTypeWillChange], but Symfony also looks for a plain @return annotation, and we only had @phpstan-return.
We can't add a native mixed return type in 2.x because mixed requires PHP 8.0 and this version still supports PHP 7.4. Instead, we've added an explicit @return annotation in #1161, which silences the notice and will be included in the next 2.x release. The native type can come in 3.0 once PHP 7.4 support is dropped.
Activity
colinodell commentedon Oct 6, 2026
Thanks for the report! This notice comes from Symfony's
DebugClassLoaderrather than PHP itself. We already mark the method with#[\ReturnTypeWillChange], but Symfony also looks for a plain@returnannotation, and we only had@phpstan-return.We can't add a native
mixedreturn type in 2.x becausemixedrequires PHP 8.0 and this version still supports PHP 7.4. Instead, we've added an explicit@returnannotation in #1161, which silences the notice and will be included in the next 2.x release. The native type can come in 3.0 once PHP 7.4 support is dropped.Generated by Claude Code
laurentmuller commentedon Oct 6, 2026
Great! Thank You.
I have just one more question: Why do You use
@phpstan-*annotation instead of direct PHP-Doc ?Before:
After: