PhpFile
final class PhpFile
Instance of PHP file.
Generates:
- opening tag (<?php)
- doc comments
- one or more namespaces
Methods
addInterface(string $name)
No description
addFunction(string $name)
No description
array
getNamespaces()
No description
array
getClasses()
No description
array
getFunctions()
No description
addUse(string $name, string $alias = null, string $of = PhpNamespace::NAME_NORMAL)
No description
setStrictTypes(bool $on = true)
Adds declare(strict_types=1) to output.
bool
hasStrictTypes()
No description
bool
string
__toString()
No description
Details
at line 35
static PhpFile
fromCode(string $code)
No description
at line 41
ClassType
addClass(string $name)
No description
at line 49
ClassType
addInterface(string $name)
No description
at line 57
ClassType
addTrait(string $name)
No description
at line 65
ClassType
addEnum(string $name)
No description
at line 74
PhpNamespace
addNamespace(string|PhpNamespace $namespace)
No description
at line 93
GlobalFunction
addFunction(string $name)
No description
at line 102
array
getNamespaces()
No description
at line 109
array
getClasses()
No description
at line 123
array
getFunctions()
No description
at line 137
PhpFile
addUse(string $name, string $alias = null, string $of = PhpNamespace::NAME_NORMAL)
No description
at line 148
PhpFile
setStrictTypes(bool $on = true)
Adds declare(strict_types=1) to output.
at line 155
bool
hasStrictTypes()
No description
at line 162
bool
getStrictTypes()
deprecated
deprecated
No description
at line 168
string
__toString()
No description
Traits
Strict class for better experience.