Skip to content

Instantly share code, notes, and snippets.

/test.php Secret

Created August 11, 2015 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f9685c470d69a69afed1 to your computer and use it in GitHub Desktop.
Save anonymous/f9685c470d69a69afed1 to your computer and use it in GitHub Desktop.
<?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