3v4l.org

run code in 500+ 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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n7fa6
function name:  (null)
number of ops:  15
compiled vars:  !0 = $user, !1 = $entity
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                                'ownerinterface'
   14     1        DECLARE_CLASS                                                'userinterface'
   19     2        DECLARE_CLASS                                                'user'
   35     3        DECLARE_CLASS                                                'ownedentity'
   43     4        DECLARE_CLASS                                                'entityownerinterface'
   48     5        NEW                                                  $2      'User'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $2
   49     8        NEW                                                  $5      'OwnedEntity'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !1, $5
   50    11        INIT_METHOD_CALL                                             !1, 'setOwner'
         12        SEND_VAR_EX                                                  !0
         13        DO_FCALL                                          0          
         14      > RETURN                                                       1

Class EntityInterface: [no user functions]
Class OwnerInterface: [no user functions]
Class UserInterface: [no user functions]
Class User: [no user functions]
Class OwnedEntityInterface:
Function setowner:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n7fa6
function name:  setOwner
number of ops:  2
compiled vars:  !0 = $owner
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   RECV                                                 !0      
          1      > RETURN                                                       null

End of function setowner

End of class OwnedEntityInterface.

Class OwnedEntity:
Function setowner:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n7fa6
function name:  setOwner
number of ops:  2
compiled vars:  !0 = $owner
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   36     0  E >   RECV                                                 !0      
          1      > RETURN                                                       null

End of function setowner

End of class OwnedEntity.

Class EntityOwnerInterface: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.07 ms | 2075 KiB | 13 Q