3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait EloquentValidatingTrait { // Some declarations skipped /** * Eloquent will call this on model boot */ public static function bootEloquentValidatingTrait() { // Calling Model::saving() and asking it to execute assertIsValid() before model is saved into database $savingCallable = [static::class, 'saving']; $validationCallable = [static::class, 'assertIsValid']; forward_static_call($savingCallable, $validationCallable); } } class MyClass { use EloquentValidatingTrait; static function saving() {} static function assertIsValid() {} } $myClass = new MyClass(); $myClass->bootEloquentValidatingTrait();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eEnUb
function name:  (null)
number of ops:  7
compiled vars:  !0 = $myClass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   DECLARE_CLASS                                            'myclass'
   27     1        NEW                                              $1      'MyClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   28     4        INIT_METHOD_CALL                                         !0, 'bootEloquentValidatingTrait'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class EloquentValidatingTrait:
Function booteloquentvalidatingtrait:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eEnUb
function name:  bootEloquentValidatingTrait
number of ops:  13
compiled vars:  !0 = $savingCallable, !1 = $validationCallable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_CLASS_NAME                                 ~2      
          1        INIT_ARRAY                                       ~3      ~2
          2        ADD_ARRAY_ELEMENT                                ~3      'saving'
          3        ASSIGN                                                   !0, ~3
   13     4        FETCH_CLASS_NAME                                 ~5      
          5        INIT_ARRAY                                       ~6      ~5
          6        ADD_ARRAY_ELEMENT                                ~6      'assertIsValid'
          7        ASSIGN                                                   !1, ~6
   14     8        INIT_FCALL                                               'forward_static_call'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   15    12      > RETURN                                                   null

End of function booteloquentvalidatingtrait

End of class EloquentValidatingTrait.

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

End of function saving

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

End of function assertisvalid

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.19 ms | 1427 KiB | 14 Q