GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( e28ef8...589b37 )
by cao
03:51
created
src/Console/Annotations/ParamAnnotationHandler.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
         $paramType = null;
23 23
         $paramName = null;
24 24
         $paramDoc = '';
25
-        if(substr($text, 0, 1) == '$'){ //带$前缀的是变量
25
+        if (substr($text, 0, 1) == '$') { //带$前缀的是变量
26 26
             $params = new AnnotationParams($text, 2);
27 27
             $paramName = substr($params->getParam(0), 1);
28 28
             $paramDoc = $params->getRawParam(1, '');
29
-        }else{
29
+        }else {
30 30
             $params = new AnnotationParams($text, 3);
31
-            if ($params->count() >=2 && substr($params->getParam(1), 0, 1) == '$'){
31
+            if ($params->count()>=2 && substr($params->getParam(1), 0, 1) == '$') {
32 32
                 $paramType = $params->getParam(0); //TODO 检测类型是否合法
33 33
                 $paramName = substr($params->getParam(1), 1);
34 34
                 $paramDoc = $params->getRawParam(2, '');
35
-            }else{
35
+            }else {
36 36
                 \PhpBoot\abort(new AnnotationSyntaxException("@param $text syntax error"));
37 37
             }
38 38
         }
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function __invoke(ConsoleContainer $container, $ann, EntityContainerBuilder $entityBuilder)
47 47
     {
48
-        if(!$ann->parent){
48
+        if (!$ann->parent) {
49 49
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent route");
50 50
             return;
51 51
         }
52 52
         $target = $ann->parent->name;
53 53
         $command = $container->getCommand($target);
54
-        if(!$command){
54
+        if (!$command) {
55 55
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent route");
56
-            return ;
56
+            return;
57 57
         }
58 58
         $className = $container->getClassName();
59 59
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
         $paramMeta = $command->getParamMeta($paramName);
63 63
         $paramMeta or \PhpBoot\abort(new AnnotationSyntaxException("$className::$target param $paramName not exist "));
64 64
         //TODO 检测声明的类型和注释的类型是否匹配
65
-        if($paramType){
66
-            $paramMeta->type = TypeHint::normalize($paramType, $className);//or \PhpBoot\abort(new AnnotationSyntaxException("{$container->getClassName()}::{$ann->parent->name} @{$ann->name} syntax error, param $paramName unknown type:$paramType "));
65
+        if ($paramType) {
66
+            $paramMeta->type = TypeHint::normalize($paramType, $className); //or \PhpBoot\abort(new AnnotationSyntaxException("{$container->getClassName()}::{$ann->parent->name} @{$ann->name} syntax error, param $paramName unknown type:$paramType "));
67 67
             $container = ContainerFactory::create($entityBuilder, $paramMeta->type);
68 68
             $paramMeta->container = $container;
69 69
         }
Please login to merge, or discard this patch.
src/Console/Annotations/ValidateAnnotationHandler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,29 +18,29 @@
 block discarded – undo
18 18
      */
19 19
     public function __invoke(ConsoleContainer $container, $ann)
20 20
     {
21
-        if(!$ann->parent || !$ann->parent->parent){
21
+        if (!$ann->parent || !$ann->parent->parent) {
22 22
             Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent parent");
23 23
             return;
24 24
         }
25 25
         $target = $ann->parent->parent->name;
26 26
         $command = $container->getCommand($target);
27
-        if(!$command){
27
+        if (!$command) {
28 28
             Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent parent");
29
-            return ;
29
+            return;
30 30
         }
31 31
         $params = new AnnotationParams($ann->description, 2);
32 32
 
33 33
         count($params)>0 or \PhpBoot\abort(new AnnotationSyntaxException("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target require 1 param, {$params->count()} given"));
34 34
 
35
-        if($ann->parent->name == 'param'){
35
+        if ($ann->parent->name == 'param') {
36 36
             list($paramType, $paramName, $paramDoc) = ParamAnnotationHandler::getParamInfo($ann->parent->description);
37 37
 
38 38
             $paramMeta = $command->getParamMeta($paramName);
39
-            if($params->count()>1){
39
+            if ($params->count()>1) {
40 40
                 $paramMeta->validation = [$params[0], $params[1]];
41
-            }else{
41
+            }else {
42 42
                 $paramMeta->validation = $params[0];
43
-                if($paramMeta->validation) {
43
+                if ($paramMeta->validation) {
44 44
                     $v = new Validator();
45 45
                     $v->rule($paramMeta->validation, $paramMeta->name);
46 46
                     if ($v->hasRule('optional', $paramMeta->name)) {
Please login to merge, or discard this patch.
src/Console.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $container = $this->consoleContainerBuilder->build($className);
56 56
         /**@var ConsoleContainer $container*/
57 57
         foreach ($container->getCommands() as $name => $command) {
58
-            $command->setCode(function (InputInterface $input, OutputInterface $output)use ($container, $command){
58
+            $command->setCode(function(InputInterface $input, OutputInterface $output)use ($container, $command){
59 59
                 return $this->diInvoker->call([$command, 'invoke'], ['container'=>$container, 'input'=>$input, 'output'=>$output]);
60 60
             });
61 61
             $this->add($command);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $dir = @dir($fromPath) or abort("dir $fromPath not exist");
73 73
 
74
-        $getEach = function () use ($dir) {
74
+        $getEach = function() use ($dir) {
75 75
             $name = $dir->read();
76 76
             if (!$name) {
77 77
                 return $name;
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
             if ($entry == '.' || $entry == '..') {
84 84
                 continue;
85 85
             }
86
-            $path = $fromPath . '/' . str_replace('\\', '/', $entry);
86
+            $path = $fromPath.'/'.str_replace('\\', '/', $entry);
87 87
             if (is_file($path) && substr_compare($entry, '.php', strlen($entry) - 4, 4, true) == 0) {
88
-                $class_name = $namespace . '\\' . substr($entry, 0, strlen($entry) - 4);
88
+                $class_name = $namespace.'\\'.substr($entry, 0, strlen($entry) - 4);
89 89
                 $this->loadCommandsFromClass($class_name);
90
-            } else {
90
+            }else {
91 91
                 //\Log::debug($path.' ignored');
92 92
             }
93 93
         }
Please login to merge, or discard this patch.
src/Console/ConsoleContainer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     public function getCommand($target)
60 60
     {
61
-        return isset($this->commands[$target])?$this->commands[$target]:null;
61
+        return isset($this->commands[$target]) ? $this->commands[$target] : null;
62 62
     }
63 63
     /**
64 64
      * @return string
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     }
98 98
     public function postCreate()
99 99
     {
100
-        foreach ($this->commands as $command){
100
+        foreach ($this->commands as $command) {
101 101
             $command->postCreate($this);
102 102
         }
103 103
     }
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getInstance(FactoryInterface $factory)
115 115
     {
116
-        if(!$this->instance ){
117
-            $this->instance  = $factory->make($this->getClassName());
116
+        if (!$this->instance) {
117
+            $this->instance = $factory->make($this->getClassName());
118 118
         }
119 119
         return $this->instance;
120 120
     }
Please login to merge, or discard this patch.
src/Console/Command.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function __construct($actionName, $name)
37 37
     {
38
-        parent::__construct($name?:$actionName);
38
+        parent::__construct($name ?: $actionName);
39 39
         $this->actionName = $actionName;
40 40
     }
41 41
     /**
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function postCreate(ConsoleContainer $container)
50 50
     {
51
-        if($container->getModuleName()){
51
+        if ($container->getModuleName()) {
52 52
             $this->setName($container->getModuleName().'.'.$this->getName());
53 53
         }
54 54
 
55
-        foreach ($this->paramMetas as $paramMeta){
56
-            $mode = $paramMeta->isOptional?InputArgument::OPTIONAL:InputArgument::REQUIRED;
57
-            if($paramMeta->container instanceof ArrayContainer || $paramMeta->container instanceof EntityContainer){
58
-                $mode = $mode|InputArgument::IS_ARRAY;
55
+        foreach ($this->paramMetas as $paramMeta) {
56
+            $mode = $paramMeta->isOptional ?InputArgument::OPTIONAL : InputArgument::REQUIRED;
57
+            if ($paramMeta->container instanceof ArrayContainer || $paramMeta->container instanceof EntityContainer) {
58
+                $mode = $mode | InputArgument::IS_ARRAY;
59 59
             }
60 60
             $this->addArgument($paramMeta->name,
61 61
                 $mode,
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function getParamMeta($name)
69 69
     {
70
-        foreach ($this->paramMetas as $meta){
71
-            if($meta->name == $name){
70
+        foreach ($this->paramMetas as $meta) {
71
+            if ($meta->name == $name) {
72 72
                 return $meta;
73 73
             }
74 74
         }
@@ -84,40 +84,40 @@  discard block
 block discarded – undo
84 84
      * @throws \DI\DependencyException
85 85
      * @throws \DI\NotFoundException
86 86
      */
87
-    public function invoke(FactoryInterface $factory,ConsoleContainer $container, InputInterface $input, OutputInterface $output)
87
+    public function invoke(FactoryInterface $factory, ConsoleContainer $container, InputInterface $input, OutputInterface $output)
88 88
     {
89 89
         $params = [];
90 90
         $reference = [];
91
-        $this->bindInput($input, $params,$reference);
91
+        $this->bindInput($input, $params, $reference);
92 92
         $code = call_user_func_array([$container->getInstance($factory), $this->actionName], $params);
93 93
         return $code;
94 94
     }
95 95
 
96
-    public function bindInput(InputInterface $input, array &$params, array &$reference){
96
+    public function bindInput(InputInterface $input, array &$params, array &$reference) {
97 97
         $vld = new Validator();
98 98
         $req = ['argv'=>$input->getArguments()];
99 99
         $requestArray = new ArrayAdaptor($req);
100 100
         $inputs = [];
101
-        foreach ($this->paramMetas as $k=>$meta){
102
-            if($meta->isPassedByReference){
101
+        foreach ($this->paramMetas as $k=>$meta) {
102
+            if ($meta->isPassedByReference) {
103 103
                 // param PassedByReference is used to output
104 104
                 continue;
105 105
             }
106 106
             $source = \JmesPath\search($meta->source, $requestArray);
107
-            if ($source !== null){
107
+            if ($source !== null) {
108 108
                 $source = ArrayAdaptor::strip($source);
109
-                if($source instanceof ParameterBag){
109
+                if ($source instanceof ParameterBag) {
110 110
                     $source = $source->all();
111 111
                 }
112
-                if($meta->container){
112
+                if ($meta->container) {
113 113
                     $inputs[$meta->name] = $meta->container->make($source);
114
-                }else{
114
+                }else {
115 115
                     $inputs[$meta->name] = $source;
116 116
                 }
117
-                if($meta->validation){
117
+                if ($meta->validation) {
118 118
                     $vld->rule($meta->validation, $meta->name);
119 119
                 }
120
-            }else{
120
+            }else {
121 121
                 $meta->isOptional or \PhpBoot\abort(new \InvalidArgumentException("the parameter \"{$meta->source}\" is missing"));
122 122
                 $inputs[$meta->name] = $meta->default;
123 123
             }
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
         );
134 134
 
135 135
         $pos = 0;
136
-        foreach ($this->paramMetas as $meta){
137
-            if($meta->isPassedByReference){
136
+        foreach ($this->paramMetas as $meta) {
137
+            if ($meta->isPassedByReference) {
138 138
                 $params[$pos] = null;
139
-            }else{
139
+            }else {
140 140
                 $params[$pos] = $inputs[$meta->name];
141 141
             }
142 142
             $pos++;
Please login to merge, or discard this patch.
src/Lock/LocalAutoLock.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class LocalAutoLock
10 10
 {
11
-    static function lock($key, $seconds, callable $success, callable $error=null){
11
+    static function lock($key, $seconds, callable $success, callable $error = null) {
12 12
         $key = 'lock:'.$key;
13
-        if(function_exists('apc_add')){
13
+        if (function_exists('apc_add')) {
14 14
             $lock = new ApcLock();
15
-        }else{
15
+        }else {
16 16
             $lock = new FileLock();
17 17
         }
18
-        try{
19
-            if(!isset(self::$currentLock[$key])){
18
+        try {
19
+            if (!isset(self::$currentLock[$key])) {
20 20
                 self::$currentLock[$key] = 0;
21 21
             }
22
-            if(self::$currentLock[$key] == 0){  //未加锁
23
-                if(!$lock->lock($key, $seconds)){ //加锁失败
24
-                    if($error){
22
+            if (self::$currentLock[$key] == 0) {  //未加锁
23
+                if (!$lock->lock($key, $seconds)) { //加锁失败
24
+                    if ($error) {
25 25
                         return $error();
26 26
                     }
27 27
                     return;
@@ -29,37 +29,37 @@  discard block
 block discarded – undo
29 29
             }
30 30
             //嵌套加锁
31 31
             self::$currentLock[$key]++;
32
-        }catch (\Exception $e){
33
-            if($error){
32
+        }catch (\Exception $e) {
33
+            if ($error) {
34 34
                 return $error();
35 35
             }
36 36
             return;
37 37
         }
38 38
         $res = null;
39
-        try{
39
+        try {
40 40
             $res = $success();
41
-        }catch (\Exception $e){
41
+        }catch (\Exception $e) {
42 42
             self::$currentLock[$key]--;
43
-            if(self::$currentLock[$key] == 0){
44
-                try{
43
+            if (self::$currentLock[$key] == 0) {
44
+                try {
45 45
                     $lock->unlock($key);
46
-                }catch (\Exception $e){
46
+                }catch (\Exception $e) {
47 47
 
48 48
                 }
49 49
             }
50 50
             throw $e;
51 51
         }
52 52
         self::$currentLock[$key]--;
53
-        if(self::$currentLock[$key] == 0){
54
-            try{
53
+        if (self::$currentLock[$key] == 0) {
54
+            try {
55 55
                 $lock->unlock($key);
56
-            }catch (\Exception $e){
56
+            }catch (\Exception $e) {
57 57
 
58 58
             }
59 59
         }
60 60
         return $res;
61 61
     }
62 62
 
63
-    private $cache=[];
64
-    static private $currentLock=[];
63
+    private $cache = [];
64
+    static private $currentLock = [];
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
src/Utils/SafeFileWriter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@
 block discarded – undo
16 16
      * @param boolean $overwrite 是否覆盖已有文件
17 17
      * @return boolean
18 18
      */
19
-    static public function write($path, $data, $overwrite = true){
19
+    static public function write($path, $data, $overwrite = true) {
20 20
         $path = str_replace('\\', '/', $path);
21 21
         $fileDir = dirname($path);
22 22
         $tmpFile = tempnam($fileDir, 'safe_writer_');
23 23
         false !== @file_put_contents($tmpFile, $data) or \PhpBoot\abort("write to file: $tmpFile failed");
24
-        if($overwrite){
24
+        if ($overwrite) {
25 25
             @unlink($path); //删除原始文件
26 26
         }
27
-        if(!rename($tmpFile, $path)){
27
+        if (!rename($tmpFile, $path)) {
28 28
             @unlink($tmpFile); //删除原始文件
29 29
             \PhpBoot\abort("write to file: $tmpFile failed");
30 30
             return false;
Please login to merge, or discard this patch.
src/Lock/FileLock.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,17 +8,17 @@
 block discarded – undo
8 8
     private $file;
9 9
     public function lock($key, $ttl)
10 10
     {
11
-        if($this->locked){
11
+        if ($this->locked) {
12 12
             \PhpBoot\abort("relock $key");
13 13
         }
14 14
         $path = sys_get_temp_dir().'/lock_252a8fdc9b944af99a9bc53d2aea08f1_'.$key;
15 15
         $this->file = @fopen($path, 'a');
16 16
         if (!$this->file || !flock($this->file, LOCK_EX | LOCK_NB)) {
17
-            if($this->file){
17
+            if ($this->file) {
18 18
                 fclose($this->file);
19 19
             }
20 20
             return false;
21
-        } else {
21
+        }else {
22 22
             $this->locked = true;
23 23
         }
24 24
         return true;
Please login to merge, or discard this patch.
src/Validator/Validator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,13 +55,13 @@
 block discarded – undo
55 55
      */
56 56
     public function rule($rule, $fields)
57 57
     {
58
-        if(is_string($rule)){
58
+        if (is_string($rule)) {
59 59
             $rules = explode('|', $rule);
60
-            foreach ($rules as $r){
60
+            foreach ($rules as $r) {
61 61
                 $params = explode(':', trim($r));
62 62
                 $rule = $params[0];
63
-                $params = isset($params[1])?explode(',', $params[1]):[];
64
-                if($rule == 'in' || $rule == 'notIn'){
63
+                $params = isset($params[1]) ?explode(',', $params[1]) : [];
64
+                if ($rule == 'in' || $rule == 'notIn') {
65 65
                     $params = [$params];
66 66
                 }
67 67
                 call_user_func_array([$this, 'parent::rule'], array_merge([$rule, $fields], $params));
Please login to merge, or discard this patch.