为什么VS Code无法正确提示类型提示数组项?

时间:2020-11-02 07:49:38

标签: php visual-studio-code php-5.6

为什么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];

0 个答案:

没有答案