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

Commit

Permalink
Merge branch 'hotfix/146' into develop
Browse files Browse the repository at this point in the history
Forward port #146

Conflicts:
	src/Reflection/ClassReflection.php
	src/Reflection/MethodReflection.php
	src/Reflection/PropertyReflection.php
	src/Scanner/MethodScanner.php
	src/Scanner/PropertyScanner.php
  • Loading branch information
weierophinney committed Aug 13, 2018
2 parents 2e13cf2 + 1e49d5d commit d6db84c
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 20 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.

## 3.3.1 - TBD

### Added

- Nothing.

### Changed

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#146](https://github.com/zendframework/zend-code/pull/146) updates all `@return` annotations to reflect the correct types returned by each method.

- [#144](https://github.com/zendframework/zend-code/pull/144) fixes the class generator such that it now resolves
`setExtendedClass()` arguments to aliases provided to the generator.

Expand Down
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
4 changes: 2 additions & 2 deletions src/Reflection/ClassReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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 Down Expand Up @@ -153,7 +153,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
2 changes: 1 addition & 1 deletion src/Reflection/MethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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
6 changes: 3 additions & 3 deletions src/Scanner/TokenArrayScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function __construct($tokens)
* @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 @@ -160,7 +160,7 @@ public function getClasses()
*
* @param string|int $name
* @throws Exception\InvalidArgumentException
* @return ClassScanner
* @return ClassScanner|false
*/
public function getClass($name)
{
Expand Down Expand Up @@ -647,7 +647,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 d6db84c

Please sign in to comment.