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
{{ message }}
Repository navigation
Support for array shape for ArrayAccess classes not working. #8549
@@ @@+PHP 8.1 (6 errors)+==========++21: Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess::offsetGet().
45: Dumped type: string
+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 7.1 – 8.0 (5 errors)+==========++45: Dumped type: string+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.
47: Options<array{name: string}> does not accept int.
Full report
PHP 8.1 (6 errors)
Line
Error
21
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess::offsetGet().
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 7.1 – 8.0 (5 errors)
Line
Error
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
@@ @@+PHP 8.1 (6 errors)+==========++21: Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().
45: Dumped type: string
+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 7.1 – 8.0 (5 errors)+==========++45: Dumped type: string+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.
47: Options<array{name: string}> does not accept int.
Full report
PHP 8.1 (6 errors)
Line
Error
21
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 7.1 – 8.0 (5 errors)
Line
Error
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
@@ @@+PHP 8.1 (6 errors)+==========++21: Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess::offsetGet().
45: Dumped type: string
+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 8.0 (5 errors)+==========++45: Dumped type: string+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 7.4 (24 errors)+==========++14: PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.+14: Parameter #1 $offset (mixed) of method Options::offsetExists() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetExists().+14: Parameter $offset of method Options::offsetExists() has invalid type mixed.+21: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+21: Parameter #1 $offset (mixed) of method Options::offsetGet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetGet().+21: Parameter $offset of method Options::offsetGet() has invalid type mixed.+21: Template type TOffset of method Options::offsetGet() is not referenced in a parameter.+28: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+28: PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.+28: Parameter #1 $offset (mixed) of method Options::offsetSet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetSet().+28: Parameter #2 $value (mixed) of method Options::offsetSet() is not contravariant with parameter #2 $value (mixed) of method ArrayAccess::offsetSet().+28: Parameter $offset of method Options::offsetSet() has invalid type mixed.+28: Parameter $value of method Options::offsetSet() has invalid type mixed.+28: Template type TOffset of method Options::offsetSet() is not referenced in a parameter.+34: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+34: Parameter #1 $offset (mixed) of method Options::offsetUnset() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetUnset().+34: Parameter $offset of method Options::offsetUnset() has invalid type mixed.+34: Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.+45: Dumped type: string+45: Offset 'name' does not exist on Options<array{name: string}>.+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 7.1 – 7.3 (24 errors)+==========++14: PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.+14: Parameter #1 $offset (mixed) of method Options::offsetExists() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetExists().+14: Parameter $offset of method Options::offsetExists() has invalid type mixed.+21: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+21: Parameter #1 $offset (mixed) of method Options::offsetGet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetGet().+21: Parameter $offset of method Options::offsetGet() has invalid type mixed.+21: Template type TOffset of method Options::offsetGet() is not referenced in a parameter.+28: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+28: PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.+28: Parameter #1 $offset (mixed) of method Options::offsetSet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetSet().+28: Parameter #2 $value (mixed) of method Options::offsetSet() is not compatible with parameter #2 $value (mixed) of method ArrayAccess::offsetSet().+28: Parameter $offset of method Options::offsetSet() has invalid type mixed.+28: Parameter $value of method Options::offsetSet() has invalid type mixed.+28: Template type TOffset of method Options::offsetSet() is not referenced in a parameter.+34: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+34: Parameter #1 $offset (mixed) of method Options::offsetUnset() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetUnset().+34: Parameter $offset of method Options::offsetUnset() has invalid type mixed.+34: Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.+45: Dumped type: string+45: Offset 'name' does not exist on Options<array{name: string}>.+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.
47: Options<array{name: string}> does not accept int.
Full report
PHP 8.1 (6 errors)
Line
Error
21
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess::offsetGet().
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 8.0 (5 errors)
Line
Error
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 7.4 (24 errors)
Line
Error
14
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.
14
Parameter #1 $offset (mixed) of method Options::offsetExists() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetExists().
14
Parameter $offset of method Options::offsetExists() has invalid type mixed.
21
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
21
Parameter #1 $offset (mixed) of method Options::offsetGet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetGet().
21
Parameter $offset of method Options::offsetGet() has invalid type mixed.
21
Template type TOffset of method Options::offsetGet() is not referenced in a parameter.
28
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
28
PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.
28
Parameter #1 $offset (mixed) of method Options::offsetSet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetSet().
28
Parameter #2 $value (mixed) of method Options::offsetSet() is not contravariant with parameter #2 $value (mixed) of method ArrayAccess::offsetSet().
28
Parameter $offset of method Options::offsetSet() has invalid type mixed.
28
Parameter $value of method Options::offsetSet() has invalid type mixed.
28
Template type TOffset of method Options::offsetSet() is not referenced in a parameter.
34
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
34
Parameter #1 $offset (mixed) of method Options::offsetUnset() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetUnset().
34
Parameter $offset of method Options::offsetUnset() has invalid type mixed.
34
Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.
45
Dumped type: string
45
Offset 'name' does not exist on Options<array{name: string}>.
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 7.1 – 7.3 (24 errors)
Line
Error
14
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.
14
Parameter #1 $offset (mixed) of method Options::offsetExists() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetExists().
14
Parameter $offset of method Options::offsetExists() has invalid type mixed.
21
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
21
Parameter #1 $offset (mixed) of method Options::offsetGet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetGet().
21
Parameter $offset of method Options::offsetGet() has invalid type mixed.
21
Template type TOffset of method Options::offsetGet() is not referenced in a parameter.
28
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
28
PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.
28
Parameter #1 $offset (mixed) of method Options::offsetSet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetSet().
28
Parameter #2 $value (mixed) of method Options::offsetSet() is not compatible with parameter #2 $value (mixed) of method ArrayAccess::offsetSet().
28
Parameter $offset of method Options::offsetSet() has invalid type mixed.
28
Parameter $value of method Options::offsetSet() has invalid type mixed.
28
Template type TOffset of method Options::offsetSet() is not referenced in a parameter.
34
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
34
Parameter #1 $offset (mixed) of method Options::offsetUnset() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetUnset().
34
Parameter $offset of method Options::offsetUnset() has invalid type mixed.
34
Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.
45
Dumped type: string
45
Offset 'name' does not exist on Options<array{name: string}>.
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
@@ @@+PHP 8.1 (6 errors)+==========++21: Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().
45: Dumped type: string
+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 8.0 (5 errors)+==========++45: Dumped type: string+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 7.4 (24 errors)+==========++14: PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.+14: Parameter #1 $offset (mixed) of method Options::offsetExists() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetExists().+14: Parameter $offset of method Options::offsetExists() has invalid type mixed.+21: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+21: Parameter #1 $offset (mixed) of method Options::offsetGet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().+21: Parameter $offset of method Options::offsetGet() has invalid type mixed.+21: Template type TOffset of method Options::offsetGet() is not referenced in a parameter.+28: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+28: PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.+28: Parameter #1 $offset (mixed) of method Options::offsetSet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().+28: Parameter #2 $value (mixed) of method Options::offsetSet() is not contravariant with parameter #2 $value (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().+28: Parameter $offset of method Options::offsetSet() has invalid type mixed.+28: Parameter $value of method Options::offsetSet() has invalid type mixed.+28: Template type TOffset of method Options::offsetSet() is not referenced in a parameter.+34: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+34: Parameter #1 $offset (mixed) of method Options::offsetUnset() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetUnset().+34: Parameter $offset of method Options::offsetUnset() has invalid type mixed.+34: Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.+45: Dumped type: string+45: Offset 'name' does not exist on Options<array{name: string}>.+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.+47: Options<array{name: string}> does not accept int.++PHP 7.1 – 7.3 (24 errors)+==========++14: PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.+14: Parameter #1 $offset (mixed) of method Options::offsetExists() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetExists().+14: Parameter $offset of method Options::offsetExists() has invalid type mixed.+21: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+21: Parameter #1 $offset (mixed) of method Options::offsetGet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().+21: Parameter $offset of method Options::offsetGet() has invalid type mixed.+21: Template type TOffset of method Options::offsetGet() is not referenced in a parameter.+28: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+28: PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.+28: Parameter #1 $offset (mixed) of method Options::offsetSet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().+28: Parameter #2 $value (mixed) of method Options::offsetSet() is not compatible with parameter #2 $value (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().+28: Parameter $offset of method Options::offsetSet() has invalid type mixed.+28: Parameter $value of method Options::offsetSet() has invalid type mixed.+28: Template type TOffset of method Options::offsetSet() is not referenced in a parameter.+34: PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.+34: Parameter #1 $offset (mixed) of method Options::offsetUnset() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetUnset().+34: Parameter $offset of method Options::offsetUnset() has invalid type mixed.+34: Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.+45: Dumped type: string+45: Offset 'name' does not exist on Options<array{name: string}>.+46: Cannot assign offset 'name' to Options<array<string, string>>.+46: Options<array{name: string}> does not accept string.+47: Cannot assign offset 'name' to Options<array<string, string>>.
47: Options<array{name: string}> does not accept int.
Full report
PHP 8.1 (6 errors)
Line
Error
21
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 8.0 (5 errors)
Line
Error
45
Dumped type: string
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 7.4 (24 errors)
Line
Error
14
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.
14
Parameter #1 $offset (mixed) of method Options::offsetExists() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetExists().
14
Parameter $offset of method Options::offsetExists() has invalid type mixed.
21
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
21
Parameter #1 $offset (mixed) of method Options::offsetGet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().
21
Parameter $offset of method Options::offsetGet() has invalid type mixed.
21
Template type TOffset of method Options::offsetGet() is not referenced in a parameter.
28
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
28
PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.
28
Parameter #1 $offset (mixed) of method Options::offsetSet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().
28
Parameter #2 $value (mixed) of method Options::offsetSet() is not contravariant with parameter #2 $value (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().
28
Parameter $offset of method Options::offsetSet() has invalid type mixed.
28
Parameter $value of method Options::offsetSet() has invalid type mixed.
28
Template type TOffset of method Options::offsetSet() is not referenced in a parameter.
34
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
34
Parameter #1 $offset (mixed) of method Options::offsetUnset() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetUnset().
34
Parameter $offset of method Options::offsetUnset() has invalid type mixed.
34
Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.
45
Dumped type: string
45
Offset 'name' does not exist on Options<array{name: string}>.
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
47
Options<array{name: string}> does not accept int.
PHP 7.1 – 7.3 (24 errors)
Line
Error
14
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.
14
Parameter #1 $offset (mixed) of method Options::offsetExists() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetExists().
14
Parameter $offset of method Options::offsetExists() has invalid type mixed.
21
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
21
Parameter #1 $offset (mixed) of method Options::offsetGet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().
21
Parameter $offset of method Options::offsetGet() has invalid type mixed.
21
Template type TOffset of method Options::offsetGet() is not referenced in a parameter.
28
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
28
PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.
28
Parameter #1 $offset (mixed) of method Options::offsetSet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().
28
Parameter #2 $value (mixed) of method Options::offsetSet() is not compatible with parameter #2 $value (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().
28
Parameter $offset of method Options::offsetSet() has invalid type mixed.
28
Parameter $value of method Options::offsetSet() has invalid type mixed.
28
Template type TOffset of method Options::offsetSet() is not referenced in a parameter.
34
PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.
34
Parameter #1 $offset (mixed) of method Options::offsetUnset() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetUnset().
34
Parameter $offset of method Options::offsetUnset() has invalid type mixed.
34
Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.
45
Dumped type: string
45
Offset 'name' does not exist on Options<array{name: string}>.
46
Cannot assign offset 'name' to Options<array<string, string>>.
46
Options<array{name: string}> does not accept string.
47
Cannot assign offset 'name' to Options<array<string, string>>.
Activity
ondrejmirtes commentedon Dec 18, 2022
Broke in this PR: phpstan/phpstan-src#1623
phpstan-bot commentedon Dec 19, 2022
@lulco After the latest push in 1.9.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.1 (6 errors)
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess::offsetGet().Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 7.1 – 8.0 (5 errors)
Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.VincentLanglet commentedon Feb 19, 2023
I take a look at this and:
getResultmethod on the 1.8.3 branch the issue is solvedgetResultmethod on the 1.8.5 branch, the issue is still heregetResultis not enough because of the refacto Simplify TemplateTypeTrait phpstan-src#1705@rvanvelzen Since both of the PR were made by you, can you help me on this ?
Do you see the issue ?
phpstan-bot commentedon Apr 4, 2023
@lulco After the latest push in 1.10.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.1 (6 errors)
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 7.1 – 8.0 (5 errors)
Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.phpstan-bot commentedon Sep 4, 2024
@lulco After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.1 (6 errors)
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess::offsetGet().Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 8.0 (5 errors)
Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 7.4 (24 errors)
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetExists() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetExists().Parameter $offset of method Options::offsetExists() has invalid type mixed.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetGet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetGet().Parameter $offset of method Options::offsetGet() has invalid type mixed.Template type TOffset of method Options::offsetGet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.Parameter #1 $offset (mixed) of method Options::offsetSet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetSet().Parameter #2 $value (mixed) of method Options::offsetSet() is not contravariant with parameter #2 $value (mixed) of method ArrayAccess::offsetSet().Parameter $offset of method Options::offsetSet() has invalid type mixed.Parameter $value of method Options::offsetSet() has invalid type mixed.Template type TOffset of method Options::offsetSet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetUnset() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess::offsetUnset().Parameter $offset of method Options::offsetUnset() has invalid type mixed.Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.Dumped type: stringOffset 'name' does not exist on Options<array{name: string}>.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 7.1 – 7.3 (24 errors)
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetExists() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetExists().Parameter $offset of method Options::offsetExists() has invalid type mixed.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetGet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetGet().Parameter $offset of method Options::offsetGet() has invalid type mixed.Template type TOffset of method Options::offsetGet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.Parameter #1 $offset (mixed) of method Options::offsetSet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetSet().Parameter #2 $value (mixed) of method Options::offsetSet() is not compatible with parameter #2 $value (mixed) of method ArrayAccess::offsetSet().Parameter $offset of method Options::offsetSet() has invalid type mixed.Parameter $value of method Options::offsetSet() has invalid type mixed.Template type TOffset of method Options::offsetSet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetUnset() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess::offsetUnset().Parameter $offset of method Options::offsetUnset() has invalid type mixed.Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.Dumped type: stringOffset 'name' does not exist on Options<array{name: string}>.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.phpstan-bot commentedon Sep 23, 2024
@lulco After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.1 (6 errors)
Return type mixed of method Options::offsetGet() is not covariant with tentative return type mixed of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 8.0 (5 errors)
Dumped type: stringCannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 7.4 (24 errors)
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetExists() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetExists().Parameter $offset of method Options::offsetExists() has invalid type mixed.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetGet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().Parameter $offset of method Options::offsetGet() has invalid type mixed.Template type TOffset of method Options::offsetGet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.Parameter #1 $offset (mixed) of method Options::offsetSet() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().Parameter #2 $value (mixed) of method Options::offsetSet() is not contravariant with parameter #2 $value (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().Parameter $offset of method Options::offsetSet() has invalid type mixed.Parameter $value of method Options::offsetSet() has invalid type mixed.Template type TOffset of method Options::offsetSet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetUnset() is not contravariant with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetUnset().Parameter $offset of method Options::offsetUnset() has invalid type mixed.Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.Dumped type: stringOffset 'name' does not exist on Options<array{name: string}>.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.PHP 7.1 – 7.3 (24 errors)
PHPDoc tag @param for parameter $offset with type key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetExists() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetExists().Parameter $offset of method Options::offsetExists() has invalid type mixed.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetGet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetGet().Parameter $offset of method Options::offsetGet() has invalid type mixed.Template type TOffset of method Options::offsetGet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.PHPDoc tag @param for parameter $value with type TArray[TOffset] is not subtype of native type mixed.Parameter #1 $offset (mixed) of method Options::offsetSet() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().Parameter #2 $value (mixed) of method Options::offsetSet() is not compatible with parameter #2 $value (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetSet().Parameter $offset of method Options::offsetSet() has invalid type mixed.Parameter $value of method Options::offsetSet() has invalid type mixed.Template type TOffset of method Options::offsetSet() is not referenced in a parameter.PHPDoc tag @param for parameter $offset with type TOffset of key-of<TArray of array> is incompatible with native type mixed.Parameter #1 $offset (mixed) of method Options::offsetUnset() is not compatible with parameter #1 $offset (mixed) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetUnset().Parameter $offset of method Options::offsetUnset() has invalid type mixed.Template type TOffset of method Options::offsetUnset() is not referenced in a parameter.Dumped type: stringOffset 'name' does not exist on Options<array{name: string}>.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept string.Cannot assign offset 'name' to Options<array<string, string>>.Options<array{name: string}> does not accept int.nyamsprod commentedon Jul 18, 2026
Is the following snippet also a consequence of this bug or can this be consider a feature request ?
ArrayAccess does not support Array Shape
westonruter commentedon Nov 2, 2026
I've opened phpstan/phpstan-src#6903 to fix this issue.