<?php

namespace FooSpace;

trait Fooable
{
    function foo() : \Iterator
    {
        return new \EmptyIterator();
    }
}
class Foo
{
    use Fooable;
}
$foo = new Foo();
var_dump($foo->foo([]));
Beispiel #2
0
function foo()
{
    //Foo::foo(1, 2);
    Foo::foo(1, 2)->foobar();
}
Beispiel #3
0
 function __toString()
 {
     self::$foo = $this;
     return 'foo';
 }
 function bar()
 {
     $foo = new Foo();
     $foo->foo();
     foo();
 }
Beispiel #5
0
{
    public function foo()
    {
        echo 'a';
    }
}
trait B
{
    public function foo()
    {
        echo 'b';
    }
}
trait C
{
    public function foo()
    {
        echo 'c';
    }
}
class Foo
{
    use C, A, B {
        B::foo insteadof A, C;
    }
}
$t = new Foo();
$t->foo();
?>

Beispiel #6
0
class Foo
{
    function foo()
    {
        echo "1";
    }
}
function func(&$q)
{
    $q = 1;
}
$a = $_GET['a'];
$b = "1 and {$a}";
$e = $_GET['e'];
$e = "1";
$f = "1 and {$e}";
$d = $_COOKIE['d'];
$c = array();
$c[0] = $_POST['c'];
$a = str_replace($b, "1", "2");
//$a = $b = $c = $d = 1;
//$a = $b = $c[0] = $d;
$d = Foo();
$d = new Foo();
Foo::foo();
// affect $a
func($a);
//
$c[0] = $a;
$c[$b] = $a;
echo $c[$b];
function testArgumentsContainsConstantsPostfixExpression()
{
    Foo::foo(\b\a\r\Bar::BAZ);
}
Beispiel #8
0
 /**
  * @test
  * @expectedException \BadMethodCallException
  */
 public function test_if_emit_error_calling_method_not_found()
 {
     $foo = new Foo();
     $foo->bar = 'print';
     $foo->foo();
 }
<?php

namespace Collections;

class Foo
{
    function foo(\Iterator $i) : \Iterator
    {
        return $i;
    }
}
$foo = new Foo();
var_dump($foo->foo(new \EmptyIterator()));