-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
php/php-src@b302bfa recently introduced automatic implementation of Stringable for internal classes the implement a __toString() method. This results in several new errors when loading the extension with PHP 8.1.0RC6-dev due to conflicting arginfo:
Declaration of MongoDB\BSON\BinaryInterface::__toString() must be compatible with Stringable::__toString(): string in Unknown on line 0
Our arginfos for these methods have historically never reported a return type, going back to when it was originally written for PHP 5.x. For example:
ZEND_BEGIN_ARG_INFO_EX(ai_BinaryInterface_void, 0, 0, 0) ZEND_END_ARG_INFO() static zend_function_entry php_phongo_binary_interface_me[] = { ZEND_ABSTRACT_ME(BinaryInterface, __toString, ai_BinaryInterface_void) // ...
In php-src, _ZendTestClass uses ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX to declare a string return type. We should likely do the same in our classes.
- related to
-
PHPC-2007 Explicitly implement Stringable for PHP 8+
- Closed
- links to