# ReflectionType improvements

- Thread: https://externals.io/message/93872
- Original archive: https://news-web.php.net/php.internals/93872
- Started by Levi Morrison on 2016-06-10T14:50:09+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #93872 — Levi Morrison — 2016-06-10T14:50:09+00:00

URL: https://externals.io/message/93872#93872

Now that the mailing list is working again I'd like to propose some
improvements to the ReflectionType API. We added ReflectionType as
part of the Return Types RFC. At that time the API was intentionally
kept minimal to not step on the toes of potential future features
(such as enum, union and intersection types) with the intention of
fleshing it out later. As long as the release managers for 7.1 are
okay with it I'd like to do these improvements now. Shall I move
forward with an RFC or do you consider this too late?

The proposed API looks like this:
https://gist.github.com/morrisonlevi/5819a2b8d86561849ee916a7bcbc9c29.
Notably a `ReflectionClassType` will be returned if possible which has
a `getClass(): ReflectionClass` method. This has been a commonly
requested addition and simplifies a common use-case.

I tried to discuss these changes on Reddit to gauge community impact
but it had few responses:
https://www.reddit.com/r/PHP/comments/4m93s1/i_want_to_enhance_and_break_the_reflectiontype/.

---

## #93876 — Joe Watkins — 2016-06-10T15:04:43+00:00

URL: https://externals.io/message/93872#93876 · In reply to: #93872

Afternoon Levi,

    Since communication broke down over the last few days, I'm happy for
you to move forward with the discussion period.

    Voting will have to be abbreviated to make everything fit.

Cheers
Joe



> Now that the mailing list is working again I'd like to propose some
> improvements to the ReflectionType API. We added ReflectionType as
> part of the Return Types RFC. At that time the API was intentionally
> kept minimal to not step on the toes of potential future features
> (such as enum, union and intersection types) with the intention of
> fleshing it out later. As long as the release managers for 7.1 are
> okay with it I'd like to do these improvements now. Shall I move
> forward with an RFC or do you consider this too late?
>
> The proposed API looks like this:
> https://gist.github.com/morrisonlevi/5819a2b8d86561849ee916a7bcbc9c29.
> Notably a `ReflectionClassType` will be returned if possible which has
> a `getClass(): ReflectionClass` method. This has been a commonly
> requested addition and simplifies a common use-case.
>
> I tried to discuss these changes on Reddit to gauge community impact
> but it had few responses:
>
> https://www.reddit.com/r/PHP/comments/4m93s1/i_want_to_enhance_and_break_the_reflectiontype/
> .
