diff --git a/core/lib/Drupal/Component/Render/MarkupInterface.php b/core/lib/Drupal/Component/Render/MarkupInterface.php index 41c4f3adb1..8c4f50b60d 100644 --- a/core/lib/Drupal/Component/Render/MarkupInterface.php +++ b/core/lib/Drupal/Component/Render/MarkupInterface.php @@ -39,14 +39,4 @@ interface MarkupInterface extends \JsonSerializable, \Countable { */ public function __toString(); - /** - * Returns the length of the string emitted by __toString(). - * - * Twig uses the \Countable interface to determine if an object is empty. - * - * @return int - * The length of the string. - */ - public function count(); - } diff --git a/core/lib/Drupal/Core/Template/Attribute.php b/core/lib/Drupal/Core/Template/Attribute.php index 6cf08dbb37..ddb29a3b2a 100644 --- a/core/lib/Drupal/Core/Template/Attribute.php +++ b/core/lib/Drupal/Core/Template/Attribute.php @@ -332,6 +332,7 @@ public function __toString() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return count($this->__toString()); }