PHP_DocBlockGenerator
[ class tree: PHP_DocBlockGenerator ] [ index: PHP_DocBlockGenerator ] [ all elements ]

Class: PHP_DocBlockGenerator_Type

Source Location: /PHP_DocBlockGenerator-1.1.2/PHP/DocBlockGenerator/Type.php

Class Overview


Determination of PHP object types for DocBlock tags


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2007 Michel Corne

Methods


Inherited Variables

Inherited Methods


Class Details

[line 53]
Determination of PHP object types for DocBlock tags

Determination of the types of: function/method parameters and return statements, class constants and variables, and global variables.



[ Top ]


Method Detail

__construct (Constructor)   [line 197]

void __construct( )

The class constructor

Builds the consolidated array of types coming from operators

  • Access: public

[ Top ]

extract   [line 266]

string extract( $types, [boolean $returnType = true], array $rawTypes)

Extracts the type from a list of types

The type is considered identified if the list has one type only. The type is "mixed" if there are different types in the list. The type is "number" if the types are: 'integer', 'float' or 'number'. The type is "unknown" otherwise. The null type is ignored.

  • Return: the type
  • Access: public

Parameters:

array   $rawTypes   —  the list of types
boolean   $returnType   —  in case the type is unknown: if true the default type is returned, if false null is returned
   $types   — 

[ Top ]

guessConst   [line 310]

string guessConst( array $constValue, integer $object, string $name)

Guesses the class constant or define statement type
  • Return: the class constant or define statement type
  • Access: public

Parameters:

array   $constValue   —  the class constant or define value
integer   $object   —  the object, e.g. 'const'
string   $name   —  the object name

[ Top ]

guessReturn   [line 351]

string guessReturn( array $tokens, array $targets)

Guesses the type of data the function returns

This method looks at all variables following the return statement and guesses their type.

  • Return: the type of data the function returns
  • Todo: Redesign/improve the determination of the return type
  • Access: public

Parameters:

array   $tokens   —  the list of tokens of the return statement
array   $targets   —  the list of variables following the return statement

[ Top ]

guessVar   [line 402]

string guessVar( array $tokens, array $var, string $scope, integer $object, [boolean $reference = false], [boolean $returnType = true])

Guesses a variable type
  • Return: the variable type
  • See: self::extract()
  • Todo: Refine the handling ". $array[0]"
  • Access: public

Parameters:

array   $tokens   —  the list of tokens
array   $var   —  the variable
string   $scope   —  the variable scope
integer   $object   —  the PHP object, e.g. 'var'
boolean   $reference   —  true if the variable is a reference, e.g. &$var, false otherwise
boolean   $returnType   —  in case the type is unknown, if true: the default type is returned, if false null is returned

[ Top ]

isAVar   [line 441]

string isAVar( array $tokens, integer &$id, array &$var)

Checks if the current token(s) is a variable and returns its scope
  • Return: the variable scope
  • Access: public

Parameters:

array   $tokens   —  list of tokens
integer   &$id   —  the current token identification number to process, returns the next token identification number
array   &$var   —  the list of tokens describing the variable, returns the token variable as for $var and strips off $this-> or self::

[ Top ]

resetCache   [line 521]

void resetCache( [string $object = null])

Resets the types cache
  • Access: public

Parameters:

string   $object   —  the object types cache to reset, e.g. function 'param', resets all the object types caches by default

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:46:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.