3v4l.org

run code in 300+ PHP versions simultaneously
<?php // \Drupal\Core\Entity\EntityInterface interface EntityInterface { // ... } // \Drupal\Core\Entity\OwnerInterface interface OwnerInterface extends EntityInterface { // Just a marker interface (for now?). } // \Drupal\user\UserInterface interface UserInterface extends OwnerInterface { // ... } // \Drupal\user\User class User implements UserInterface { } // \Drupal\Core\Entity\OwnedEntityInterface interface OwnedEntityInterface { // For callers this work fine when you pass an object whose class implements // UserInterface. Implementors may need to adapt but this is fine according to // our current policies (https://www.drupal.org/core/d8-bc-policy): // "Interfaces follow a similar pattern as above with respect to @api, // @internal, or neither. However, in case of neither tag, the interface is // treated as an API for callers but not for implementers." public function setOwner(OwnerInterface $owner); // ... } // Example class. class OwnedEntity implements OwnedEntityInterface { public function setOwner(OwnerInterface $owner) {} } /** * @deprecated */ // \Drupal\user\EntityOwnerInterface interface EntityOwnerInterface extends OwnedEntityInterface { // This now empty, all methods are in "OwnedEntityInterface". } $user = new User(); $entity = new OwnedEntity(); $entity->setOwner($user);
Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

preferences:
160.96 ms | 402 KiB | 181 Q