getReflectionProperty example

return false;
    }

    protected function isAllowedAttribute(object|string $classOrObject, string $attribute, string $format = null, array $context = []): bool
    {
        if (!parent::isAllowedAttribute($classOrObject$attribute$format$context)) {
            return false;
        }

        try {
            $reflectionProperty = $this->getReflectionProperty($classOrObject$attribute);
        } catch (\ReflectionException) {
            return false;
        }

        if ($reflectionProperty->isStatic()) {
            return false;
        }

        $normalizeVisibility = $context[self::NORMALIZE_VISIBILITY] ?? $this->defaultContext[self::NORMALIZE_VISIBILITY];

        if ((self::NORMALIZE_PUBLIC & $normalizeVisibility) && $reflectionProperty->isPublic()) {
            
return false;
    }

    protected function isAllowedAttribute(object|string $classOrObject, string $attribute, string $format = null, array $context = []): bool
    {
        if (!parent::isAllowedAttribute($classOrObject$attribute$format$context)) {
            return false;
        }

        try {
            $reflectionProperty = $this->getReflectionProperty($classOrObject$attribute);
        } catch (\ReflectionException) {
            return false;
        }

        if ($reflectionProperty->isStatic()) {
            return false;
        }

        $normalizeVisibility = $context[self::NORMALIZE_VISIBILITY] ?? $this->defaultContext[self::NORMALIZE_VISIBILITY];

        if ((self::NORMALIZE_PUBLIC & $normalizeVisibility) && $reflectionProperty->isPublic()) {
            
Home | Imprint | This part of the site doesn't use cookies.