function actionDefault()
 {
     // Create new instance of MyClass and execute test()
     $my = new MyClass();
     $res = $my->test();
     // Check for errors
     while ($err = YDError::catchError($res)) {
         YDDebugUtil::dump($err, '$err');
         $err->level;
         // 3
         $err->name;
         // fatal
         $err->message;
         // We couldn't do something
         $err->file;
         // ..../MyClass.php
         $err->line;
         // x
     }
     // We can also set automatic reporting
     YDError::reporting(YD_ERROR_FATAL);
     // display fatals, warnings and notices
     YDError::reporting(YD_ERROR_WARNING);
     // display warnings and notices
     YDError::reporting(YD_ERROR_NOTICE);
     // display notices
     YDError::reporting(YD_ERROR_NONE);
     // don't display errors
     // We can get the last errors array
     $errors = YDError::getAll();
     YDDebugUtil::dump($errors, '$errors');
     // Or we could dump the error
     if ($err = YDError::catchError($res)) {
         $err->dump();
     }
 }
示例#2
0
文件: 2023.php 项目: badlamer/hhvm
<?php

class MyClass
{
    static function test()
    {
        return __TRAIT__;
    }
}
function someFun()
{
    return __TRAIT__;
}
$t = __TRAIT__;
var_dump($t);
$t = MyClass::test();
var_dump($t);
$t = someFun();
var_dump($t);