Merge branch 'master' into db

This commit is contained in:
李铭昕 2019-07-29 16:23:47 +08:00 committed by GitHub
commit e393dfc5c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -8,6 +8,7 @@
# Fixed
- [#271](https://github.com/hyperf-cloud/hyperf/pull/271) Fixed aop only rewrite the first method in classes and method patten is not work.
- [#285](https://github.com/hyperf-cloud/hyperf/pull/285) Fixed anonymous class should not rewrite in proxy class.
- [#286](https://github.com/hyperf-cloud/hyperf/pull/286) Fixed not auto rollback when forgotten to commit or rollback in multi transactions.
# v1.0.7 - 2019-07-26

View File

@ -92,7 +92,7 @@ class ProxyCallVistor extends NodeVisitorAbstract
$usedNamespace[] = $classUse->name->toCodeString();
}
break;
case $class instanceof Class_:
case $class instanceof Class_ && ! $class->isAnonymous():
$this->class = $class->name;
if ($class->extends) {
$this->extends = $class->extends;
@ -124,7 +124,7 @@ class ProxyCallVistor extends NodeVisitorAbstract
// Rewrite the method to proxy call method.
return $this->rewriteMethod($node);
break;
case $node instanceof Class_:
case $node instanceof Class_ && ! $node->isAnonymous():
// Add use proxy traits.
$stmts = $node->stmts;
array_unshift($stmts, $this->buildProxyCallTraitUseStatement());

View File

@ -34,7 +34,7 @@ class ProxyClassNameVistor extends NodeVisitorAbstract
public function leaveNode(Node $node)
{
// Rewirte the class name and extends the original class.
if ($node instanceof Node\Stmt\Class_) {
if ($node instanceof Node\Stmt\Class_ && ! $node->isAnonymous()) {
$node->extends = $node->name;
$node->name = new Node\Identifier($this->proxyClassName);
return $node;