-
-
Save anonymous/f9685c470d69a69afed1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Result { | |
/** @var int */ | |
private $num; | |
/** | |
* @param int $num | |
*/ | |
public function __construct($num) { | |
$this->num = $num; | |
} | |
/** | |
* @return int | |
*/ | |
public function getNum() { | |
return $this->num; | |
} | |
} | |
/** | |
* @param int $times | |
* @return Result[] | |
*/ | |
function test($times) { | |
$res = []; | |
for($i=0; $times--; $i++) { | |
$res[] = new Result($i); | |
} | |
return $res; | |
} | |
$items = test(10); | |
foreach($items as $item) { | |
$item-> /* autocomplete: getNum(): int */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment