Arquivos
hhvm/hphp/test/slow/reflection_classes/1363.php
T
Paul Tarjan c2ec1c97c9 sortof format slow tests
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.

Codemods:

    codemod '([;{}])([^\n])' '\1\n\2'
    codemod -m '\s*<\?php\s+' '<?php\n\n'
    codemod '\t' '  '

I hand-fixed all the failing tests
2013-05-30 17:32:57 -07:00

54 linhas
1.1 KiB
PHP

<?hh
function foo(Vector<int> $z): Vector<int> {
return $z;
}
$rf = new ReflectionFunction('foo');
var_dump($rf->getReturnTypeText());
class C {
function goo(): int {
return 0;
}
}
$rc = new ReflectionClass('C');
$rm = $rc->getMethod('goo');
var_dump($rm->getReturnTypeText());
class C1 extends C {
function goo() {
return 0;
}
}
$rc = new ReflectionClass('C1');
$rm = $rc->getMethod('goo');
var_dump($rm->getReturnTypeText());
class C2 extends C1 {
function goo(): string {
return '0';
}
}
$rc = new ReflectionClass('C2');
$rm = $rc->getMethod('goo');
var_dump($rm->getReturnTypeText());
interface I {
function m(): string;
}
$rc = new ReflectionClass('I');
$rm = $rc->getMethod('m');
var_dump($rm->getReturnTypeText());
interface I1<T> {
function m(): T;
}
$rc = new ReflectionClass('I1');
$rm = $rc->getMethod('m');
var_dump($rm->getReturnTypeText());
trait T {
function t(): C {
return new C();
}
}
class UseT {
use T;
}
$rc = new ReflectionClass('UseT');
$rm = $rc->getMethod('t');
var_dump($rm->getReturnTypeText());