src/Incoming/Structure/Exception/ReadOnlyException.php
public static function forAttribute(
        $name,
        $value = null,
        int $code = self::CODE_FOR_ATTRIBUTE,
        Throwable $previous = null
    ): self {
        $message = self::DEFAULT_MESSAGE;

        if (null !== $value) {
            $message .= sprintf(
                self::MESSAGE_EXTENSION_FOR_ATTRIBUTE_FORMAT . self::MESSAGE_EXTENSION_FOR_ATTRIBUTE_WITH_VALUE_FORMAT,
                $name,
                var_export($value, true)
            );
        } else {
            $message .= sprintf(
                self::MESSAGE_EXTENSION_FOR_ATTRIBUTE_FORMAT,
                $name
            );
        }

        return new static($message, $code, $previous);
    }
public static function forAttribute(
        $name,
        $value = null,
        int $code = self::CODE_FOR_ATTRIBUTE,
        Throwable $previous = null
    ): self {
        $message = self::DEFAULT_MESSAGE;

        if (null !== $value) {
            $message .= sprintf(
                self::MESSAGE_EXTENSION_FOR_ATTRIBUTE_FORMAT . self::MESSAGE_EXTENSION_FOR_ATTRIBUTE_WITH_VALUE_FORMAT,
                $name,
                var_export($value, true)
            );
        } else {
            $message .= sprintf(
                self::MESSAGE_EXTENSION_FOR_ATTRIBUTE_FORMAT,
                $name
            );
        }

        return new static($message, $code, $previous);
    }
public static function forAttribute ( $ name , $ value = null , int $ code = self :: CODE_FOR_ATTRIBUTE , Throwable $ previous = null ) : self { $ message = self :: DEFAULT_MESSAGE ; if ( null !== $ value ) { $ message .= sprintf ( self :: MESSAGE_EXTENSION_FOR_ATTRIBUTE_FORMAT . self :: MESSAGE_EXTENSION_FOR_ATTRIBUTE_WITH_VALUE_FORMAT , $ name , var_export ( $ value , true ) ) ; } else { $ message .= sprintf ( self :: MESSAGE_EXTENSION_FOR_ATTRIBUTE_FORMAT , $ name ) ; } return new static ( $ message , $ code , $ previous ) ; }
Create an exception instance with an attribute's context.

@param mixed $name The name of the attribute attempted to be modified.
@param mixed|null $value The value attempted to be set.
@param int $code The exception code.
@param Throwable|null $previous A previous exception used for chaining.
@return static The newly created exception.
Create an exception instance with an attribute s context .