|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80247 ReflectionType does not have an isBuiltin() method
Submitted: 2020-10-16 15:44 UTC Modified: 2020-10-16 15:53 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: info at chrisdoehring dot de Assigned:
Status: Open Package: Reflection related
PHP Version: 8.0.0RC2 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-10-16 15:44 UTC] info at chrisdoehring dot de
The in php 8 added "ReflectionUnionType" class should extend the ReflectionType class according to the RFC proposal (, but the inherited "isBuiltin" method ( does not exist.

Example script:
How it looks like without union type:

Test script:
class SomeClass
    protected string|stdClass $a;

$unionType = (new \ReflectionClass(SomeClass::class))->getProperty('a')->getType();

Expected result:

Actual result:
Fatal error: Uncaught Error: Call to undefined method ReflectionUnionType::isBuiltin() in /in/5BDRn:8
Stack trace:
#0 {main}
  thrown in /in/5BDRn on line 8

Process exited with code 255.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-16 15:53 UTC]
-Summary: ReflectionUnionType class does not contain isBuiltin method +Summary: ReflectionType does not have an isBuiltin() method -Type: Bug +Type: Documentation Problem
 [2020-10-16 15:53 UTC]
In PHP 8, ReflectionType does not have an isBuiltin() method.

I recommend documenting this by removing ReflectionType::isBuiltin() from the docs completely (leaving only ReflectionNamedType::isBuiltin()). The fact that this method used to exist on earlier PHP versions is not useful, as ReflectionNamedType was the only ReflectionType there anyway.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 19:01:24 2020 UTC