|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77566 void type is not covariant to mixed
Submitted: 2019-02-04 14:27 UTC Modified: -
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Wes dot nospam at example dot org Assigned:
Status: Open Package: *General Issues
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
26 - 13 = ?
Subscribe to this entry?

 [2019-02-04 14:27 UTC] Wes dot nospam at example dot org
Going from "has a return value" to "no return value" is certainly not a valid covariant substitution (at least in theory, in practice void is null).

The void RFC doesn't cover the case at all.

It is not unlikely that this is currently allowed by accident.

Thank you.

Test script:

class Foo
    public function aaa(){}

class Bar extends Foo
    public function aaa(): void{}

Expected result:

Actual result:
No error


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 12:03:36 2021 UTC