php.net |  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
Votes:1
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: Closed Package: Reflection related
PHP Version: 8.0.0RC2 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: info at chrisdoehring dot de
New email:
PHP Version: OS:

 

 [2020-10-16 15:44 UTC] info at chrisdoehring dot de
Description:
------------
The in php 8 added "ReflectionUnionType" class should extend the ReflectionType class according to the RFC proposal (https://wiki.php.net/rfc/union_types_v2#reflection), but the inherited "isBuiltin" method (https://www.php.net/manual/de/reflectiontype.isbuiltin.php) does not exist.

Example script: https://3v4l.org/5BDRn
How it looks like without union type: https://3v4l.org/TGkX2

Test script:
---------------
<?php
class SomeClass
{
    protected string|stdClass $a;
}

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

Expected result:
----------------
bool(false)

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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-16 15:53 UTC] nikic@php.net
-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] nikic@php.net
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.
 [2020-12-27 23:23 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=352224
Log: Fix #80247: ReflectionType does not have an isBuiltin() method

Closes GH-273.
 [2020-12-27 23:24 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=c40f07c937efd99aa9ffcba126977e7536d1c2fd
Log: Fix #80247: ReflectionType does not have an isBuiltin() method
 [2020-12-27 23:24 UTC] phpdocbot@php.net
-Status: Open +Status: Closed
 [2020-12-28 00:29 UTC] mumumu@php.net
Automatic comment from SVN on behalf of mumumu
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=352227
Log: Fix #80247: ReflectionType does not have an isBuiltin() method

Closes GH-273.
 [2020-12-28 00:30 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=c7ef0c318c96ffd90bd3641b0f9d0db058a3a8d3
Log: Fix #80247: ReflectionType does not have an isBuiltin() method
 [2020-12-30 11:58 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=c0ab36c0a62c92feca11584494c30dbae107b219
Log: Fix #80247: ReflectionType does not have an isBuiltin() method
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jun 29 09:01:33 2025 UTC