src/Reflection/ReflectionProperty.php
private function setModifiers(?int $modifiers): void
    {
        // Default to private.
        if ($modifiers === null) {
            $this->modifiers = \ReflectionProperty::IS_PRIVATE;

            return;
        }

        // Get the number of active visibility modifiers amount all modifies.
        $active_visibility_modifiers =
            ((bool) ($modifiers & \ReflectionProperty::IS_PRIVATE)) +
            ((bool) ($modifiers & \ReflectionProperty::IS_PROTECTED)) +
            ((bool) ($modifiers & \ReflectionProperty::IS_PUBLIC));

        // Not one and only one of private, protected and public is selected, throw exception.
        if ($active_visibility_modifiers !== 1) {
            throw new \DomainException(sprintf(
                '$modifiers (%s) has not ONE of IS_PRIVATE, IS_PROTECTED or IS_PUBLIC set, but found %s.',
                $modifiers,
                $active_visibility_modifiers
            ));
        }

        $this->modifiers = $modifiers;
    }
private function setModifiers(?int $modifiers): void
    {
        // Default to private.
        if ($modifiers === null) {
            $this->modifiers = \ReflectionProperty::IS_PRIVATE;

            return;
        }

        // Get the number of active visibility modifiers amount all modifies.
        $active_visibility_modifiers =
            ((bool) ($modifiers & \ReflectionProperty::IS_PRIVATE)) +
            ((bool) ($modifiers & \ReflectionProperty::IS_PROTECTED)) +
            ((bool) ($modifiers & \ReflectionProperty::IS_PUBLIC));

        // Not one and only one of private, protected and public is selected, throw exception.
        if ($active_visibility_modifiers !== 1) {
            throw new \DomainException(sprintf(
                '$modifiers (%s) has not ONE of IS_PRIVATE, IS_PROTECTED or IS_PUBLIC set, but found %s.',
                $modifiers,
                $active_visibility_modifiers
            ));
        }

        $this->modifiers = $modifiers;
    }
private function setModifiers ( ? int $ modifiers ) : void { // Default to private. if ( $ modifiers === null ) { $ this -> modifiers = \ ReflectionProperty :: IS_PRIVATE ; return ; } // Get the number of active visibility modifiers amount all modifies. $ active_visibility_modifiers = ( ( bool ) ( $ modifiers & \ ReflectionProperty :: IS_PRIVATE ) ) + ( ( bool ) ( $ modifiers & \ ReflectionProperty :: IS_PROTECTED ) ) + ( ( bool ) ( $ modifiers & \ ReflectionProperty :: IS_PUBLIC ) ) ; // Not one and only one of private, protected and public is selected, throw exception. if ( $ active_visibility_modifiers !== 1 ) { throw new \ DomainException ( sprintf ( '$modifiers (%s) has not ONE of IS_PRIVATE, IS_PROTECTED or IS_PUBLIC set, but found %s.' , $ modifiers , $ active_visibility_modifiers ) ) ; } $ this -> modifiers = $ modifiers ; }
Check modifiers for right type and to have at least a visibility bit
enabled. Also turns null into private visibility.

@throws \InvalidArgumentException
@throws \DomainException

@param int|null $modifiers
Check modifiers for right type and to have at least a visibility bit enabled . Also turns null into private visibility .