瀏覽代碼

ComposerUpdate

Anyon 4 年之前
父節點
當前提交
4b8d70d7b3

+ 5 - 5
composer.lock

@@ -223,16 +223,16 @@
         },
         {
             "name": "opis/closure",
-            "version": "3.5.2",
+            "version": "3.5.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/opis/closure.git",
-                "reference": "2e3299cea6f485ca64d19c540f46d7896c512ace"
+                "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/opis/closure/zipball/2e3299cea6f485ca64d19c540f46d7896c512ace",
-                "reference": "2e3299cea6f485ca64d19c540f46d7896c512ace",
+                "url": "https://api.github.com/repos/opis/closure/zipball/cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
+                "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -286,7 +286,7 @@
                 "serialization",
                 "serialize"
             ],
-            "time": "2020-05-21T20:09:36+00:00"
+            "time": "2020-05-25T09:32:45+00:00"
         },
         {
             "name": "psr/cache",

+ 2 - 0
readme.md

@@ -30,6 +30,8 @@ ThinkAdmin 非常适用快速二次开发,默认集成 微信开发组件,
 
 本地开发命令`php think run`,使用`http://127.0.0.1:8000`访问项目。
 
+官方地址及开发指南:https://thinkadmin.top
+
 PHP 开发技术交流( QQ 群 513350915)
 
 [![PHP微信开发群 (SDK)](http://pub.idqqimg.com/wpa/images/group.png)](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a) 

+ 6 - 6
vendor/composer/installed.json

@@ -222,17 +222,17 @@
     },
     {
         "name": "opis/closure",
-        "version": "3.5.2",
-        "version_normalized": "3.5.2.0",
+        "version": "3.5.3",
+        "version_normalized": "3.5.3.0",
         "source": {
             "type": "git",
             "url": "https://github.com/opis/closure.git",
-            "reference": "2e3299cea6f485ca64d19c540f46d7896c512ace"
+            "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/opis/closure/zipball/2e3299cea6f485ca64d19c540f46d7896c512ace",
-            "reference": "2e3299cea6f485ca64d19c540f46d7896c512ace",
+            "url": "https://api.github.com/repos/opis/closure/zipball/cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
+            "reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
             "shasum": "",
             "mirrors": [
                 {
@@ -248,7 +248,7 @@
             "jeremeamia/superclosure": "^2.0",
             "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
         },
-        "time": "2020-05-21T20:09:36+00:00",
+        "time": "2020-05-25T09:32:45+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {

+ 5 - 0
vendor/opis/closure/CHANGELOG.md

@@ -1,5 +1,10 @@
 CHANGELOG
 ---------
+### v3.5.3, 2020.05.25
+
+- Improved parser
+- The class scope optimisation is no longer used. We always bind now to the closure's original class scope.
+If the class scope was `null`, then the optimisation didn't work as expected and kept the `SerializableClosure` scope.
 
 ### v3.5.2, 2020.05.21
 

+ 7 - 2
vendor/opis/closure/functions.php

@@ -26,12 +26,17 @@ function serialize($data)
  * Unserialize
  *
  * @param $data
+ * @param $options
  * @return mixed
  */
-function unserialize($data)
+function unserialize($data, array $options = null)
 {
     SerializableClosure::enterContext();
-    $data = \unserialize($data);
+    if ($options === null || PHP_MAJOR_VERSION < 7) {
+        $data = \unserialize($data);
+    } else {
+        $data = \unserialize($data, $options);
+    }
     SerializableClosure::unwrapClosures($data);
     SerializableClosure::exitContext();
     return $data;

+ 25 - 22
vendor/opis/closure/src/ReflectionClosure.php

@@ -107,6 +107,8 @@ class ReflectionClosure extends ReflectionFunction
             $fn = PHP_MINOR_VERSION === 4;
         }
 
+        $class_keywords = ['self', 'static', 'parent'];
+
         $ns = $this->getNamespaceName();
         $nsf = $ns == '' ? '' : ($ns[0] == '\\' ? $ns : '\\' . $ns);
 
@@ -207,11 +209,6 @@ class ReflectionClosure extends ReflectionFunction
                                 $state = 'closure';
                             }
                             break;
-                        case '=':
-                            $code .= $token;
-                            $lastState = 'closure_args';
-                            $state = 'ignore_next';
-                            break;
                         case ':':
                             $code .= ':';
                             $state = 'return';
@@ -331,13 +328,13 @@ class ReflectionClosure extends ReflectionFunction
                             $code .= $_namespace;
                             break;
                         case T_CLASS_C:
-                            $code .= $_class;
+                            $code .= $inside_anonymous ? $token[1] : $_class;
                             break;
                         case T_FUNC_C:
-                            $code .= $_function;
+                            $code .= $inside_anonymous ? $token[1] : $_function;
                             break;
                         case T_METHOD_C:
-                            $code .= $_method;
+                            $code .= $inside_anonymous ? $token[1] : $_method;
                             break;
                         case T_COMMENT:
                             if (substr($token[1], 0, 8) === '#trackme') {
@@ -359,7 +356,9 @@ class ReflectionClosure extends ReflectionFunction
                             $code .= $token[1];
                             break;
                         case T_STATIC:
-                            $isUsingScope = true;
+                            if (!$inside_anonymous) {
+                                $isUsingScope = true;
+                            }
                             $code .= $token[1];
                             break;
                         case T_NS_SEPARATOR:
@@ -384,6 +383,7 @@ class ReflectionClosure extends ReflectionFunction
                             $lastState = 'closure';
                             break;
                         case T_INSTANCEOF:
+                        case T_INSTEADOF:
                             $code .= $token[1];
                             $context = 'instanceof';
                             $state = 'id_start';
@@ -501,7 +501,7 @@ class ReflectionClosure extends ReflectionFunction
                                 $open++;
                             }
                             if($context === 'new' || false !== strpos($id_name, '\\')){
-                                if($id_start !== '\\'){
+                                if($id_start !== '\\' && !in_array($id_start_ci, $class_keywords)){
                                     if ($classes === null) {
                                         $classes = $this->getClasses();
                                     }
@@ -529,7 +529,9 @@ class ReflectionClosure extends ReflectionFunction
                         case T_DOUBLE_COLON:
                             if($id_start !== '\\') {
                                 if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){
-                                    $isUsingScope = true;
+                                    if (!$inside_anonymous) {
+                                        $isUsingScope = true;
+                                    }
                                 } elseif (!($php7 && in_array($id_start_ci, $php7_types))){
                                     if ($classes === null) {
                                         $classes = $this->getClasses();
@@ -546,15 +548,23 @@ class ReflectionClosure extends ReflectionFunction
                             $state = $token[0] === T_DOUBLE_COLON ? 'ignore_next' : $lastState;
                             break;
                         default:
-                            if($id_start !== '\\'){
-                                if($context === 'use' ||
+                            if($id_start !== '\\' && !defined($id_start)){
+                                if($constants === null){
+                                    $constants = $this->getConstants();
+                                }
+                                if(isset($constants[$id_start])){
+                                    $id_start = $constants[$id_start];
+                                } elseif($context === 'use' ||
                                     $context === 'instanceof' ||
                                     $context === 'args' ||
                                     $context === 'return_type' ||
-                                    $context === 'extends'
+                                    $context === 'extends' ||
+                                    $context === 'root'
                                 ){
                                     if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){
-                                        $isUsingScope = true;
+                                        if (!$inside_anonymous) {
+                                            $isUsingScope = true;
+                                        }
                                     } elseif (!($php7 && in_array($id_start_ci, $php7_types))){
                                         if($classes === null){
                                             $classes = $this->getClasses();
@@ -566,13 +576,6 @@ class ReflectionClosure extends ReflectionFunction
                                             $id_start = $nsf . '\\' . $id_start;
                                         }
                                     }
-                                } else {
-                                    if($constants === null){
-                                        $constants = $this->getConstants();
-                                    }
-                                    if(isset($constants[$id_start])){
-                                        $id_start = $constants[$id_start];
-                                    }
                                 }
                             }
                             $code .= $id_start . $id_name;

+ 2 - 4
vendor/opis/closure/src/SerializableClosure.php

@@ -132,7 +132,7 @@ class SerializableClosure implements Serializable
             if($scope = $reflector->getClosureScopeClass()){
                 $scope = $scope->name;
             }
-        } elseif($reflector->isScopeRequired()) {
+        } else {
             if($scope = $reflector->getClosureScopeClass()){
                 $scope = $scope->name;
             }
@@ -260,9 +260,7 @@ class SerializableClosure implements Serializable
             $this->code['this'] = null;
         }
 
-        if ($this->code['scope'] !== null || $this->code['this'] !== null) {
-            $this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']);
-        }
+        $this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']);
 
         if(!empty($this->code['objects'])){
             foreach ($this->code['objects'] as $item){

+ 1 - 1
vendor/services.php

@@ -1,5 +1,5 @@
 <?php 
-// This file is automatically generated at:2020-05-22 11:46:04
+// This file is automatically generated at:2020-05-27 13:52:14
 declare (strict_types = 1);
 return array (
   0 => 'think\\app\\Service',