Printer
class Printer
Generates PHP code.
Properties
| $wrapLength | |||
| $indentation | |||
| $linesBetweenProperties | |||
| $linesBetweenMethods | |||
| $linesBetweenUseTypes | |||
| $returnTypeColon | |||
| $bracesOnNextLine | |||
| $singleParameterOnOneLine | |||
| $omitEmptyNamespaces | |||
| $declareOnOpenTag | |||
| protected | $namespace | ||
| protected | $dumper |
Methods
__construct()
No description
string
string
string
string
printMethod(Method $method, PhpNamespace|null $namespace = null, bool $isInterface = false)
No description
string
printClass(EnumType $class, PhpNamespace|null $namespace = null)
No description
string
string
printUses(PhpNamespace $namespace, string $of = PhpNamespace::NameNormal)
Generates use statements for the given namespace.
string
printParameters(PropertyHook $function, int $column = 0)
No description
string
printType(string|null $type, bool $nullable)
No description
string
printDocComment(PhpFile|ClassLike|GlobalFunction|Method|Property|Constant|Parameter|EnumCase|TraitUse|PropertyHook $commentable)
No description
string
printReturnType(Method $function)
No description
string
printAttributes(array $attrs, bool $inline = false)
No description
setTypeResolving(bool $state = true)
Enables or disables automatic simplification of fully qualified type names using namespace use statements.
string
indent(string $s)
No description
string
dump(mixed $var, int $column = 0, DumpContext $context = DumpContext::Expression)
No description
bool
isBraceOnNextLine(bool $multiLine, bool $hasReturnType)
No description
Details
at line 35
__construct()
No description
at line 41
string
printFunction(GlobalFunction $function, PhpNamespace|null $namespace = null)
No description
at line 62
string
printClosure(Closure $closure, PhpNamespace|null $namespace = null)
No description
at line 85
string
printArrowFunction(Closure $closure, PhpNamespace|null $namespace = null)
No description
at line 105
string
printMethod(Method $method, PhpNamespace|null $namespace = null, bool $isInterface = false)
No description
at line 140
string
printClass(EnumType $class, PhpNamespace|null $namespace = null)
No description
at line 239
string
printNamespace(PhpNamespace $namespace)
No description
at line 274
string
printFile(PhpFile $file)
No description
at line 297
protected string
printUses(PhpNamespace $namespace, string $of = PhpNamespace::NameNormal)
Generates use statements for the given namespace.
at line 315
protected string
printParameters(PropertyHook $function, int $column = 0)
No description
at line 417
protected string
printType(string|null $type, bool $nullable)
No description
at line 434
protected string
printDocComment(PhpFile|ClassLike|GlobalFunction|Method|Property|Constant|Parameter|EnumCase|TraitUse|PropertyHook $commentable)
No description
at line 444
protected string
printReturnType(Method $function)
No description
at line 453
protected string
printAttributes(array $attrs, bool $inline = false)
No description
at line 509
Printer
setTypeResolving(bool $state = true)
Enables or disables automatic simplification of fully qualified type names using namespace use statements.
at line 516
protected string
indent(string $s)
No description
at line 523
protected string
dump(mixed $var, int $column = 0, DumpContext $context = DumpContext::Expression)
No description
at line 543
protected bool
isBraceOnNextLine(bool $multiLine, bool $hasReturnType)
No description