Skip to content

Commit

Permalink
fixed all the PHPdoc in extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
cebe committed Apr 23, 2014
1 parent 91965fd commit fe14f0c
Show file tree
Hide file tree
Showing 109 changed files with 1,339 additions and 1,321 deletions.
19 changes: 15 additions & 4 deletions build/controllers/PhpDocController.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,39 +202,50 @@ protected function fixDocBlockIndentation(&$lines)
{
$docBlock = false;
$codeBlock = false;
$listIndent = false;
$listIndent = '';
$tag = false;
$indent = '';
foreach($lines as $i => $line) {
if (preg_match('~^(\s*)/\*\*$~', $line, $matches)) {
$docBlock = true;
$indent = $matches[1];
} elseif (preg_match('~^(\s+)\*+/~', $line)) {
} elseif (preg_match('~^(\s*)\*+/~', $line)) {
if ($docBlock) { // could be the end of normal comment
$lines[$i] = $indent . ' */';
}
$docBlock = false;
$codeBlock = false;
$listIndent = '';
$tag = false;
} elseif ($docBlock) {
$docLine = str_replace("\t", ' ', rtrim(substr(ltrim($line), 2)));
$line = ltrim($line);
if (isset($line[0]) && $line[0] === '*') {
$line = substr($line, 1);
}
if (isset($line[0]) && $line[0] === ' ') {
$line = substr($line, 1);
}
$docLine = str_replace("\t", ' ', rtrim($line));
if (empty($docLine)) {
$listIndent = '';
} elseif ($docLine[0] === '@') {
$listIndent = '';
$codeBlock = false;
$tag = true;
$docLine = preg_replace('/\s+/', ' ', $docLine);
} elseif (preg_match('/^(~~~|```)/', $docLine)) {
$codeBlock = !$codeBlock;
$listIndent = '';
} elseif (preg_match('/^(\s*)([0-9]+\.|-|\*|\+) /', $docLine, $matches)) {
$listIndent = str_repeat(' ', strlen($matches[0]));
$tag = false;
$lines[$i] = $indent . ' * ' . $docLine;
continue;
}
if ($codeBlock) {
$lines[$i] = rtrim($indent . ' * ' . $docLine);
} else {
$lines[$i] = rtrim($indent . ' * ' . (empty($listIndent) ? $docLine : ($listIndent . ltrim($docLine))));
$lines[$i] = rtrim($indent . ' * ' . (empty($listIndent) && !$tag ? $docLine : ($listIndent . ltrim($docLine))));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/commands/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class ApiController extends BaseController

/**
* Renders API documentation files
* @param array $sourceDirs
* @param string $targetDir
* @param array $sourceDirs
* @param string $targetDir
* @return int
*/
public function actionIndex(array $sourceDirs, $targetDir)
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/commands/GuideController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class GuideController extends BaseController

/**
* Renders API documentation files
* @param array $sourceDirs
* @param string $targetDir
* @param array $sourceDirs
* @param string $targetDir
* @return int
*/
public function actionIndex(array $sourceDirs, $targetDir)
Expand Down
2 changes: 1 addition & 1 deletion extensions/apidoc/components/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function updateContext($context)
}

/**
* @param string $template
* @param string $template
* @return BaseRenderer
*/
abstract protected function findRenderer($template);
Expand Down
6 changes: 3 additions & 3 deletions extensions/apidoc/helpers/ApiMarkdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ protected function renderHeadline($block)
/**
* Converts markdown into HTML
*
* @param string $content
* @param TypeDoc $context
* @param boolean $paragraph
* @param string $content
* @param TypeDoc $context
* @param boolean $paragraph
* @return string
*/
public static function process($content, $context = null, $paragraph = false)
Expand Down
2 changes: 1 addition & 1 deletion extensions/apidoc/helpers/PrettyPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function pExpr_Array(PHPParser_Node_Expr_Array $node)
/**
* Returns a simple human readable output for a value.
*
* @param PHPParser_Node_Expr $value The value node as provided by PHP-Parser.
* @param PHPParser_Node_Expr $value The value node as provided by PHP-Parser.
* @return string
*/
public static function getRepresentationOfValue(PHPParser_Node_Expr $value)
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/BaseDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class BaseDoc extends Object

/**
* @param \phpDocumentor\Reflection\BaseReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/ClassDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function getNativeEvents()

/**
* @param \phpDocumentor\Reflection\ClassReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/ConstDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class ConstDoc extends BaseDoc

/**
* @param \phpDocumentor\Reflection\ClassReflector\ConstantReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
12 changes: 6 additions & 6 deletions extensions/apidoc/models/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected function inheritDocs($class)

/**
* @param MethodDoc $method
* @param ClassDoc $parent
* @param ClassDoc $parent
*/
private function inheritMethodRecursive($method, $class)
{
Expand Down Expand Up @@ -271,8 +271,8 @@ protected function handlePropertyFeature($class)
}

/**
* @param MethodDoc $method
* @param integer $number number of not optional parameters
* @param MethodDoc $method
* @param integer $number number of not optional parameters
* @return bool
*/
private function paramsOptional($method, $number = 0)
Expand All @@ -287,7 +287,7 @@ private function paramsOptional($method, $number = 0)
}

/**
* @param MethodDoc $method
* @param MethodDoc $method
* @return ParamDoc
*/
private function getFirstNotOptionalParameter($method)
Expand All @@ -302,8 +302,8 @@ private function getFirstNotOptionalParameter($method)
}

/**
* @param ClassDoc $classA
* @param ClassDoc|string $classB
* @param ClassDoc $classA
* @param ClassDoc|string $classB
* @return boolean
*/
protected function isSubclassOf($classA, $classB)
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/EventDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class EventDoc extends ConstDoc

/**
* @param \phpDocumentor\Reflection\ClassReflector\ConstantReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/FunctionDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class FunctionDoc extends BaseDoc

/**
* @param \phpDocumentor\Reflection\FunctionReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/InterfaceDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class InterfaceDoc extends TypeDoc

/**
* @param \phpDocumentor\Reflection\InterfaceReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/MethodDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class MethodDoc extends FunctionDoc

/**
* @param \phpDocumentor\Reflection\ClassReflector\MethodReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/ParamDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class ParamDoc extends Object

/**
* @param \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/PropertyDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public function getIsWriteOnly()

/**
* @param \phpDocumentor\Reflection\ClassReflector\PropertyReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
4 changes: 2 additions & 2 deletions extensions/apidoc/models/TraitDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class TraitDoc extends TypeDoc

/**
* @param \phpDocumentor\Reflection\TraitReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
8 changes: 4 additions & 4 deletions extensions/apidoc/models/TypeDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public function getProtectedProperties()
}

/**
* @param null $visibility
* @param null $definedBy
* @param null $visibility
* @param null $definedBy
* @return PropertyDoc[]
*/
private function getFilteredProperties($visibility = null, $definedBy = null)
Expand All @@ -156,8 +156,8 @@ private function getFilteredProperties($visibility = null, $definedBy = null)

/**
* @param \phpDocumentor\Reflection\InterfaceReflector $reflector
* @param Context $context
* @param array $config
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
Expand Down
10 changes: 5 additions & 5 deletions extensions/apidoc/renderers/BaseRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public function createTypeLink($types, $context = null, $title = null, $options

/**
* creates a link to a subject
* @param PropertyDoc|MethodDoc|ConstDoc|EventDoc $subject
* @param string $title
* @param array $options additional HTML attributes for the link.
* @param PropertyDoc|MethodDoc|ConstDoc|EventDoc $subject
* @param string $title
* @param array $options additional HTML attributes for the link.
* @return string
*/
public function createSubjectLink($subject, $title = null, $options = [])
Expand Down Expand Up @@ -177,7 +177,7 @@ private function resolveNamespace($context)
* generate link markup
* @param $text
* @param $href
* @param array $options additional HTML attributes for the link.
* @param array $options additional HTML attributes for the link.
* @return mixed
*/
abstract protected function generateLink($text, $href, $options = []);
Expand All @@ -191,7 +191,7 @@ abstract public function generateApiUrl($typeName);

/**
* Generate an url to a guide page
* @param string $file
* @param string $file
* @return string
*/
public function generateGuideUrl($file)
Expand Down
8 changes: 4 additions & 4 deletions extensions/apidoc/templates/bootstrap/SideNavWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ public function renderItems()

/**
* Renders a widget's item.
* @param string|array $item the item to render.
* @param boolean $collapsed whether to collapse item if not active
* @param string|array $item the item to render.
* @param boolean $collapsed whether to collapse item if not active
* @throws \yii\base\InvalidConfigException
* @return string the rendering result.
* @throws InvalidConfigException if label is not defined
* @return string the rendering result.
* @throws InvalidConfigException if label is not defined
*/
public function renderItem($item, $collapsed = true)
{
Expand Down
12 changes: 6 additions & 6 deletions extensions/apidoc/templates/html/ApiRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function renderWithLayout($viewFile, $params)
}

/**
* @param ClassDoc $class
* @param ClassDoc $class
* @return string
*/
public function renderInheritance($class)
Expand All @@ -159,7 +159,7 @@ public function renderInheritance($class)
}

/**
* @param array $names
* @param array $names
* @return string
*/
public function renderInterfaces($names)
Expand All @@ -178,7 +178,7 @@ public function renderInterfaces($names)
}

/**
* @param array $names
* @param array $names
* @return string
*/
public function renderTraits($names)
Expand All @@ -197,7 +197,7 @@ public function renderTraits($names)
}

/**
* @param array $names
* @param array $names
* @return string
*/
public function renderClasses($names)
Expand All @@ -216,7 +216,7 @@ public function renderClasses($names)
}

/**
* @param PropertyDoc $property
* @param PropertyDoc $property
* @return string
*/
public function renderPropertySignature($property)
Expand All @@ -238,7 +238,7 @@ public function renderPropertySignature($property)
}

/**
* @param MethodDoc $method
* @param MethodDoc $method
* @return string
*/
public function renderMethodSignature($method)
Expand Down
Loading

0 comments on commit fe14f0c

Please sign in to comment.