Menu

## FunctionUnit extends CodeUnit
in package

FunctionUnit.php : 15

##### Tags

psalm-immutable

### Table of Contents

$name : string
$sourceFileName : string
$sourceLines : array<string|int, mixed>
forClass() : ClassUnit
forClassMethod() : ClassMethodUnit
forFunction() : FunctionUnit
forInterface() : InterfaceUnit
forInterfaceMethod() : InterfaceMethodUnit
forTrait() : TraitUnit
forTraitMethod() : TraitMethodUnit
isClass() : bool
isClassMethod() : bool
isFunction() : bool
isInterface() : bool
isInterfaceMethod() : bool
isTrait() : bool
isTraitMethod() : bool
name() : string
sourceFileName() : string
sourceLines() : array<string|int, mixed>
__construct() : mixed
ensureUserDefinedClass() : void
ensureUserDefinedInterface() : void
ensureUserDefinedTrait() : void
reflectorForClass() : ReflectionClass
reflectorForClassMethod() : ReflectionMethod
reflectorForFunction() : ReflectionFunction

### Properties

#### $name

CodeUnit.php : 26
`private string $name`

#### $sourceFileName

CodeUnit.php : 31
`private string $sourceFileName`

#### $sourceLines

CodeUnit.php : 37
`private array<string|int, mixed> $sourceLines`

##### Tags

psalm-var

  list

### Methods

#### forClass()

CodeUnit.php : 45
`public static forClass(string $className) : ClassUnit`

##### Parameters

$className : string

##### Tags

psalm-param

  class-string $className

throws
  InvalidCodeUnitException
throws
  ReflectionException

##### Return values

ClassUnit —

#### forClassMethod()

CodeUnit.php : 67
`public static forClassMethod(string $className, string $methodName) : ClassMethodUnit`

##### Parameters

$className : string
$methodName : string

##### Tags

psalm-param

  class-string $className

throws
  InvalidCodeUnitException
throws
  ReflectionException

##### Return values

ClassMethodUnit —

#### forFunction()

CodeUnit.php : 177
`public static forFunction(string $functionName) : FunctionUnit`

##### Parameters

$functionName : string

##### Tags

psalm-param

  callable-string $functionName

throws
  InvalidCodeUnitException
throws
  ReflectionException

##### Return values

FunctionUnit —

#### forInterface()

CodeUnit.php : 89
`public static forInterface(string $interfaceName) : InterfaceUnit`

##### Parameters

$interfaceName : string

##### Tags

psalm-param

  class-string $interfaceName

throws
  InvalidCodeUnitException
throws
  ReflectionException

##### Return values

InterfaceUnit —

#### forInterfaceMethod()

CodeUnit.php : 111
`public static forInterfaceMethod(string $interfaceName, string $methodName) : InterfaceMethodUnit`

##### Parameters

$interfaceName : string
$methodName : string

##### Tags

psalm-param

  class-string $interfaceName

throws
  InvalidCodeUnitException
throws
  ReflectionException

##### Return values

InterfaceMethodUnit —

#### forTrait()

CodeUnit.php : 133
`public static forTrait(string $traitName) : TraitUnit`

##### Parameters

$traitName : string

##### Tags

psalm-param

  class-string $traitName

throws
  InvalidCodeUnitException
throws
  ReflectionException

##### Return values

TraitUnit —

#### forTraitMethod()

CodeUnit.php : 155
`public static forTraitMethod(string $traitName, string $methodName) : TraitMethodUnit`

##### Parameters

$traitName : string
$methodName : string

##### Tags

psalm-param

  class-string $traitName

throws
  InvalidCodeUnitException
throws
  ReflectionException

##### Return values

TraitMethodUnit —

#### isClass()

CodeUnit.php : 228
`public isClass() : bool`

##### Return values

bool —

#### isClassMethod()

CodeUnit.php : 233
`public isClassMethod() : bool`

##### Return values

bool —

#### isFunction()

FunctionUnit.php : 20
`public isFunction() : bool`

##### Tags

psalm-assert-if-true

  FunctionUnit $this

##### Return values

bool —

#### isInterface()

CodeUnit.php : 238
`public isInterface() : bool`

##### Return values

bool —

#### isInterfaceMethod()

CodeUnit.php : 243
`public isInterfaceMethod() : bool`

##### Return values

bool —

#### isTrait()

CodeUnit.php : 248
`public isTrait() : bool`

##### Return values

bool —

#### isTraitMethod()

CodeUnit.php : 253
`public isTraitMethod() : bool`

##### Return values

bool —

#### name()

CodeUnit.php : 210
`public name() : string`

##### Return values

string —

#### sourceFileName()

CodeUnit.php : 215
`public sourceFileName() : string`

##### Return values

string —

#### sourceLines()

CodeUnit.php : 223
`public sourceLines() : array<string|int, mixed>`

##### Tags

psalm-return

  list

##### Return values

array<string|int, mixed> —

#### __construct()

CodeUnit.php : 203
`private __construct(string $name, string $sourceFileName, array<string|int, mixed> $sourceLines) : mixed`

##### Parameters

$name : string
$sourceFileName : string
$sourceLines : array<string|int, mixed>

##### Tags

psalm-param

  list $sourceLines

##### Return values

mixed —

#### ensureUserDefinedClass()

CodeUnit.php : 268
`private static ensureUserDefinedClass(string $className) : void`

##### Parameters

$className : string

##### Tags

psalm-param

  class-string $className

throws
  InvalidCodeUnitException

##### Return values

void —

#### ensureUserDefinedInterface()

CodeUnit.php : 315
`private static ensureUserDefinedInterface(string $interfaceName) : void`

##### Parameters

$interfaceName : string

##### Tags

psalm-param

  class-string $interfaceName

throws
  InvalidCodeUnitException

##### Return values

void —

#### ensureUserDefinedTrait()

CodeUnit.php : 353
`private static ensureUserDefinedTrait(string $traitName) : void`

##### Parameters

$traitName : string

##### Tags

psalm-param

  class-string $traitName

throws
  InvalidCodeUnitException

##### Return values

void —

#### reflectorForClass()

CodeUnit.php : 391
`private static reflectorForClass(string $className) : ReflectionClass`

##### Parameters

$className : string

##### Tags

psalm-param

  class-string $className

throws
  ReflectionException

##### Return values

ReflectionClass —

#### reflectorForClassMethod()

CodeUnit.php : 411
`private static reflectorForClassMethod(string $className, string $methodName) : ReflectionMethod`

##### Parameters

$className : string
$methodName : string

##### Tags

psalm-param

  class-string $className

throws
  ReflectionException

##### Return values

ReflectionMethod —

#### reflectorForFunction()

CodeUnit.php : 431
`private static reflectorForFunction(string $functionName) : ReflectionFunction`

##### Parameters

$functionName : string

##### Tags

psalm-param

  callable-string $functionName

throws
  ReflectionException

##### Return values

ReflectionFunction —

## Search results