composer update

This commit is contained in:
2019-12-01 06:37:45 +00:00
parent fa199eef05
commit 3115ab75a5
3650 changed files with 72361 additions and 147137 deletions
+78 -3
View File
@@ -19,6 +19,7 @@ class ReflectionClosure extends ReflectionFunction
protected $isStaticClosure;
protected $isScopeRequired;
protected $isBindingRequired;
protected $isShortClosure;
protected static $files = array();
protected static $classes = array();
@@ -51,6 +52,19 @@ class ReflectionClosure extends ReflectionFunction
return $this->isStaticClosure;
}
public function isShortClosure()
{
if ($this->isShortClosure === null) {
$code = $this->getCode();
if ($this->isStatic()) {
$code = substr($code, 6);
}
$this->isShortClosure = strtolower(substr(trim($code), 0, 2)) === 'fn';
}
return $this->isShortClosure;
}
/**
* @return string
*/
@@ -70,6 +84,7 @@ class ReflectionClosure extends ReflectionFunction
}
$className = null;
$fn = false;
if (null !== $className = $this->getClosureScopeClass()) {
@@ -89,6 +104,7 @@ class ReflectionClosure extends ReflectionFunction
default:
$php7_types = array('string', 'int', 'bool', 'float', 'void', 'object');
}
$fn = PHP_MINOR_VERSION === 4;
}
$ns = $this->getNamespaceName();
@@ -107,6 +123,7 @@ class ReflectionClosure extends ReflectionFunction
$tokens = $this->getTokens();
$state = $lastState = 'start';
$inside_anonymous = false;
$isShortClosure = false;
$anonymous_mark = 0;
$open = 0;
$code = '';
@@ -124,6 +141,10 @@ class ReflectionClosure extends ReflectionFunction
if ($token[0] === T_FUNCTION || $token[0] === T_STATIC) {
$code .= $token[1];
$state = $token[0] === T_FUNCTION ? 'function' : 'static';
} elseif ($fn && $token[0] === T_FN) {
$isShortClosure = true;
$code .= $token[1];
$state = 'closure_args';
}
break;
case 'static':
@@ -132,6 +153,10 @@ class ReflectionClosure extends ReflectionFunction
if ($token[0] === T_FUNCTION) {
$state = 'function';
}
} elseif ($fn && $token[0] === T_FN) {
$isShortClosure = true;
$code .= $token[1];
$state = 'closure_args';
} else {
$code = '';
$state = 'start';
@@ -155,6 +180,10 @@ class ReflectionClosure extends ReflectionFunction
if($token[0] === T_FUNCTION || $token[0] === T_STATIC){
$code = $token[1];
$state = $token[0] === T_FUNCTION ? 'function' : 'static';
} elseif ($fn && $token[0] === T_FN) {
$isShortClosure = true;
$code .= $token[1];
$state = 'closure_args';
}
break;
case 'closure_args':
@@ -172,6 +201,12 @@ class ReflectionClosure extends ReflectionFunction
$code .= $token[1];
$state = 'use';
break;
case T_DOUBLE_ARROW:
$code .= $token[1];
if ($isShortClosure) {
$state = 'closure';
}
break;
case '=':
$code .= $token;
$lastState = 'closure_args';
@@ -226,6 +261,12 @@ class ReflectionClosure extends ReflectionFunction
$state = 'id_name';
$lastState = 'return';
break 2;
case T_DOUBLE_ARROW:
$code .= $token[1];
if ($isShortClosure) {
$state = 'closure';
}
break;
case '{':
$code .= '{';
$state = 'closure';
@@ -247,12 +288,36 @@ class ReflectionClosure extends ReflectionFunction
break;
case '}':
$code .= '}';
if(--$open === 0){
if(--$open === 0 && !$isShortClosure){
break 3;
} elseif ($inside_anonymous) {
$inside_anonymous = !($open === $anonymous_mark);
}
break;
case '(':
case '[':
$code .= $token[0];
if ($isShortClosure) {
$open++;
}
break;
case ')':
case ']':
if ($isShortClosure) {
if ($open === 0) {
break 3;
}
--$open;
}
$code .= $token[0];
break;
case ',':
case ';':
if ($isShortClosure && $open === 0) {
break 3;
}
$code .= $token[0];
break;
case T_LINE:
$code .= $token[2] - $line + $lineAdd;
break;
@@ -432,6 +497,9 @@ class ReflectionClosure extends ReflectionFunction
$id_name .= $token[1];
break;
case '(':
if ($isShortClosure) {
$open++;
}
if($context === 'new' || false !== strpos($id_name, '\\')){
if($id_start !== '\\'){
if ($classes === null) {
@@ -538,10 +606,17 @@ class ReflectionClosure extends ReflectionFunction
}
}
if ($isShortClosure) {
$code .= ';';
$this->useVariables = $this->getStaticVariables();
} else {
$this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use));
}
$this->isShortClosure = $isShortClosure;
$this->isBindingRequired = $isUsingThisObject;
$this->isScopeRequired = $isUsingScope;
$this->code = $code;
$this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use));
return $this->code;
}
@@ -615,7 +690,7 @@ class ReflectionClosure extends ReflectionFunction
protected function getHashedFileName()
{
if ($this->hashedName === null) {
$this->hashedName = md5($this->getFileName());
$this->hashedName = sha1($this->getFileName());
}
return $this->hashedName;