php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81082 PDO::getAttribute() requires mixed return type
Submitted: 2021-05-26 05:55 UTC Modified: 2021-05-26 14:55 UTC
From: corey dot taylor dot fl at gmail dot com Assigned:
Status: Closed Package: PDO Core
PHP Version: master-Git-2021-05-26 (Git) OS:
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: corey dot taylor dot fl at gmail dot com
New email:
PHP Version: OS:

 

 [2021-05-26 05:55 UTC] corey dot taylor dot fl at gmail dot com
Description:
------------
With the addition of tentative return types for PDO, we saw this new deprecation show up in generated mock code.

Declaration of Mock_PDO_f5cc810f::getAttribute(int $attribute) should be compatible with PDO::getAttribute(int $attribute): mixed

This requires the use of the new `mixed` return type available in php 8 only.

Isn't the return type `mixed` when omitted and therefore compatible with the declared tentative return type? 

https://3v4l.org/sVfS7/rfc#git.master


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-26 07:34 UTC] nikic@php.net
An no type is considered the same as a hypothetical "mixed|void", no type is not considered covariantly compatible with mixed.

In this case it's necessary to either generate the ": mixed" type, or to generate a "#[ReturnTypeWillChange]" attribute.
 [2021-05-26 14:55 UTC] corey dot taylor dot fl at gmail dot com
-Status: Open +Status: Closed
 [2021-05-26 14:55 UTC] corey dot taylor dot fl at gmail dot com
Ah, I was not aware of the attribute. That will have to be the work around if no return is mixed|void.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC