Documentation

TwigTest extends AbstractTwigCallable
in package

FinalYes

Represents a template test.

Tags
author

Fabien Potencier fabien@symfony.com

see
https://twig.symfony.com/doc/templates.html#test-operator

Table of Contents

Properties

$options  : mixed

Methods

__construct()  : mixed
__toString()  : string
getAlternative()  : string|null
getArguments()  : array<string|int, mixed>
getCallable()  : callable|array{class-string, string}|null
getDeprecatedVersion()  : string
getDeprecatingPackage()  : string
getDynamicName()  : string
getMinimalNumberOfRequiredArguments()  : int
getName()  : string
getNodeClass()  : string
getType()  : string
hasOneMandatoryArgument()  : bool
isDeprecated()  : bool
isVariadic()  : bool
needsCharset()  : bool
needsContext()  : bool
needsEnvironment()  : bool
setArguments()  : void
triggerDeprecation()  : void
withDynamicArguments()  : static

Properties

Methods

__construct()

public __construct(string $name[, callable|array{class-string, string}|null $callable = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$name : string
$callable : callable|array{class-string, string}|null = null

A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation.

$options : array<string|int, mixed> = []

getAlternative()

public getAlternative() : string|null

since Twig 3.15

Return values
string|null

getArguments()

public getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCallable()

public getCallable() : callable|array{class-string, string}|null
Return values
callable|array{class-string, string}|null

getDeprecatedVersion()

public getDeprecatedVersion() : string

since Twig 3.15

Return values
string

getDeprecatingPackage()

public getDeprecatingPackage() : string

since Twig 3.15

Return values
string

getMinimalNumberOfRequiredArguments()

public getMinimalNumberOfRequiredArguments() : int
Return values
int

getType()

public getType() : string
Return values
string

hasOneMandatoryArgument()

public hasOneMandatoryArgument() : bool
Return values
bool

needsCharset()

public needsCharset() : bool
Return values
bool

needsContext()

public needsContext() : bool
Return values
bool

needsEnvironment()

public needsEnvironment() : bool
Return values
bool

setArguments()

public setArguments(array<string|int, mixed> $arguments) : void

since Twig 3.12, use withDynamicArguments() instead

Parameters
$arguments : array<string|int, mixed>

triggerDeprecation()

public triggerDeprecation([string|null $file = null ][, int|null $line = null ]) : void
Parameters
$file : string|null = null
$line : int|null = null

withDynamicArguments()

public withDynamicArguments(string $name, string $dynamicName, array<string|int, mixed> $arguments) : static
Parameters
$name : string
$dynamicName : string
$arguments : array<string|int, mixed>
Return values
static

        
On this page

Search results