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

ReflectionClass::getConstant(), getConstants() and getImmediateConstants() more consistent with methods and properties methods #1231

Merged
merged 2 commits into from
Sep 24, 2022

Conversation

kukulich
Copy link
Collaborator

  • Return ReflectionClassConstant instances
  • Have filter parameter

…nts() return ReflectionClassConstant instance

Methods getReflectionConstant(), getReflectionConstants() and getImmediateReflectionConstants() were removed
@kukulich kukulich added this to the 6.0.0 milestone Sep 24, 2022
@kukulich kukulich marked this pull request as ready for review September 24, 2022 05:53
*/
public function getConstant(string $name): string|int|float|bool|array|null
public function getImmediateConstants(int|null $filter = null): array
Copy link
Member

Choose a reason for hiding this comment

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

If we only stick to int $filter, we should document its bitmask type precisely

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Ocramius Can I prepare everything in next PR? I will change it for methods and properties as well.

Copy link
Member

Choose a reason for hiding this comment

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

Sure 👍

*
* @return scalar|array<scalar>|null
* @return array<string, ReflectionClassConstant> indexed by name
Copy link
Member

Choose a reason for hiding this comment

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

non-empty-string keys?

* @return array<string, ReflectionClassConstant> indexed by name
*/
public function getImmediateReflectionConstants(): array
public function getConstant(string $name): ReflectionClassConstant|null
Copy link
Member

Choose a reason for hiding this comment

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

We should only accept non-empty-string as name

@Ocramius Ocramius self-assigned this Sep 24, 2022
@Ocramius Ocramius merged commit baa2e71 into Roave:6.0.x Sep 24, 2022
@kukulich kukulich deleted the constants branch September 30, 2022 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants