Describe the bug
There's this weird case, when you set workspace to limit to a particular PHP version, and use a feature, which is described in validator with a syntax unsuitable for such version.
To Reproduce
A simple example could be created by using Countable interface with codebase restricted below v7.
/** Use PHP=^5.6 */
class TestClass implements \Countable {
public function count() {
return 0;
}
}
which produces an error explaining that the method does not match interface definition.
Method 'TestClass::count()' is not compatible with method 'Countable::count()'.intelephense(P1038)
TestClass::count
Count elements of an object
<?php
public function count(): int { }
@return int<0, \max> The custom count as an integer.
An attempt to "fix" definition instantly switches the warning to say that "7.0+ syntax is used where limit is ^5.6".
Expected behavior
Indeed, the expected behavior to "just work".
I would suggest validating the builtin definitions before spoiling them and suppress errors that would indicate version mismatch, if applied.
Platform and version
PHP Intelephense v1.10.4
VS Code 1.90.2
Windows 10
Describe the bug There's this weird case, when you set workspace to limit to a particular PHP version, and use a feature, which is described in validator with a syntax unsuitable for such version.
To Reproduce A simple example could be created by using Countable interface with codebase restricted below v7.
which produces an error explaining that the method does not match interface definition.
An attempt to "fix" definition instantly switches the warning to say that "7.0+ syntax is used where limit is ^5.6".
Expected behavior Indeed, the expected behavior to "just work". I would suggest validating the builtin definitions before spoiling them and suppress errors that would indicate version mismatch, if applied.
Platform and version PHP Intelephense v1.10.4 VS Code 1.90.2 Windows 10