Skip to content

Make ReflectionUnionType final #6384

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 1 commit into from
Closed

Conversation

kocsismate
Copy link
Member

@kocsismate kocsismate commented Oct 25, 2020

In spite of the fact that ReflectionNamedType is a non-final class, we can still decide about ReflectionUnionType.

Furthermore, we could also add ZEND_ACC_NO_DYNAMIC_PROPERTIES to ReflectionAttribute, if it's really desirable.

@php-pulls php-pulls closed this in ef6adb4 Oct 25, 2020
@kocsismate kocsismate deleted the final-union branch October 25, 2020 19:17
@ondrejmirtes
Copy link
Contributor

No, please don't :( This makes creating an adapter class impossible. The use-case: https://github.com/ondrejmirtes/BetterReflection/blob/master/src/Reflection/Adapter/ReflectionUnionType.php (providing your own reflection implementation and making it compatible with the built-in PHP one).

@nikic
Copy link
Member

nikic commented Oct 26, 2020

Okay, let's revert this, it's not important given how most of reflection is non-final. I'm very disappointed in @Ocramius though, he really should know better than using inheritance ;)

@kocsismate
Copy link
Member Author

@nikic I can revert it during the course of the day!

@kocsismate
Copy link
Member Author

Oh, I see that it's too late :) Thanks for the revert!

@ondrejmirtes
Copy link
Contributor

I need to stop reading emails when I wake up in the middle of the night - had a little crisis there :)

These adapters are really useful for PHPStan - it means that I can use the runtime and the static reflection interchangeably. Classes that are safe to autoload use runtime reflection, and everything else uses static reflection.

Thank you both!

@Ocramius
Copy link
Contributor

BTW, if you want to make it final you certainly can, as long as there is an extraction to an interface :D

@ondrejmirtes
Copy link
Contributor

@nikic @kocsismate I just found out that ReflectionAttribute is final :( I'd need it not final for the same reason I need ReflectionUnionType non-final. https://3v4l.org/lfRSE

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.

4 participants