vscode-intelephense
vscode-intelephense copied to clipboard
Implementing JsonSerializable::jsonSerialize() on PHP < 8.1 issues non-applicable error
Describe the bug
When implementing JsonSerializable::jsonSerialize()
without return type or using any other return type other than mixed
using PHP v7.2.24
, an error is issued, but in 7.2
this syntax was fully valid. The mixed
return type was only introduced in PHP 8.1.
Possibly related to #3024 (which was considered resolved in v1.12.5).
To Reproduce
class MyClass implements JsonSerializable
{
public function jsonSerialize() // <-- shows error here
{
return [
"key" => "value"
];
}
}
Expected behavior When having set the PHP version to < 8.1, expect no error, since the syntax is valid.
Screenshots
Platform and version
- Windows 11 Version
10.0.22631
Build22631
- VSCode
v1.93.1
- Intelephense
v1.12.6