mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-08 01:05:37 +08:00
add cs fixer and PHPStan and activate it (build 436)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ZM\Annotation;
|
||||
|
||||
|
||||
use Closure;
|
||||
|
||||
abstract class AnnotationBase
|
||||
@@ -12,18 +12,27 @@ abstract class AnnotationBase
|
||||
|
||||
public $class;
|
||||
|
||||
public function __toString() {
|
||||
$str = __CLASS__ . ": ";
|
||||
public function __toString()
|
||||
{
|
||||
$str = __CLASS__ . ': ';
|
||||
foreach ($this as $k => $v) {
|
||||
$str .= "\n\t" . $k . " => ";
|
||||
if (is_string($v)) $str .= "\"$v\"";
|
||||
elseif (is_numeric($v)) $str .= $v;
|
||||
elseif (is_bool($v)) $str .= ($v ? "TRUE" : "FALSE");
|
||||
elseif (is_array($v)) $str .= json_encode($v, JSON_UNESCAPED_UNICODE);
|
||||
elseif ($v instanceof Closure) $str .= "@AnonymousFunction";
|
||||
elseif (is_null($v)) $str .= "NULL";
|
||||
else $str .= "@Unknown";
|
||||
$str .= "\n\t" . $k . ' => ';
|
||||
if (is_string($v)) {
|
||||
$str .= "\"{$v}\"";
|
||||
} elseif (is_numeric($v)) {
|
||||
$str .= $v;
|
||||
} elseif (is_bool($v)) {
|
||||
$str .= ($v ? 'TRUE' : 'FALSE');
|
||||
} elseif (is_array($v)) {
|
||||
$str .= json_encode($v, JSON_UNESCAPED_UNICODE);
|
||||
} elseif ($v instanceof Closure) {
|
||||
$str .= '@AnonymousFunction';
|
||||
} elseif (is_null($v)) {
|
||||
$str .= 'NULL';
|
||||
} else {
|
||||
$str .= '@Unknown';
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user