@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function parse(string $modifier) |
47 | 47 | { |
48 | - $this->tokens = \token_get_all('<?php '. $modifier); |
|
48 | + $this->tokens = \token_get_all('<?php '.$modifier); |
|
49 | 49 | $this->length = count($this->tokens); |
50 | 50 | $this->pos = 1; |
51 | 51 | $this->modifier = []; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | protected function skipWhiteComment() |
110 | 110 | { |
111 | - for ($i = $this->pos + 1; $i < $this->length ; $i++) { |
|
111 | + for ($i = $this->pos + 1; $i < $this->length; $i++) { |
|
112 | 112 | if (is_array($this->tokens[$i])) { |
113 | 113 | if (in_array($this->tokens[$i][0], [T_COMMENT, T_DOC_COMMENT, T_WHITESPACE])) { |
114 | 114 | $this->pos++; |
@@ -98,7 +98,7 @@ |
||
98 | 98 | if ($doc = $property->getDocComment()) { |
99 | 99 | if (is_string($doc) && preg_match('/@var\s+(\w+)/i', $doc, $match)) { |
100 | 100 | $type = \strtolower($match[1]); |
101 | - if (\in_array($type, ['boolean', 'bool', 'integer', 'int' , 'float' , 'double', 'string'])) { |
|
101 | + if (\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string'])) { |
|
102 | 102 | return ObjectMiddleware::RAW; |
103 | 103 | } |
104 | 104 | } |
@@ -6,12 +6,12 @@ |
||
6 | 6 | use suda\framework\http\HTTPRequest; |
7 | 7 | use suda\application\builder\ApplicationBuilder; |
8 | 8 | |
9 | -require_once __DIR__ .'/loader.php'; |
|
9 | +require_once __DIR__.'/loader.php'; |
|
10 | 10 | |
11 | 11 | // 初始化系统加载器 |
12 | 12 | $loader = new Loader; |
13 | 13 | $loader->register(); |
14 | -$loader->addIncludePath(SUDA_SYSTEM .'/src', 'suda'); |
|
14 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
15 | 15 | // 初始化数据目录 |
16 | 16 | defined('SUDA_DATA') or define('SUDA_DATA', Path::toAbsolutePath('~/data')); |
17 | 17 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_DATA); |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class ContentWrapper |
18 | 18 | { |
19 | 19 | protected $types = [ |
20 | - [ JsonContentWrapper::class , ['array', JsonSerializable::class],], |
|
21 | - [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],], |
|
22 | - [ NullContentWrapper::class , ['NULL'],], |
|
23 | - [ FileContentWrapper::class , [SplFileObject::class],], |
|
20 | + [JsonContentWrapper::class, ['array', JsonSerializable::class], ], |
|
21 | + [HtmlContentWrapper::class, ['boolean', 'integer', 'double', 'string'], ], |
|
22 | + [NullContentWrapper::class, ['NULL'], ], |
|
23 | + [FileContentWrapper::class, [SplFileObject::class], ], |
|
24 | 24 | ]; |
25 | 25 | |
26 | 26 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function isTypeOf($data, string $type) : bool |
46 | 46 | { |
47 | - if (is_object($data) && !\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string','array','NULL'])) { |
|
47 | + if (is_object($data) && !\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string', 'array', 'NULL'])) { |
|
48 | 48 | $class = new ReflectionClass($data); |
49 | 49 | $typeRef = new ReflectionClass($type); |
50 | 50 | if ($typeRef->isInterface()) { |