Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug that the enum mode cannot work when using hyperf/constants. #6728

Merged
merged 3 commits into from
May 9, 2024

Conversation

HuangXi0820
Copy link
Contributor

枚举类注解热启动无效, 枚举类发生变更, meta返回为null 导致只是重启未处理文件

src/watcher/src/Process.php +52

$meta = $this->getMetadata($this->file);
       if ($meta === null) {
           return;
       }

src/watcher/src/Process.php 中$meta->isClass 方法中 className 为null

protected function getMetadata(string $file): ?Metadata
    {
        $stmts = $this->ast->parse($this->filesystem->get($file));
        $meta = new Metadata();
        $meta->path = $file;
        $traverser = new NodeTraverser();
        $traverser->addVisitor(new RewriteClassNameVisitor($meta));
        $traverser->traverse($stmts);
        if (! $meta->isClass()) {
            return null;
        }
        return $meta;
    }

src/watcher/src/Ast/RewriteClassNameVisitor.php 增加className赋值..

@HuangXi0820
Copy link
Contributor Author

hi, 在热更新后枚举类中注解新增或修改无效, 看了下了流程 是处理枚举类的时候 处理文件classname跳过导致未生效.
我也是第一次提交, 尝试处理下. 可能不只是这个地方后续没有整体跟,可能会存在问题,这个怎么让人跟进

@limingxinleo
Copy link
Member

周四周五处理

@limingxinleo
Copy link
Member

我们通常周四晚到周五上午左右发版本,发版本前会处理的

@HuangXi0820
Copy link
Contributor Author

我们通常周四晚到周五上午左右发版本,发版本前会处理的

好的, 第一次提不好意思, 我跟了下是因为枚举类 只是简单的加个|| 的关系, 感觉这样不太好 只是能用, 具体流程会不会影响其他的, 可能需要你们进行处理.麻烦您.辛苦了.

@limingxinleo limingxinleo changed the title Fix the issue of invalid hot re annotations in enum Fixed bug that the enum mode cannot work when using hyperf/constants. May 9, 2024
@limingxinleo limingxinleo merged commit ff8b5a0 into hyperf:master May 9, 2024
61 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants