Bug #81082 [Opn]: PDO::getAttribute() requires mixed return type

From: Date: Wed, 26 May 2021 07:34:18 +0000
Subject: Bug #81082 [Opn]: PDO::getAttribute() requires mixed return type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234020@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81082&edit=1 ID: 81082 Updated by: nikic@php.net Reported by: corey dot taylor dot fl at gmail dot com Summary: PDO::getAttribute() requires mixed return type Status: Open Type: Bug Package: PDO Core PHP Version: master-Git-2021-05-26 (Git) Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#234020) next »