Skip to content

Added ReflectionMethod::hasPrototype method #8487

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

Closed
wants to merge 5 commits into from
Closed

Added ReflectionMethod::hasPrototype method #8487

wants to merge 5 commits into from

Conversation

ollieread
Copy link
Contributor

@ollieread ollieread commented May 3, 2022

This PR adds the ReflectionMethod::hasPrototype method, to allow users to check whether a method has a prototype, falling more in line with the way the other reflection methods are handled (getMethod/hasMethod, etc).

Completes #8486

@kocsismate
Copy link
Member

One last thing is needed before merging: an entry in the UPGRADING file

@cmb69
Copy link
Member

cmb69 commented May 3, 2022

One last thing is needed before merging: an entry in the UPGRADING file

Yeah, but that should be done by the person who actually merges (to avoid merge conflicts). Also, should have an entry in NEWS additionally.

I'd wait a while, though, just in case anybody objects to adding this method.

@kocsismate
Copy link
Member

Yeah, but that should be done by the person who actually merges (to avoid merge conflicts)

Yeah, I'm aware this, but I thought that we can quickly merge the PR. But you are right, it's better to wait a couple of days just to make sure.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

I don't really understand what prototype is meant to mean here. Does it mean the parent has an implementation of the method? In this case a test which showcases a child method not having a prototype should be added

@ollieread
Copy link
Contributor Author

ollieread commented May 3, 2022

I don't really understand what prototype is meant to mean here. Does it mean the parent has an implementation of the method? In this case a test which showcases a child method not having a prototype should be added

A method has a prototype when it overrides a method in it's parent. It really wasn't clear, and is actually something I plan to add in a PR to the docs.

The tests currently test a prototypeless method, but, are you suggesting it should cover a prototypeless method that in a child class too?

@Girgias
Copy link
Member

Girgias commented May 3, 2022

I don't really understand what prototype is meant to mean here. Does it mean the parent has an implementation of the method? In this case a test which showcases a child method not having a prototype should be added

A method has a prototype when it overrides a method in it's parent. It really wasn't clear, and is actually something I plan to add in a PR to the docs.

I just saw looking at the linked issue, that this already kinda exists, I just think the naming is terrible but well better use the already existing name.

The tests currently test a prototypeless method, but, are you suggesting it should cover a prototypeless method that in a child class too?

Yes, something like:

class A {
}

class B extends A {
   public function foo()
}

And check what hasPrototype returns for B::foo()

@ollieread
Copy link
Contributor Author

I don't really understand what prototype is meant to mean here. Does it mean the parent has an implementation of the method? In this case a test which showcases a child method not having a prototype should be added

A method has a prototype when it overrides a method in it's parent. It really wasn't clear, and is actually something I plan to add in a PR to the docs.

I just saw looking at the linked issue, that this already kinda exists, I just think the naming is terrible but well better use the already existing name.

The tests currently test a prototypeless method, but, are you suggesting it should cover a prototypeless method that in a child class too?

Yes, something like:

class A {
}

class B extends A {
   public function foo()
}

And check what hasPrototype returns for B::foo()

I have added the test now @Girgias

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

The naming is terrible but it makes sense to stay consistent. The code LGTM.

@cmb69 cmb69 closed this in f590782 May 9, 2022
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.

5 participants