为什么VS Code将$test0
键入为mixed
而不是TestClass
?
<?php
class TestClass {
public $foo;
public function __construct() {
$this->foo = 'bar';
}
public static function getMany( int $howMany ) {
$testies = [];
for( $i = 0; $i < $howMany; $i++ ) {
$testies[] = new self();
}
return $testies;
}
}
$testies = TestClass::getMany(5);
$test0 = $testies[0];