Bug #81082 [Opn->Csd]: PDO::getAttribute() requires mixed return type
Edit report at https://bugs.php.net/bug.php?id=81082&edit=1
ID: 81082
User updated by: corey dot taylor dot fl at gmail dot com
Reported by: corey dot taylor dot fl at gmail dot com
Summary: PDO::getAttribute() requires mixed return type
-Status: Open
+Status: Closed
Type: Bug
Package: PDO Core
PHP Version: master-Git-2021-05-26 (Git)
Block user comment: N
Private report: N
New Comment:
Ah, I was not aware of the attribute. That will have to be the work around if no return is
mixed|void.
Previous Comments:
------------------------------------------------------------------------
[2021-05-26 07:34:18] 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 05:55:28] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81082&edit=1
Thread (3 messages)