UninitializedPropertyException example

if ($reflectionProperty->hasType()) {
            return $reflectionProperty->getValue($object);
        }

        if (!method_exists($object, '__get') && !isset($object->$attribute)) {
            $propertyValues = (array) $object;

            if (($reflectionProperty->isPublic() && !\array_key_exists($reflectionProperty->name, $propertyValues))
                || ($reflectionProperty->isProtected() && !\array_key_exists("\0*\0{$reflectionProperty->name}", $propertyValues))
                || ($reflectionProperty->isPrivate() && !\array_key_exists("\0{$reflectionProperty->class}\0{$reflectionProperty->name}", $propertyValues))
            ) {
                throw new UninitializedPropertyException(sprintf('The property "%s::$%s" is not initialized.', $object::class$reflectionProperty->name));
            }
        }

        return $reflectionProperty->getValue($object);
    }

    /** * @return void */
    protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = [])
    {
        
Home | Imprint | This part of the site doesn't use cookies.