ComposerUpdate

This commit is contained in:
Anyon 2020-06-07 23:10:23 +08:00
parent 6a34f6b72d
commit c6534a3866
8 changed files with 109 additions and 57 deletions

18
composer.lock generated
View File

@ -223,16 +223,16 @@
},
{
"name": "opis/closure",
"version": "3.5.3",
"version": "3.5.4",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca"
"reference": "1d0deef692f66dae5d70663caee2867d0971306b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"url": "https://api.github.com/repos/opis/closure/zipball/1d0deef692f66dae5d70663caee2867d0971306b",
"reference": "1d0deef692f66dae5d70663caee2867d0971306b",
"shasum": "",
"mirrors": [
{
@ -286,7 +286,7 @@
"serialization",
"serialize"
],
"time": "2020-05-25T09:32:45+00:00"
"time": "2020-06-07T11:41:29+00:00"
},
{
"name": "psr/cache",
@ -929,12 +929,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "c05ab96c1387fcd7e46757ea8b9fa96b354d18e5"
"reference": "334cd213e194ffaaa882bbcd5fa5d5e58ac51bab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/c05ab96c1387fcd7e46757ea8b9fa96b354d18e5",
"reference": "c05ab96c1387fcd7e46757ea8b9fa96b354d18e5",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/334cd213e194ffaaa882bbcd5fa5d5e58ac51bab",
"reference": "334cd213e194ffaaa882bbcd5fa5d5e58ac51bab",
"shasum": "",
"mirrors": [
{
@ -978,7 +978,7 @@
],
"description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top",
"time": "2020-06-05T10:04:22+00:00"
"time": "2020-06-07T15:00:59+00:00"
},
{
"name": "zoujingli/wechat-developer",

View File

@ -222,17 +222,17 @@
},
{
"name": "opis/closure",
"version": "3.5.3",
"version_normalized": "3.5.3.0",
"version": "3.5.4",
"version_normalized": "3.5.4.0",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca"
"reference": "1d0deef692f66dae5d70663caee2867d0971306b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca",
"url": "https://api.github.com/repos/opis/closure/zipball/1d0deef692f66dae5d70663caee2867d0971306b",
"reference": "1d0deef692f66dae5d70663caee2867d0971306b",
"shasum": "",
"mirrors": [
{
@ -248,7 +248,7 @@
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"time": "2020-05-25T09:32:45+00:00",
"time": "2020-06-07T11:41:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -955,12 +955,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "c05ab96c1387fcd7e46757ea8b9fa96b354d18e5"
"reference": "334cd213e194ffaaa882bbcd5fa5d5e58ac51bab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/c05ab96c1387fcd7e46757ea8b9fa96b354d18e5",
"reference": "c05ab96c1387fcd7e46757ea8b9fa96b354d18e5",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/334cd213e194ffaaa882bbcd5fa5d5e58ac51bab",
"reference": "334cd213e194ffaaa882bbcd5fa5d5e58ac51bab",
"shasum": "",
"mirrors": [
{
@ -976,7 +976,7 @@
"ext-json": "*",
"topthink/framework": "^6.0"
},
"time": "2020-06-05T10:04:22+00:00",
"time": "2020-06-07T15:00:59+00:00",
"type": "library",
"extra": {
"think": {

View File

@ -0,0 +1,43 @@
name: "Tests"
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4]
stability: [prefer-stable]
name: PHP ${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Update composer
run: composer self-update
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit --verbose

View File

@ -1,10 +1,16 @@
CHANGELOG
---------
### v3.5.4, 2020.06.07
- Fixed a false-positive when using `Opis\Closure\ReflectionClosure::isScopeRequired` method
- Fixed a bug related to `T_STRING_VARNAME`
### 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.
When the class scope was `null`, the optimisation failed to work as expected and kept the wrong `SerializableClosure` scope.
### v3.5.2, 2020.05.21

View File

@ -1,6 +1,6 @@
Opis Closure
====================
[![Build Status](https://travis-ci.org/opis/closure.png)](https://travis-ci.org/opis/closure)
[![Tests](https://github.com/opis/closure/workflows/Tests/badge.svg)](https://github.com/opis/closure/actions)
[![Latest Stable Version](https://poser.pugx.org/opis/closure/v/stable.png)](https://packagist.org/packages/opis/closure)
[![Latest Unstable Version](https://poser.pugx.org/opis/closure/v/unstable.png)](https://packagist.org/packages/opis/closure)
[![License](https://poser.pugx.org/opis/closure/license.png)](https://packagist.org/packages/opis/closure)
@ -35,15 +35,15 @@ proper serialization
- Automatically detects when the scope and/or the bound object of a closure needs to be serialized
in order for the closure to work after deserialization
### Documentation
## Documentation
The full documentation for this library can be found [here][documentation].
### License
## License
**Opis Closure** is licensed under the [MIT License (MIT)][license].
### Requirements
## Requirements
* PHP ^5.4 || ^7.0
@ -78,21 +78,15 @@ of **Opis Closure**. Otherwise, assuming you are not using one of the removed/re
### Arbitrary object serialization
This feature was primarily introduced in order to support serializing an object bound
to a closure and available via `$this`. The implementation is far from being perfect
and it's really hard to make it work flawless. I will try to improve this, but I can
not guarantee anything. So my advice regarding the `Opis\Closure\serialize|unserialize`
functions is to use them with caution.
We've added this feature in order to be able to support the serialization of a closure's bound object.
The implementation is far from being perfect, and it's really hard to make it work flawless.
We will try to improve this, but we can't guarantee anything.
So our advice regarding the `Opis\Closure\serialize|unserialize` functions is to use them with caution.
### SuperClosure support
**Opis Closure** is shipped with an analyzer(`Opis\Closure\Analyzer`) which
aims to provide *Opis Closure*'s parsing precision and speed to [SuperClosure].
[documentation]: https://www.opis.io/closure "Opis Closure"
[license]: http://opensource.org/licenses/MIT "MIT License"
[Packagist]: https://packagist.org/packages/opis/closure "Packagist"
[Composer]: https://getcomposer.org "Composer"
[SuperClosure]: https://github.com/jeremeamia/super_closure "SuperClosure"
[SemVer]: http://semver.org/ "Semantic versioning"
[CHANGELOG]: https://github.com/opis/closure/blob/master/CHANGELOG.md "Changelog"

View File

@ -10,6 +10,9 @@ namespace Opis\Closure;
use Closure;
use SuperClosure\Analyzer\ClosureAnalyzer;
/**
* @deprecated We'll remove this class
*/
class Analyzer extends ClosureAnalyzer
{
/**

View File

@ -124,9 +124,9 @@ class ReflectionClosure extends ReflectionFunction
$tokens = $this->getTokens();
$state = $lastState = 'start';
$inside_anonymous = false;
$inside_structure = false;
$isShortClosure = false;
$anonymous_mark = 0;
$inside_structure_mark = 0;
$open = 0;
$code = '';
$id_start = $id_start_ci = $id_name = $context = '';
@ -278,7 +278,6 @@ class ReflectionClosure extends ReflectionFunction
switch ($token[0]){
case T_CURLY_OPEN:
case T_DOLLAR_OPEN_CURLY_BRACES:
case T_STRING_VARNAME:
case '{':
$code .= '{';
$open++;
@ -287,8 +286,8 @@ class ReflectionClosure extends ReflectionFunction
$code .= '}';
if(--$open === 0 && !$isShortClosure){
break 3;
} elseif ($inside_anonymous) {
$inside_anonymous = !($open === $anonymous_mark);
} elseif ($inside_structure) {
$inside_structure = !($open === $inside_structure_mark);
}
break;
case '(':
@ -328,13 +327,13 @@ class ReflectionClosure extends ReflectionFunction
$code .= $_namespace;
break;
case T_CLASS_C:
$code .= $inside_anonymous ? $token[1] : $_class;
$code .= $inside_structure ? $token[1] : $_class;
break;
case T_FUNC_C:
$code .= $inside_anonymous ? $token[1] : $_function;
$code .= $inside_structure ? $token[1] : $_function;
break;
case T_METHOD_C:
$code .= $inside_anonymous ? $token[1] : $_method;
$code .= $inside_structure ? $token[1] : $_method;
break;
case T_COMMENT:
if (substr($token[1], 0, 8) === '#trackme') {
@ -350,17 +349,12 @@ class ReflectionClosure extends ReflectionFunction
}
break;
case T_VARIABLE:
if($token[1] == '$this' && !$inside_anonymous){
if($token[1] == '$this' && !$inside_structure){
$isUsingThisObject = true;
}
$code .= $token[1];
break;
case T_STATIC:
if (!$inside_anonymous) {
$isUsingScope = true;
}
$code .= $token[1];
break;
case T_NS_SEPARATOR:
case T_STRING:
$id_start = $token[1];
@ -398,6 +392,10 @@ class ReflectionClosure extends ReflectionFunction
case T_FUNCTION:
$code .= $token[1];
$state = 'closure_args';
if (!$inside_structure) {
$inside_structure = true;
$inside_structure_mark = $open;
}
break;
case T_TRAIT_C:
if ($_trait === null) {
@ -501,7 +499,11 @@ class ReflectionClosure extends ReflectionFunction
$open++;
}
if($context === 'new' || false !== strpos($id_name, '\\')){
if($id_start !== '\\' && !in_array($id_start_ci, $class_keywords)){
if($id_start_ci === 'self' || $id_start_ci === 'static') {
if (!$inside_structure) {
$isUsingScope = true;
}
} elseif ($id_start !== '\\' && !in_array($id_start_ci, $class_keywords)) {
if ($classes === null) {
$classes = $this->getClasses();
}
@ -528,10 +530,14 @@ class ReflectionClosure extends ReflectionFunction
case T_VARIABLE:
case T_DOUBLE_COLON:
if($id_start !== '\\') {
if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){
if (!$inside_anonymous) {
if($id_start_ci === 'self' || $id_start_ci === 'parent'){
if (!$inside_structure) {
$isUsingScope = true;
}
} elseif ($id_start_ci === 'static') {
if (!$inside_structure) {
$isUsingScope = $token[0] === T_DOUBLE_COLON;
}
} elseif (!($php7 && in_array($id_start_ci, $php7_types))){
if ($classes === null) {
$classes = $this->getClasses();
@ -544,6 +550,7 @@ class ReflectionClosure extends ReflectionFunction
}
}
}
$code .= $id_start . $id_name . $token[1];
$state = $token[0] === T_DOUBLE_COLON ? 'ignore_next' : $lastState;
break;
@ -562,7 +569,7 @@ class ReflectionClosure extends ReflectionFunction
$context === 'root'
){
if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){
if (!$inside_anonymous) {
if (!$inside_structure) {
$isUsingScope = true;
}
} elseif (!($php7 && in_array($id_start_ci, $php7_types))){
@ -596,9 +603,9 @@ class ReflectionClosure extends ReflectionFunction
break;
case '{':
$state = 'closure';
if (!$inside_anonymous) {
$inside_anonymous = true;
$anonymous_mark = $open;
if (!$inside_structure) {
$inside_structure = true;
$inside_structure_mark = $open;
}
$i--;
break;
@ -982,7 +989,6 @@ class ReflectionClosure extends ReflectionFunction
case '{':
case T_CURLY_OPEN:
case T_DOLLAR_OPEN_CURLY_BRACES:
case T_STRING_VARNAME:
$open++;
break;
case '}':

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2020-06-07 17:28:28
// This file is automatically generated at:2020-06-07 23:10:04
declare (strict_types = 1);
return array (
0 => 'think\\app\\Service',