f() public method

public f ( )
Beispiel #1
0
 function f()
 {
     A1::f();
     A2::f();
     \A1::f();
     \A2::f();
     B::f();
     C::f();
 }
Beispiel #2
0
function main()
{
    print "C::k : " . C::k . "\n";
    $X = "C";
    print "{$X}::k : " . $X::k . "\n";
    # XXX Exit here to avoid unimplemented HHBC instructions.
    exit(0);
    C::sf();
    # XXX Need SProp replacement.
    #print "C::\$s : ".C::$s."\n";
    #print "\$X::\$s : ".$X::$s."\n";
    $c = new C();
    print "\$c->p : " . $c->p . "\n";
    $c->f(43);
    var_dump($c);
    print "Test end\n";
}
Beispiel #3
0
function g() {
  C::f();
}
Beispiel #4
0
<?php

class C
{
    public static function f($foo, $whatever)
    {
    }
}
function g($bar)
{
}
function h()
{
    return GLOBAL_FOO;
}
class D
{
    public static function foo($x, $y)
    {
        return $x->map(function ($i) use($y) {
            return $y[$i];
        });
    }
}
C::f(null, null);
g(null);
Beispiel #5
0
<?php

class C
{
    function __call($name, $values)
    {
        $values[0][0] = 'changed';
    }
}
$a = array('original');
$b = array('original');
$hack =& $b[0];
$c = new C();
$c->f($a);
$c->f($b);
var_dump($a, $b);
Beispiel #6
0
 function f()
 {
     return parent::f();
 }
Beispiel #7
0
<?php

require_once $GLOBALS['HACKLIB_ROOT'];
class C
{
    public static function f($foo, $whatever)
    {
        $x = (int) (5.3 + 2.8) + 20;
        echo $x;
    }
}
class D
{
    public static function foo($x, $y)
    {
        return $x->map(function ($i) use($y) {
            return $y[$i];
        });
    }
}
C::f(array(), null);
<?php

class C
{
    function f($x)
    {
        return $x *= 2;
    }
}
$o = new C();
echo $o->f(17);
$mockedF = 'function($x){
	return $x ** 2;
}';
/*
$o2 = new class extends C {
	function f($x){
		return (function($x){
			return $x ** 2;
		})($x);
	}
};
*/
$code = <<<code
\t\$o2 = new class extends C {
\t\tfunction f(\$x){
\t\t\treturn ({$mockedF})(\$x);
\t\t}
\t};
code;
eval($code);
Beispiel #9
0
<?php

class C extends A implements I
{
    use T;
    function f()
    {
    }
}
abstract class A
{
}
interface I
{
}
trait T
{
}
$v = new C();
$v->f();
Beispiel #10
0
}
abstract class D implements FooBar, Boo
{
}
class C extends D
{
    public function f()
    {
        echo "f\n";
    }
    public function b()
    {
        echo "b\n";
    }
    public function fb()
    {
        echo "fb\n";
    }
    public function o()
    {
        echo "o\n";
    }
}
$c = new C();
$c->f();
$c->b();
$c->fb();
$c->o();
echo Foo::x . "\n";
echo FooBar::x . "\n";
echo C::x . "\n";
Beispiel #11
0
class C
{
    /**
     * @return self
     */
    function f()
    {
        return $this;
    }
    /**
     * @return static
     */
    function g()
    {
        return $this;
    }
    /**
     * @return $this
     */
    function h()
    {
        return $this;
    }
    function test(C $c)
    {
    }
}
$c = new C();
$f = $c->test($c->f());
$g = $c->test($c->g());
$h = $c->test($c->h());
<?php

class C
{
    const FOO = 1;
    private static $bar = 2;
    public static function f()
    {
        eval(<<<'PHP'
var_dump(self::FOO);
var_dump(self::$bar);
var_dump(self::class);
var_dump(static::class);
PHP
);
    }
}
C::f();
Beispiel #13
0
<?php

class C
{
    function g()
    {
        $ex = new Exception();
        $bt = $ex->getTrace();
        foreach ($bt as $k => $_) {
            $frame = $bt[$k];
            unset($frame['file']);
            unset($frame['line']);
            unset($frame['args']);
            ksort($frame);
            $bt[$k] = $frame;
        }
        var_dump($bt);
    }
    function f()
    {
        $this->g();
    }
}
$obj = new C();
$obj->f();
echo "------------------------\n";
Exception::setTraceOptions(DEBUG_BACKTRACE_PROVIDE_OBJECT);
$obj->f();
Beispiel #14
0
<?php

class C
{
    const X = 1;
    static function f()
    {
        return new C();
    }
}
var_dump(C::f()::X);
var_dump(C::{'f' . ''}()::X);
<?php

class C
{
    private $x = 42;
    public function f() : int
    {
        return $this->x;
    }
}
$v = C::f();