mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
d478ae73b1
Traits do not support interfaces, so we should not implement Stringable on them. Also check the __toString() return type in the same way other magic methods do, otherwise we would now miss the check in the trait case.
15 lines
257 B
PHP
15 lines
257 B
PHP
--TEST--
|
|
__toString() from trait with invalid return type
|
|
--FILE--
|
|
<?php
|
|
|
|
trait T {
|
|
public function __toString(): int {
|
|
return "ok";
|
|
}
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: T::__toString(): Return type must be string when declared in %s on line %d
|