class Printer

Generates PHP code.

Properties

$wrapLength
$indentation
$linesBetweenProperties
$linesBetweenMethods
$linesBetweenUseTypes
$returnTypeColon
$bracesOnNextLine
$singleParameterOnOneLine
$omitEmptyNamespaces
protected $namespace
protected $dumper

Methods

__construct()

No description

string
printFunction(GlobalFunction $function, PhpNamespace|null $namespace = null)

No description

string
printClosure(Closure $closure, PhpNamespace|null $namespace = null)

No description

string
printArrowFunction(Closure $closure, PhpNamespace|null $namespace = null)

No description

string
printMethod(Method $method, PhpNamespace|null $namespace = null, bool $isInterface = false)

No description

string
printClass(EnumType $class, PhpNamespace|null $namespace = null)

No description

string
printNamespace(PhpNamespace $namespace)

No description

string
printFile(PhpFile $file)

No description

string
printUses(PhpNamespace $namespace, string $of = PhpNamespace::NameNormal)

No description

string
printParameters(Method $function, int $column = 0)

No description

string
printType(string|null $type, bool $nullable)

No description

string
printDocComment($commentable)

No description

string
printReturnType(Method $function)

No description

string
printAttributes(array $attrs, bool $inline = false)

No description

setTypeResolving(bool $state = true)

No description

string
indent(string $s)

No description

string
dump(mixed $var, int $column = 0)

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

Parameters

GlobalFunction $function
PhpNamespace|null $namespace

Return Value

string

at line 63
string printClosure(Closure $closure, PhpNamespace|null $namespace = null)

No description

Parameters

Closure $closure
PhpNamespace|null $namespace

Return Value

string

at line 87
string printArrowFunction(Closure $closure, PhpNamespace|null $namespace = null)

No description

Parameters

Closure $closure
PhpNamespace|null $namespace

Return Value

string

at line 107
string printMethod(Method $method, PhpNamespace|null $namespace = null, bool $isInterface = false)

No description

Parameters

Method $method
PhpNamespace|null $namespace
bool $isInterface

Return Value

string

at line 135
string printClass(EnumType $class, PhpNamespace|null $namespace = null)

No description

Parameters

EnumType $class
PhpNamespace|null $namespace

Return Value

string

at line 260
string printNamespace(PhpNamespace $namespace)

No description

Parameters

PhpNamespace $namespace

Return Value

string

at line 295
string printFile(PhpFile $file)

No description

Parameters

PhpFile $file

Return Value

string

at line 312
protected string printUses(PhpNamespace $namespace, string $of = PhpNamespace::NameNormal)

No description

Parameters

PhpNamespace $namespace
string $of

Return Value

string

at line 330
protected string printParameters(Method $function, int $column = 0)

No description

Parameters

Method $function
int $column

Return Value

string

at line 378
protected string printType(string|null $type, bool $nullable)

No description

Parameters

string|null $type
bool $nullable

Return Value

string

at line 398
protected string printDocComment($commentable)

No description

Parameters

$commentable

Return Value

string

at line 408
protected string printReturnType(Method $function)

No description

Parameters

Method $function

Return Value

string

at line 417
protected string printAttributes(array $attrs, bool $inline = false)

No description

Parameters

array $attrs
bool $inline

Return Value

string

at line 438
Printer setTypeResolving(bool $state = true)

No description

Parameters

bool $state

Return Value

Printer

at line 445
protected string indent(string $s)

No description

Parameters

string $s

Return Value

string

at line 452
protected string dump(mixed $var, int $column = 0)

No description

Parameters

mixed $var
int $column

Return Value

string

at line 471
protected bool isBraceOnNextLine(bool $multiLine, bool $hasReturnType)

No description

Parameters

bool $multiLine
bool $hasReturnType

Return Value

bool