示例#1
0
function test_call_method_dataflow()
{
    $o = new B();
    $o->foo(1, 2);
    //SKIP: requires dataflow (simple here, but still)
    $o->foo();
}
示例#2
0
function test()
{
    $a = new A();
    echo $a->foo();
    $a = new B();
    echo $a->foo(555);
    echo $a->foo();
}
示例#3
0
文件: 78.php 项目: badlamer/hhvm
function bar()
{
    $obj = new A();
    $obj->foo(123);
    $obj = new B();
    $obj->foo(123, 456);
}
示例#4
0
文件: 76.php 项目: badlamer/hhvm
function bar()
{
    $obj = new A();
    $obj->foo();
    $obj = new B();
    $obj->foo();
}
示例#5
0
文件: 1877.php 项目: badlamer/hhvm
 public function foo2()
 {
     B::foo();
     // B always changes 'static'
     self::foo();
     // 'self' doesn't change 'static'
 }
示例#6
0
 public static function test()
 {
     $arr = array('foo');
     self::foo();
     parent::foo();
     self::$arr[0]();
     parent::$arr[0]();
     echo self::MYCONST . "\n";
     echo parent::MYCONST . "\n";
 }
示例#7
0
function main()
{
    $x = null;
    if (true) {
        $x = new A();
    } else {
        $x = new B();
    }
    //TODO: it should call both methods ...
    $x->foo();
    //var_dump($x);
}
示例#8
0
文件: 724.php 项目: badlamer/hhvm
<?php

class A
{
}
class AA extends A
{
    function test()
    {
        print 'AA ok';
    }
}
class B
{
    function foo(A $obj)
    {
        $obj->test();
    }
}
$obj = new AA();
$b = new B();
$b->foo($obj);
示例#9
0
文件: method.php 项目: badlamer/hhvm
    {
        print "A::baz\n";
    }
    private function f()
    {
        echo "A::f\n";
    }
    public function g($a)
    {
        echo "A::g\n";
        $a->f();
    }
}
class B extends A
{
    protected function bar()
    {
        print "B::bar\n";
        $this->baz();
    }
    public function h($a)
    {
        print "B::g\n";
        $a->f();
    }
}
$a = new A();
$b = new B();
$b->foo();
$b->g($a);
#$b->h($a);
示例#10
0
function main()
{
    $b = new B();
    $b->foo();
}
示例#11
0
文件: 673.php 项目: badlamer/hhvm
<?php

class A
{
    protected static $foo = 11;
    function foo()
    {
        var_dump(A::$foo);
    }
}
class B extends A
{
    public static $foo;
}
var_dump(B::$foo);
B::$foo = 123;
A::foo();
示例#12
0
文件: 1201.php 项目: badlamer/hhvm
<?php

// Make sure that we can tell which class was called for intercepted static
// methods
class A
{
    public function foo()
    {
        echo 'foo called';
    }
}
class B extends A
{
}
fb_intercept('A::foo', function ($_, $called_on) {
    var_dump($called_on);
});
A::foo();
B::foo();
// Trigger run_intercept_handler_for_invokefunc codepath
$class = 'B';
$c = 'call_user_fun';
$c .= 'c';
$c(array($class, 'foo'));
示例#13
0
<?php

// including scripts example
include "a.php";
require_once "b.php";
f(12345);
$a = new A("AAA");
$a->write();
$a->foo("hello");
$a->write();
$b = new B("BBB");
$b->write();
$b->foo("bye");
$b->write();
fgets(STDIN);
示例#14
0
<?php

class A
{
    function foo()
    {
        $f = static function () {
            return self::class;
        };
        return $f();
    }
}
class B extends A
{
}
$b = new B();
var_dump($b->foo());
示例#15
0
<?php

require "tests.php";
require "overload_return_type.php";
$b = new B();
check::equal($b->foo(1), 0, "");
check::classname("A", $b->foo("test"));
check::equal(overload_return_type::foo(), 1, "overload_return_type::foo() should be 1");
check::equal(overload_return_type::bar(), 1, "overload_return_type::bar() should be 1");
示例#16
0
<?php

class A
{
    public function foo(array $x)
    {
        return 1;
    }
}
class B extends A
{
    //override
    public function foo($x)
    {
        return 2;
    }
}
$o = new B();
$o->foo(4);
示例#17
0
文件: method3.php 项目: badlamer/hhvm
 function foo()
 {
     $b = new B();
     $b->foo();
 }
示例#18
0
function test_method()
{
    $o = new B();
    $o->foo(1, 2);
}
示例#19
0
function main()
{
    return B::foo() + C::foo();
}
示例#20
0
文件: __call.php 项目: Halfnhav4/pfff
<?php

class A
{
    public function foo()
    {
        echo "A::foo()\n";
    }
}
class B extends A
{
    public function __call($f, $args)
    {
        echo "B::__call({$f}, {$args})\n";
    }
}
$o = new B();
// this will call A::foo. The __call is used only when
// nothing was found in the whole hierarchy, not just
// when nothing was found in your class.
$o->foo();
// this will call B::__call
$o->bar();
示例#21
0
文件: 2173.php 项目: badlamer/hhvm
        $class = get_called_class();
        (yield $class);
    }
    public function foo()
    {
        return self::gen();
    }
}
class B extends A
{
}
function t($x)
{
    foreach ($x as $v) {
        var_dump($v);
    }
}
t(B::sgen());
t(B::sfoo());
t(A::sgen());
t(A::sfoo());
t(B::gen());
t(B::foo());
t(A::gen());
t(A::foo());
$b = new B();
t($b->gen());
t($b->foo());
$a = new A();
t($a->gen());
t($a->foo());
示例#22
0
文件: 1327.php 项目: badlamer/hhvm
function main()
{
    $b = new B();
    $b->foo();
    var_dump($b);
}
示例#23
0
文件: cuf.php 项目: n3b/hiphop-php
 public function doFoo()
 {
     $this->foo();
     // G G G
     B::foo();
     // B B    (Zend: B G G) (Rule 1)
     C::foo();
     // C C    (Zend: C G G) (Rule 1)
     D::foo();
     // D D    (Zend: D G G) (Rule 1)
     F::foo();
     // F G G
     G::foo();
     // G G G
     H::foo();
     // H H    (Zend: H G G) (Rule 1)
     parent::foo();
     // F G G
     self::foo();
     // G G G
     static::foo();
     // G G G
     echo "****************\n";
 }
示例#24
0
文件: 723.php 项目: badlamer/hhvm
<?php

class A
{
    function test()
    {
        print 'A';
    }
    function foo()
    {
        $this->test();
    }
}
class B extends A
{
    function test()
    {
        print 'B';
    }
}
$obj = new A();
$obj = new B();
$obj->foo();
}
?>
--FILE--
<?php 
class A
{
    function foo($arg1 = 1)
    {
    }
}
class B extends A
{
    function foo($arg1 = 2, $arg2 = 3)
    {
        var_dump($arg1);
        var_dump($arg2);
    }
}
class C extends A
{
    function foo()
    {
    }
}
$b = new B();
$b->foo(1);
// TODO: Strict Standards: Declaration of C::foo() should be compatible with A::foo($arg1 = 1) in %s on line %d
?>
--EXPECTF--
int(1)
int(3)
示例#26
0
[expect exact] ahoj

[file]
<?php 
include "b.inc";
class C extends B
{
}
$x = new B();
$x->x = "ahoj";
$x->foo();
示例#27
0
<?php

class A
{
    static function foo()
    {
        $f = static function () {
            return static::class;
        };
        return $f();
    }
}
class B extends A
{
}
var_dump(B::foo());