final class Factory

Creates PhpGenerator representations from reflection objects or PHP source code.

Methods

fromClassReflection(ReflectionClass $from, bool $withBodies = false)

Creates a ClassLike instance from a reflection object.

Closure
fromFunctionReflection(ReflectionFunction $from, bool $withBody = false)

Creates a GlobalFunction or Closure instance from a reflection object.

Closure
fromCallable(callable $from)

No description

fromConstantReflection(ReflectionClassConstant $from)

No description

fromCaseReflection(ReflectionClassConstant $from)

No description

fromObject(object $obj)

No description

fromClassCode(string $code)

Parses PHP source code and returns the first class-like type found.

fromCode(string $code)

Parses PHP source code and returns the resulting PhpFile representation.

Details

at line 33
ClassLike fromClassReflection(ReflectionClass $from, bool $withBodies = false)

Creates a ClassLike instance from a reflection object.

Parameters

ReflectionClass $from
bool $withBodies

load method bodies (requires nikic/php-parser, not available for anonymous/internal classes or interfaces)

Return Value

ClassLike

at line 194
Method fromMethodReflection(ReflectionMethod $from)

No description

Parameters

ReflectionMethod $from

Return Value

Method

at line 217
Closure fromFunctionReflection(ReflectionFunction $from, bool $withBody = false)

Creates a GlobalFunction or Closure instance from a reflection object.

Parameters

ReflectionFunction $from
bool $withBody

load function body (requires nikic/php-parser, not available for closures or internal functions)

Return Value

Closure

at line 247
Closure fromCallable(callable $from)

No description

Parameters

callable $from

Return Value

Closure

at line 256
Parameter fromParameterReflection(ReflectionParameter $from)

No description

Parameters

ReflectionParameter $from

Return Value

Parameter

at line 292
Constant fromConstantReflection(ReflectionClassConstant $from)

No description

Parameters

ReflectionClassConstant $from

Return Value

Constant

at line 304
EnumCase fromCaseReflection(ReflectionClassConstant $from)

No description

Parameters

ReflectionClassConstant $from

Return Value

EnumCase

at line 314
Property fromPropertyReflection(ReflectionProperty $from)

No description

Parameters

ReflectionProperty $from

Return Value

Property

at line 375
Literal fromObject(object $obj)

No description

Parameters

object $obj

Return Value

Literal

at line 385
ClassLike fromClassCode(string $code)

Parses PHP source code and returns the first class-like type found.

Parameters

string $code

Return Value

ClassLike

Exceptions

InvalidStateException

at line 395
PhpFile fromCode(string $code)

Parses PHP source code and returns the resulting PhpFile representation.

Parameters

string $code

Return Value

PhpFile