コード例 #1
0
        throw new Exception("bad double");
    }
    function return_const_char_star()
    {
        throw new Exception("bad const_char_star");
    }
    function return_std_string()
    {
        throw new Exception("bad std_string");
    }
    function return_Bar()
    {
        throw new Exception("bad Bar");
    }
}
$bad = new Bad();
try {
    $bad->call_int();
    check::fail("Exception wasn't propagated from Bad::return_int()");
} catch (Exception $e) {
    check::equal($e->getMessage(), "bad int", "propagated exception incorrect");
}
try {
    $bad->call_double();
    check::fail("Exception wasn't propagated from Bad::return_double()");
} catch (Exception $e) {
    check::equal($e->getMessage(), "bad double", "propagated exception incorrect");
}
try {
    $bad->call_const_char_star();
    check::fail("Exception wasn't propagated from Bad::return_const_char_star()");
コード例 #2
0
ファイル: bad.php プロジェクト: sharkodlak/coding-style
    }
    # invalid comment
    public function multipleStatements()
    {
        $number = 1;
        doSomethink();
        return $number;
    }
    protected function camel_caps()
    {
        doSomethink();
    }
    protected function nesting($first, $second, $third, $fourth)
    {
        if ($first) {
            if ($second) {
                if ($third) {
                    if ($fourth) {
                        doSomethink();
                    }
                }
            }
        }
    }
}
?>
Output send
<?php 
// Well it looks like it can't be parsed
Bad::asdf();
// Ends with closing tag