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|null $alias = null, string $of = PhpNamespace::NameNormal)
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 94
GlobalFunction
addFunction(string $name)
No description
at line 103
array
getNamespaces()
No description
at line 110
array
getClasses()
No description
at line 125
array
getFunctions()
No description
at line 140
PhpFile
addUse(string $name, string|null $alias = null, string $of = PhpNamespace::NameNormal)
No description
at line 151
PhpFile
setStrictTypes(bool $on = true)
Adds declare(strict_types=1) to output.
at line 158
bool
hasStrictTypes()
No description
at line 165
bool
getStrictTypes()
deprecated
deprecated
No description
at line 171
string
__toString()
No description
Traits
SmartObject