From 119d6fa31a0f623ad6e1dac2f5b200b9c718f022 Mon Sep 17 00:00:00 2001 From: Nicolas Eeckeloo Date: Thu, 13 Dec 2012 13:10:07 +0100 Subject: [PATCH] Fix PSR2 --- .../Zend/Code/Generator/ClassGenerator.php | 73 +++++++++++-------- .../Zend/Code/Generator/DocBlockGenerator.php | 19 +++-- 2 files changed, 53 insertions(+), 39 deletions(-) diff --git a/library/Zend/Code/Generator/ClassGenerator.php b/library/Zend/Code/Generator/ClassGenerator.php index e74cdd7946d..2da19112916 100644 --- a/library/Zend/Code/Generator/ClassGenerator.php +++ b/library/Zend/Code/Generator/ClassGenerator.php @@ -70,7 +70,7 @@ class ClassGenerator extends AbstractGenerator /** * Build a Code Generation Php Object from a Class Reflection * - * @param ClassReflection $classReflection + * @param ClassReflection $classReflection * @return ClassGenerator */ public static function fromReflection(ClassReflection $classReflection) @@ -142,7 +142,7 @@ public static function fromReflection(ClassReflection $classReflection) * @configkey methods * * @throws Exception\InvalidArgumentException - * @param array $array + * @param array $array * @return ClassGenerator */ public static function fromArray(array $array) @@ -182,7 +182,7 @@ public static function fromArray(array $array) break; } } - + return $cg; } @@ -226,7 +226,7 @@ public function __construct($name = null, $namespaceName = null, $flags = null, } /** - * @param string $name + * @param string $name * @return ClassGenerator */ public function setName($name) @@ -238,6 +238,7 @@ public function setName($name) } $this->name = $name; + return $this; } @@ -258,7 +259,7 @@ public function getNamespaceName() } /** - * @param string $namespaceName + * @param string $namespaceName * @return ClassGenerator */ public function setNamespaceName($namespaceName) @@ -269,7 +270,7 @@ public function setNamespaceName($namespaceName) } /** - * @param FileGenerator $fileGenerator + * @param FileGenerator $fileGenerator * @return ClassGenerator */ public function setContainingFileGenerator(FileGenerator $fileGenerator) @@ -288,7 +289,7 @@ public function getContainingFileGenerator() } /** - * @param DocBlockGenerator $docBlock + * @param DocBlockGenerator $docBlock * @return ClassGenerator */ public function setDocBlock(DocBlockGenerator $docBlock) @@ -307,7 +308,7 @@ public function getDocBlock() } /** - * @param array|string $flags + * @param array|string $flags * @return \Zend\Code\Generator\ClassGenerator */ public function setFlags($flags) @@ -321,31 +322,34 @@ public function setFlags($flags) } // check that visibility is one of three $this->flags = $flags; + return $this; } /** - * @param string $flag + * @param string $flag * @return ClassGenerator */ public function addFlag($flag) { $this->setFlags($this->flags | $flag); + return $this; } /** - * @param string $flag + * @param string $flag * @return ClassGenerator */ public function removeFlag($flag) { $this->setFlags($this->flags & ~$flag); + return $this; } /** - * @param bool $isAbstract + * @param bool $isAbstract * @return AbstractMemberGenerator */ public function setAbstract($isAbstract) @@ -358,11 +362,11 @@ public function setAbstract($isAbstract) */ public function isAbstract() { - return (boolean)($this->flags & self::FLAG_ABSTRACT); + return (boolean) ($this->flags & self::FLAG_ABSTRACT); } /** - * @param bool $isFinal + * @param bool $isFinal * @return AbstractMemberGenerator */ public function setFinal($isFinal) @@ -379,12 +383,13 @@ public function isFinal() } /** - * @param string $extendedClass + * @param string $extendedClass * @return ClassGenerator */ public function setExtendedClass($extendedClass) { $this->extendedClass = $extendedClass; + return $this; } @@ -397,12 +402,13 @@ public function getExtendedClass() } /** - * @param array $implementedInterfaces + * @param array $implementedInterfaces * @return ClassGenerator */ public function setImplementedInterfaces(array $implementedInterfaces) { $this->implementedInterfaces = $implementedInterfaces; + return $this; } @@ -415,7 +421,7 @@ public function getImplementedInterfaces() } /** - * @param array $properties + * @param array $properties * @return ClassGenerator */ public function addProperties(array $properties) @@ -438,9 +444,9 @@ public function addProperties(array $properties) /** * Add Property from scalars * - * @param string $name - * @param string|array $defaultValue - * @param int $flags + * @param string $name + * @param string|array $defaultValue + * @param int $flags * @throws Exception\InvalidArgumentException * @return ClassGenerator */ @@ -458,7 +464,7 @@ public function addProperty($name, $defaultValue = null, $flags = PropertyGenera /** * Add property from PropertyGenerator * - * @param string|PropertyGenerator $property + * @param string|PropertyGenerator $property * @throws Exception\InvalidArgumentException * @return ClassGenerator */ @@ -471,6 +477,7 @@ public function addPropertyFromGenerator(PropertyGenerator $property) } $this->properties[$propertyName] = $property; + return $this; } @@ -483,7 +490,7 @@ public function getProperties() } /** - * @param string $propertyName + * @param string $propertyName * @return PropertyGenerator|false */ public function getProperty($propertyName) @@ -493,11 +500,12 @@ public function getProperty($propertyName) return $property; } } + return false; } /** - * @param string $propertyName + * @param string $propertyName * @return bool */ public function hasProperty($propertyName) @@ -506,7 +514,7 @@ public function hasProperty($propertyName) } /** - * @param array $methods + * @param array $methods * @return ClassGenerator */ public function addMethods(array $methods) @@ -522,17 +530,18 @@ public function addMethods(array $methods) } } } + return $this; } /** * Add Method from scalars * - * @param string $name - * @param array $parameters - * @param int $flags - * @param string $body - * @param string $docBlock + * @param string $name + * @param array $parameters + * @param int $flags + * @param string $body + * @param string $docBlock * @throws Exception\InvalidArgumentException * @return ClassGenerator */ @@ -551,7 +560,7 @@ public function addMethod($name = null, array $parameters = array(), $flags = Me /** * Add Method from MethodGenerator * - * @param MethodGenerator $method + * @param MethodGenerator $method * @throws Exception\InvalidArgumentException * @return ClassGenerator */ @@ -564,6 +573,7 @@ public function addMethodFromGenerator(MethodGenerator $method) } $this->methods[$methodName] = $method; + return $this; } @@ -576,7 +586,7 @@ public function getMethods() } /** - * @param string $methodName + * @param string $methodName * @return MethodGenerator|false */ public function getMethod($methodName) @@ -586,11 +596,12 @@ public function getMethod($methodName) return $method; } } + return false; } /** - * @param string $methodName + * @param string $methodName * @return bool */ public function hasMethod($methodName) diff --git a/library/Zend/Code/Generator/DocBlockGenerator.php b/library/Zend/Code/Generator/DocBlockGenerator.php index 9735c38cc1f..5a4010f83cf 100644 --- a/library/Zend/Code/Generator/DocBlockGenerator.php +++ b/library/Zend/Code/Generator/DocBlockGenerator.php @@ -41,7 +41,7 @@ class DocBlockGenerator extends AbstractGenerator /** * Build a DocBlock generator object from a reflection object * - * @param DocBlockReflection $reflectionDocBlock + * @param DocBlockReflection $reflectionDocBlock * @return DocBlockGenerator */ public static function fromReflection(DocBlockReflection $reflectionDocBlock) @@ -69,13 +69,13 @@ public static function fromReflection(DocBlockReflection $reflectionDocBlock) * @configkey tags array * * @throws Exception\InvalidArgumentException - * @param array $array + * @param array $array * @return DocBlockGenerator */ public static function fromArray(array $array) { $docBlock = new static(); - + foreach ($array as $name => $value) { // normalize key switch (strtolower(str_replace(array('.', '-', '_'), '', $name))) { @@ -112,12 +112,13 @@ public function __construct($shortDescription = null, $longDescription = null, a } /** - * @param string $shortDescription + * @param string $shortDescription * @return DocBlockGenerator */ public function setShortDescription($shortDescription) { $this->shortDescription = $shortDescription; + return $this; } @@ -130,12 +131,13 @@ public function getShortDescription() } /** - * @param string $longDescription + * @param string $longDescription * @return DocBlockGenerator */ public function setLongDescription($longDescription) { $this->longDescription = $longDescription; + return $this; } @@ -148,7 +150,7 @@ public function getLongDescription() } /** - * @param array $tags + * @param array $tags * @return DocBlockGenerator */ public function setTags(array $tags) @@ -161,7 +163,7 @@ public function setTags(array $tags) } /** - * @param array|DocBlock\Tag $tag + * @param array|DocBlock\Tag $tag * @throws Exception\InvalidArgumentException * @return DocBlockGenerator */ @@ -214,7 +216,7 @@ public function generate() } /** - * @param string $content + * @param string $content * @return string */ protected function docCommentize($content) @@ -231,6 +233,7 @@ protected function docCommentize($content) $output .= self::LINE_FEED; } $output .= $indent . ' */' . self::LINE_FEED; + return $output; }