phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.76k stars 1.98k forks source link

[NFR]: Annotations Reflection getReflectionConstant() or from getAttributes() #15919

Closed okool closed 2 years ago

okool commented 2 years ago

** support getReflectionConstant

now get \ReflectionClass e.g

        $ref=new \ReflectionClass(static::class);
        $constRef=$ref->getReflectionConstant("xxx");
        $docBlock = $constRef->getDocComment();
        $refDatas = Reader::parseDocBlock($docBlock);
        $annotations= new \Phalcon\Annotations\Collection($refDatas);

to:

$annotations=(new Memory())->getConstant(static::class,'xxx')->getConstantsAnnotations();
niden commented 2 years ago

Resolved in https://github.com/phalcon/cphalcon/pull/15970