PhpFile
final class PhpFile
Instance of PHP file.
Generates:
- opening tag (<?php)
- doc comments
- one or more namespaces
Methods
addInterface(string $name)
No description
addNamespace(PhpNamespace $namespace)
No description
addFunction(string $name)
No description
array
getNamespaces()
No description
array
getClasses()
No description
array
getFunctions()
No description
addUse(string $name, string|null $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 33
static PhpFile
fromCode(string $code)
No description
at line 39
ClassType
addClass(string $name)
No description
at line 47
ClassType
addInterface(string $name)
No description
at line 55
ClassType
addTrait(string $name)
No description
at line 63
ClassType
addEnum(string $name)
No description
at line 71
PhpNamespace
addNamespace(PhpNamespace $namespace)
No description
at line 85
GlobalFunction
addFunction(string $name)
No description
at line 94
array
getNamespaces()
No description
at line 101
array
getClasses()
No description
at line 116
array
getFunctions()
No description
at line 130
PhpFile
addUse(string $name, string|null $alias = null, string $of = PhpNamespace::NAME_NORMAL)
No description
at line 140
PhpFile
setStrictTypes(bool $on = true)
Adds declare(strict_types=1) to output.
at line 147
bool
hasStrictTypes()
No description
at line 154
bool
getStrictTypes()
deprecated
deprecated
No description
at line 161
string
__toString()
No description
Traits
Strict class for better experience.