VSCode PHP Tools >
Warnings are being reported in "Problem" tabs and being underlined in yellow when using object type hinting
Consider the following code:
<?php
class TestClass
{
public function testTypeHint(object $test): object
{
$test->newProp = 'value';
return $test;
}
}
The above code generates these warnings:
Use of unknown class: 'object' PHP(PHP0413)
Use of unknown class: 'object' PHP(PHP0413)
Adding "use \stdClass" will remove the warning but I don't feel it should be necessary
<?php
use \stdClass;
class TestClass
{
public function testTypeHint(object $test): object
{
$test->newProp = 'value';
return $test;
}
}