0

Final Class Yiisoft\Hydrator\Attribute\Parameter\RightTrim

InheritanceYiisoft\Hydrator\Attribute\Parameter\RightTrim
ImplementsYiisoft\Hydrator\Attribute\Parameter\ParameterAttributeInterface

Strip whitespace (or other characters) from the end of a resolved string value.

In multibyte mode, Unicode whitespace characters, such as U+00A0 (no-break space), are stripped as well. It requires the mb_rtrim() function provided by the mbstring PHP extension since PHP 8.4, or by the symfony/polyfill-mbstring package on earlier versions.

See also:

Property Details

Hide inherited properties

$characters public property
public ?string $characters = null
$encoding public property
public ?string $encoding = null
$multibyte public property
public ?bool $multibyte = null

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string|null $characters = null, boolean|null $multibyte = null, string|null $encoding = null )
$characters string|null

The list of all characters that you want to be stripped. With .. you can specify a range of characters, both in the default and in the multibyte mode. This syntax is deprecated and will be removed in the next major version.

$multibyte boolean|null

Whether to use multibyte-aware trimming. null means using the resolver default.

$encoding string|null

The encoding to use in multibyte mode. null means using the resolver default.

                public function __construct(
    public readonly ?string $characters = null,
    public readonly ?bool $multibyte = null,
    public readonly ?string $encoding = null,
) {
    TrimCharacters::checkMultibyteFunctionsExist($multibyte);
}

            
getResolver() public method

public string getResolver ( )

                public function getResolver(): string
{
    return RightTrimResolver::class;
}