Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Fixed docblock return types
Browse files Browse the repository at this point in the history
  • Loading branch information
allcode committed Nov 11, 2017
1 parent 6b1059d commit 07a27fc
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Generator/ClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ public function addUse($use, $useAlias = null)

/**
* @param string $use
* @return self
* @return bool
*/
public function hasUse($use)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/DocBlock/Tag/AbstractTypeableTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct($types = [], $description = null)

/**
* @param string $description
* @return ReturnTag
* @return AbstractTypeableTag
*/
public function setDescription($description)
{
Expand All @@ -71,7 +71,7 @@ public function getDescription()
* e.g. array('int', 'null') or "int|null"
*
* @param array|string $types
* @return ReturnTag
* @return AbstractTypeableTag
*/
public function setTypes($types)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/DocBlock/Tag/AuthorTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct($authorName = null, $authorEmail = null)

/**
* @param ReflectionTagInterface $reflectionTag
* @return ReturnTag
* @return AuthorTag
* @deprecated Deprecated in 2.3. Use TagManager::createTagFromReflection() instead
*/
public static function fromReflection(ReflectionTagInterface $reflectionTag)
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/DocBlock/Tag/ParamTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct($variableName = null, $types = [], $description = nu

/**
* @param ReflectionTagInterface $reflectionTag
* @return ReturnTag
* @return ParamTag
* @deprecated Deprecated in 2.3. Use TagManager::createTagFromReflection() instead
*/
public static function fromReflection(ReflectionTagInterface $reflectionTag)
Expand Down Expand Up @@ -75,7 +75,7 @@ public function getVariableName()

/**
* @param string $datatype
* @return ReturnTag
* @return ParamTag
* @deprecated Deprecated in 2.3. Use setTypes() instead
*/
public function setDatatype($datatype)
Expand Down
6 changes: 6 additions & 0 deletions src/Generator/DocBlockGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class DocBlockGenerator extends AbstractGenerator
*/
protected $wordwrap = true;

/**
* @var TagManager
*/
protected static $tagManager;

/**
Expand Down Expand Up @@ -107,6 +110,9 @@ public static function fromArray(array $array)
return $docBlock;
}

/**
* @return TagManager
*/
protected static function getTagManager()
{
if (! isset(static::$tagManager)) {
Expand Down
6 changes: 3 additions & 3 deletions src/Reflection/ClassReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getDeclaringFile()
/**
* Return the classes DocBlock reflection object
*
* @return DocBlockReflection
* @return DocBlockReflection|false
* @throws Exception\ExceptionInterface for missing DocBock or invalid reflection class
*/
public function getDocBlock()
Expand All @@ -70,7 +70,7 @@ public function getDocBlock()

/**
* @param AnnotationManager $annotationManager
* @return AnnotationCollection
* @return AnnotationCollection|false
*/
public function getAnnotations(AnnotationManager $annotationManager)
{
Expand Down Expand Up @@ -188,7 +188,7 @@ public function getMethods($filter = -1)
/**
* Returns an array of reflection classes of traits used by this class.
*
* @return void|array
* @return null|array
*/
public function getTraits()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/DocBlock/Tag/MethodTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function initialize($tagDocblockLine)
/**
* Get return value type
*
* @return void|string
* @return null|string
* @deprecated 2.0.4 use getTypes instead
*/
public function getReturnType()
Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/DocBlock/Tag/PropertyTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function initialize($tagDocblockLine)
}

/**
* @return void|string
* @return null|string
* @deprecated 2.0.4 use getTypes instead
*/
public function getType()
Expand Down
1 change: 0 additions & 1 deletion src/Reflection/DocBlockReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public static function export()
* @param Reflector|string $commentOrReflector
* @param null|DocBlockTagManager $tagManager
* @throws Exception\InvalidArgumentException
* @return DocBlockReflection
*/
public function __construct($commentOrReflector, DocBlockTagManager $tagManager = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Reflection/FileReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function getDocComment()
}

/**
* @return DocBlockReflection
* @return DocBlockReflection|false
*/
public function getDocBlock()
{
Expand All @@ -180,7 +180,7 @@ public function getNamespaces()
}

/**
* @return void|string
* @return null|string
*/
public function getNamespace()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/FunctionReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function getContents($includeDocBlock = true)
* Get method prototype
*
* @param string $format
* @return array
* @return array|string
*/
public function getPrototype($format = FunctionReflection::PROTOTYPE_AS_ARRAY)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Reflection/MethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getDocBlock()

/**
* @param AnnotationManager $annotationManager
* @return AnnotationScanner
* @return AnnotationScanner|false
*/
public function getAnnotations(AnnotationManager $annotationManager)
{
Expand Down Expand Up @@ -123,7 +123,7 @@ public function getDeclaringClass()
* Get method prototype
*
* @param string $format
* @return array
* @return array|string
*/
public function getPrototype($format = MethodReflection::PROTOTYPE_AS_ARRAY)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Reflection/ParameterReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public function getDeclaringClass()
/**
* Get class reflection object
*
* @return void|ClassReflection
* @return null|ClassReflection
*/
public function getClass()
{
$phpReflection = parent::getClass();
if ($phpReflection === null) {
return;
return null;
}

$zendReflection = new ClassReflection($phpReflection->getName());
Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/PropertyReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getDocBlock()

/**
* @param AnnotationManager $annotationManager
* @return AnnotationScanner
* @return AnnotationScanner|false
*/
public function getAnnotations(AnnotationManager $annotationManager)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Scanner/MethodScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function getDocComment()

/**
* @param AnnotationManager $annotationManager
* @return AnnotationScanner
* @return AnnotationScanner|false
*/
public function getAnnotations(AnnotationManager $annotationManager)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Scanner/PropertyScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function getDocComment()

/**
* @param Annotation\AnnotationManager $annotationManager
* @return AnnotationScanner
* @return AnnotationScanner|false
*/
public function getAnnotations(Annotation\AnnotationManager $annotationManager)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Scanner/TokenArrayScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getAnnotationManager()
* @todo Assignment of $this->docComment should probably be done in scan()
* and then $this->getDocComment() just retrieves it.
*
* @return string
* @return string|null
*/
public function getDocComment()
{
Expand Down Expand Up @@ -176,7 +176,7 @@ public function getClasses()
*
* @param string|int $name
* @throws Exception\InvalidArgumentException
* @return ClassScanner
* @return ClassScanner|false
*/
public function getClass($name)
{
Expand Down Expand Up @@ -663,7 +663,7 @@ public function hasNamespace($namespace)

/**
* @param string $namespace
* @return void|array
* @return null|array
* @throws Exception\InvalidArgumentException
*/
protected function getUsesNoScan($namespace)
Expand Down

0 comments on commit 07a27fc

Please sign in to comment.