class PhpFile

Instance of PHP file.

Generates: - opening tag (<?php) - doc comments - one or more namespaces

Methods

addClass(string $name)

No description

addInterface(string $name)

No description

addTrait(string $name)

No description

addNamespace(string|PhpNamespace $namespace)

No description

array
getNamespaces()

No description

addUse(string $name, string $alias = null)

No description

setStrictTypes(bool $on = true)

Adds declare(strict_types=1) to output.

bool
hasStrictTypes()

No description

bool
getStrictTypes() deprecated

No description

string
__toString()

No description

Details

at line 35
ClassType addClass(string $name)

Parameters

string $name

Return Value

ClassType

at line 43
ClassType addInterface(string $name)

Parameters

string $name

Return Value

ClassType

at line 51
ClassType addTrait(string $name)

Parameters

string $name

Return Value

ClassType

at line 60
PhpNamespace addNamespace(string|PhpNamespace $namespace)

Parameters

string|PhpNamespace $namespace

Return Value

PhpNamespace

at line 80
array getNamespaces()

Return Value

array

at line 87
PhpFile addUse(string $name, string $alias = null)

Parameters

string $name
string $alias

Return Value

PhpFile

at line 98
PhpFile setStrictTypes(bool $on = true)

Adds declare(strict_types=1) to output.

Parameters

bool $on

Return Value

PhpFile

at line 105
bool hasStrictTypes()

Return Value

bool

at line 112
bool getStrictTypes() deprecated

deprecated use hasStrictTypes()

Return Value

bool

at line 118
string __toString()

Return Value

string

Traits

Strict class for better experience.