3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); abstract class User { public const STATUS_ACTIVE = 'active'; public const STATUS_INACTIVE = 'inactive'; public function __construct(public string $email, public string $status = self::STATUS_ACTIVE) { } public function setStatus(string $status): void { assert( in_array($status, [self::STATUS_ACTIVE, self::STATUS_INACTIVE]), sprintf('Le status %s n\'est pas valide. Les status possibles sont : %s', $status, [self::STATUS_ACTIVE, self::STATUS_INACTIVE]) ); $this->status = $status; } public function getStatus(): string { return $this->status; } abstract public function getUsername(): string; } class Admin extends User { // Ajout d'un tableau de roles pour affiner les droits des administrateurs :) public function __construct(string $email, string $status = self::STATUS_ACTIVE, public array $roles = []) { parent::__construct($email, $status); } // ... public function getUsername(): string { return $this->email; } } class Player extends User { // Ajout d'un tableau de roles pour affiner les droits des administrateurs :) public function __construct(string $email, public string $username, string $status = self::STATUS_ACTIVE) { parent::__construct($email, $status); } // ... public function getUsername(): string { return $this->username; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E > > RETURN                                                   1

Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  __construct
number of ops:  7
compiled vars:  !0 = $email, !1 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        ASSIGN_OBJ                                               'email'
          3        OP_DATA                                                  !0
          4        ASSIGN_OBJ                                               'status'
          5        OP_DATA                                                  !1
   12     6      > RETURN                                                   null

End of function __construct

Function setstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  setStatus
number of ops:  15
compiled vars:  !0 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ASSERT_CHECK                                             
          2        INIT_FCALL                                               'assert'
   17     3        IN_ARRAY                                         ~1      !0, <array>
          4        SEND_VAL                                                 ~1
   18     5        INIT_FCALL                                               'sprintf'
          6        SEND_VAL                                                 'Le+status+%25s+n%27est+pas+valide.+Les+status+possibles+sont+%3A+%25s'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 <array>
          9        DO_ICALL                                         $2      
         10        SEND_VAR                                                 $2
   16    11        DO_ICALL                                                 
   21    12        ASSIGN_OBJ                                               'status'
         13        OP_DATA                                                  !0
   22    14      > RETURN                                                   null

End of function setstatus

Function getstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  getStatus
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'status'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   27     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getstatus

Function getusername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  getUsername
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function getusername

End of class User.

Class Admin:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  __construct
number of ops:  10
compiled vars:  !0 = $email, !1 = $status, !2 = $roles
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        RECV_INIT                                        !2      <array>
          3        ASSIGN_OBJ                                               'roles'
          4        OP_DATA                                                  !2
   37     5        INIT_STATIC_METHOD_CALL                                  
          6        SEND_VAR_EX                                              !0
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
   38     9      > RETURN                                                   null

End of function __construct

Function getusername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  getUsername
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   FETCH_OBJ_R                                      ~0      'email'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   45     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getusername

Function setstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  setStatus
number of ops:  15
compiled vars:  !0 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ASSERT_CHECK                                             
          2        INIT_FCALL                                               'assert'
   17     3        IN_ARRAY                                         ~1      !0, <array>
          4        SEND_VAL                                                 ~1
   18     5        INIT_FCALL                                               'sprintf'
          6        SEND_VAL                                                 'Le+status+%25s+n%27est+pas+valide.+Les+status+possibles+sont+%3A+%25s'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 <array>
          9        DO_ICALL                                         $2      
         10        SEND_VAR                                                 $2
   16    11        DO_ICALL                                                 
   21    12        ASSIGN_OBJ                                               'status'
         13        OP_DATA                                                  !0
   22    14      > RETURN                                                   null

End of function setstatus

Function getstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  getStatus
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'status'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   27     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getstatus

End of class Admin.

Class Player:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  __construct
number of ops:  10
compiled vars:  !0 = $email, !1 = $username, !2 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <const ast>
          3        ASSIGN_OBJ                                               'username'
          4        OP_DATA                                                  !1
   53     5        INIT_STATIC_METHOD_CALL                                  
          6        SEND_VAR_EX                                              !0
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
   54     9      > RETURN                                                   null

End of function __construct

Function getusername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  getUsername
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   FETCH_OBJ_R                                      ~0      'username'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   61     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getusername

Function setstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  setStatus
number of ops:  15
compiled vars:  !0 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ASSERT_CHECK                                             
          2        INIT_FCALL                                               'assert'
   17     3        IN_ARRAY                                         ~1      !0, <array>
          4        SEND_VAL                                                 ~1
   18     5        INIT_FCALL                                               'sprintf'
          6        SEND_VAL                                                 'Le+status+%25s+n%27est+pas+valide.+Les+status+possibles+sont+%3A+%25s'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 <array>
          9        DO_ICALL                                         $2      
         10        SEND_VAR                                                 $2
   16    11        DO_ICALL                                                 
   21    12        ASSIGN_OBJ                                               'status'
         13        OP_DATA                                                  !0
   22    14      > RETURN                                                   null

End of function setstatus

Function getstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIXG4
function name:  getStatus
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'status'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   27     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getstatus

End of class Player.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.93 ms | 1473 KiB | 15 Q