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

5.0.x #15970

Merged
merged 6 commits into from
May 30, 2022
Merged

5.0.x #15970

merged 6 commits into from
May 30, 2022

Conversation

ustmaestro
Copy link
Contributor

@ustmaestro ustmaestro commented May 24, 2022

Hello!

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I have updated the relevant CHANGELOG
  • I have created a PR for the documentation about this change

Small description of change:

Added support to class constants annotations

    class MyClass
    {
          /**
           * @Simple
           */
          const MY_CONST = "test";
    }
    
    
    use \Phalcon\Annotations\Adapter\Memory;
    use \Phalcon\Annotations\Reader;
    use \Phalcon\Annotations\Reflection;  
    
    // Reader now returns constants array list that have annotations in docblock comments
    $reader = new Reader();
    $data = $reader->parse(MyClass::class);
    var_dump($data);

    // Reflection has a new method for getting constants annotations
    $reflection = new Reflection($data);
    var_dump($reflection->getConstantsAnnotations());


    // Annotation adapters has 2 new methods for getting constants annotations
    $memory = new Memory();
    var_dump($memory->getConstants(MyClass::class));                  // returns array
    var_dump($memory->getConstant(MyClass::class, 'TEST2'));     // returns Collection

Thanks

Copy link
Member

@niden niden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the interface as well with the two new methods. Also we need the CHANGELOG to be updated.

Great work!!

phalcon/Annotations/Reader.zep Outdated Show resolved Hide resolved
@niden niden added enhancement Enhancement to the framework 5.0 The issues we want to solve in the 5.0 release labels May 24, 2022
@niden
Copy link
Member

niden commented May 25, 2022

@ustmaestro Just update the changelog and this is ready!!

@niden niden added the documentation Documentation required label May 25, 2022
phalcon/Annotations/Reader.zep Outdated Show resolved Hide resolved
@niden niden merged commit c3fef64 into phalcon:5.0.x May 30, 2022
@niden
Copy link
Member

niden commented May 30, 2022

Thank you @ustmaestro !

@okool
Copy link

okool commented Jun 1, 2022

Thank @ustmaestro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release documentation Documentation required enhancement Enhancement to the framework
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants