trait TraitsTrait

Methods

addUseStatement($qualifiedName, $alias = null)

No description

removeUseStatement($qualifiedName)

No description

getNamespace()

No description

$this
addTrait(PhpTrait|string $trait)

Adds a trait.

string[]
getTraits()

Returns a collection of traits

boolean
hasTrait(PhpTrait|string $trait)

Checks whether a trait exists

$this
removeTrait(PhpTrait|string $trait)

Removes a trait.

$this
setTraits(array $traits)

Sets a collection of traits

Details

at line line 10
abstract addUseStatement($qualifiedName, $alias = null)

Parameters

$qualifiedName
$alias

at line line 12
abstract removeUseStatement($qualifiedName)

Parameters

$qualifiedName

at line line 14
abstract getNamespace()

at line line 25
$this addTrait(PhpTrait|string $trait)

Adds a trait.

If the trait is passed as PhpTrait object, the trait is also added as use statement.

Parameters

PhpTrait|string $trait trait or qualified name

Return Value

$this

at line line 50
string[] getTraits()

Returns a collection of traits

Return Value

string[]

at line line 60
boolean hasTrait(PhpTrait|string $trait)

Checks whether a trait exists

Parameters

PhpTrait|string $trait

Return Value

boolean true if it exists and false if not

at line line 77
$this removeTrait(PhpTrait|string $trait)

Removes a trait.

If the trait is passed as PhpTrait object, the trait is also removed from use statements.

Parameters

PhpTrait|string $trait trait or qualified name

Return Value

$this

at line line 103
$this setTraits(array $traits)

Sets a collection of traits

Parameters

array $traits

Return Value

$this