src/Proxy/ProxyTrait.php
private function extractVisibilityScopeFromObject(&$callerObject): string
    {
        if ($this === $callerObject) {
            //It's me ! Mario ! So Private scope
            return StateInterface::VISIBILITY_PRIVATE;
        }

        if (\get_class($this) === \get_class($callerObject)) {
            //It's a brother (another instance of this same stated class, not a child), So Private scope too
            return StateInterface::VISIBILITY_PRIVATE;
        }

        if ($callerObject instanceof $this) {
            //It's a child class, so Protected.
            return StateInterface::VISIBILITY_PROTECTED;
        }

        //All another case (not same class), public scope
        return StateInterface::VISIBILITY_PUBLIC;
    }
private function extractVisibilityScopeFromObject(&$callerObject): string
    {
        if ($this === $callerObject) {
            //It's me ! Mario ! So Private scope
            return StateInterface::VISIBILITY_PRIVATE;
        }

        if (\get_class($this) === \get_class($callerObject)) {
            //It's a brother (another instance of this same stated class, not a child), So Private scope too
            return StateInterface::VISIBILITY_PRIVATE;
        }

        if ($callerObject instanceof $this) {
            //It's a child class, so Protected.
            return StateInterface::VISIBILITY_PROTECTED;
        }

        //All another case (not same class), public scope
        return StateInterface::VISIBILITY_PUBLIC;
    }
private function extractVisibilityScopeFromObject ( & $ callerObject ) : string { if ( $ this === $ callerObject ) { //It's me ! Mario ! So Private scope return StateInterface :: VISIBILITY_PRIVATE ; } if ( \ get_class ( $ this ) === \ get_class ( $ callerObject ) ) { //It's a brother (another instance of this same stated class, not a child), So Private scope too return StateInterface :: VISIBILITY_PRIVATE ; } if ( $ callerObject instanceof $ this ) { //It's a child class, so Protected. return StateInterface :: VISIBILITY_PROTECTED ; } //All another case (not same class), public scope return StateInterface :: VISIBILITY_PUBLIC ; }
To compute the visibility scope from the object instance of the caller.

Called from another class (not a child class), via a static method or an instance of this class : Public scope
Called from a child class, via a static method or an instance of this class : Protected scope
Called from a static method of this stated class, or from a method of this stated class (but not this instance) :
Private scope
Called from a method of this stated class instance : Private state

@param object $callerObject

@return string
To compute the visibility scope from the object instance of the caller .