PHPDoc: Use @var instead of @type

Becasue of too many kittens PSR-5 backed off of deprecating @var.
So that's the way we go too.
This commit is contained in:
Eric Lippmann 2015-03-12 13:39:17 +01:00
parent 6dc48fe9d3
commit 8563d5ed3f
38 changed files with 87 additions and 87 deletions

View File

@ -23,7 +23,7 @@ class ConfigController extends ActionController
/**
* The first allowed config action according to the user's permissions
*
* @type string
* @var string
*/
protected $firstAllowedAction;

View File

@ -18,7 +18,7 @@ class RoleForm extends ConfigForm
/**
* Provided permissions by currently loaded modules
*
* @type array
* @var array
*/
protected $providedPermissions = array(
'*' => '*',
@ -33,7 +33,7 @@ class RoleForm extends ConfigForm
/**
* Provided restrictions by currently loaded modules
*
* @type array
* @var array
*/
protected $providedRestrictions = array();
@ -46,11 +46,11 @@ class RoleForm extends ConfigForm
$helper = new Zend_Form_Element('bogus');
foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $module) {
foreach ($module->getProvidedPermissions() as $permission) {
/** @type object $permission */
/** @var object $permission */
$this->providedPermissions[$permission->name] = $permission->name . ': ' . $permission->description;
}
foreach ($module->getProvidedRestrictions() as $restriction) {
/** @type object $restriction */
/** @var object $restriction */
$name = $helper->filterName($restriction->name); // Zend only permits alphanumerics, the underscore,
// the circumflex and any ASCII character in range
// \x7f to \xff (127 to 255)

View File

@ -115,7 +115,7 @@ abstract class ApplicationBootstrap
/**
* Whether Icinga Web 2 requires setup
*
* @type bool
* @var bool
*/
protected $requiresSetup = false;

View File

@ -17,7 +17,7 @@ abstract class Command
protected $docs;
/**
* @type Params
* @var Params
*/
protected $params;
protected $screen;

View File

@ -14,14 +14,14 @@ class SimpleTree implements IteratorAggregate
/**
* Root node
*
* @type TreeNode
* @var TreeNode
*/
protected $sentinel;
/**
* Nodes
*
* @type array
* @var array
*/
protected $nodes = array();

View File

@ -10,7 +10,7 @@ class TreeNode implements Identifiable
/**
* The node's ID
*
* @type mixed
* @var mixed
*/
protected $id;
@ -24,7 +24,7 @@ class TreeNode implements Identifiable
/**
* The node's children
*
* @type array
* @var array
*/
protected $children = array();

View File

@ -14,7 +14,7 @@ class TreeNodeIterator implements RecursiveIterator
/**
* The node's children
*
* @type array
* @var array
*/
protected $children;

View File

@ -33,7 +33,7 @@ class FileExtensionFilterIterator extends FilterIterator
/**
* The extension to filter for
*
* @type string
* @var string
*/
protected $extension;
@ -58,7 +58,7 @@ class FileExtensionFilterIterator extends FilterIterator
public function accept()
{
$current = $this->current();
/** @type $current \SplFileInfo */
/** @var $current \SplFileInfo */
if (! $current->isFile()) {
return false;
}

View File

@ -37,7 +37,7 @@ class NonEmptyFileIterator extends FilterIterator
public function accept()
{
$current = $this->current();
/** @type $current \SplFileInfo */
/** @var $current \SplFileInfo */
if (! $current->isFile()
|| $current->getSize() === 0
) {

View File

@ -51,7 +51,7 @@ class ActionController extends Zend_Controller_Action
/**
* Authentication manager
*
* @type Manager|null
* @var Manager|null
*/
private $auth;

View File

@ -33,7 +33,7 @@ class DomNodeIterator implements RecursiveIterator
/**
* The node's children
*
* @type IteratorIterator
* @var IteratorIterator
*/
protected $children;

View File

@ -145,7 +145,7 @@ class Form extends Zend_Form
/**
* Authentication manager
*
* @type Manager|null
* @var Manager|null
*/
private $auth;

View File

@ -18,7 +18,7 @@ class Menu implements RecursiveIterator
/**
* The id of this menu
*
* @type string
* @var string
*/
protected $id;
@ -27,7 +27,7 @@ class Menu implements RecursiveIterator
*
* Used for sorting when priority is unset or equal to other items
*
* @type string
* @var string
*/
protected $title;
@ -36,42 +36,42 @@ class Menu implements RecursiveIterator
*
* Used for sorting
*
* @type int
* @var int
*/
protected $priority = 100;
/**
* The url of this menu
*
* @type string
* @var string
*/
protected $url;
/**
* The path to the icon of this menu
*
* @type string
* @var string
*/
protected $icon;
/**
* The sub menus of this menu
*
* @type array
* @var array
*/
protected $subMenus = array();
/**
* A custom item renderer used instead of the default rendering logic
*
* @type MenuItemRenderer
* @var MenuItemRenderer
*/
protected $itemRenderer = null;
/*
* Parent menu
*
* @type Menu
* @var Menu
*/
protected $parent;

View File

@ -39,7 +39,7 @@ class View extends Zend_View_Abstract
/**
* Authentication manager
*
* @type \Icinga\Authentication\Manager|null
* @var \Icinga\Authentication\Manager|null
*/
private $auth;

View File

@ -1,6 +1,6 @@
<div class="controls">
<?= /** @type \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton() ?>
<?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton() ?>
</div>
<div class="content">
<?= /** @type \Icinga\Module\Doc\Renderer\DocSectionRenderer $section */ $section ?>
<?= /** @var \Icinga\Module\Doc\Renderer\DocSectionRenderer $section */ $section ?>
</div>

View File

@ -1,5 +1,5 @@
<div class="controls"></div>
<?= /** @type \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton(); ?>
<?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton(); ?>
<h1><?= $this->translate('Available documentations'); ?></h1>
<div class="content">
<ul>
@ -16,4 +16,4 @@
array('title' => $this->translate('List all modifications for which documentation is available'))
); ?></li>
</ul>
</div>
</div>

View File

@ -1,5 +1,5 @@
<div class="controls">
<?= /** @type \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton(); ?>
<?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton(); ?>
<h1><?= $this->translate('Module documentations'); ?></h1>
</div>
<div class="content">
@ -16,4 +16,4 @@
); ?></li>
<?php endforeach ?>
</ul>
</div>
</div>

View File

@ -1,5 +1,5 @@
<div class="content">
<h1><?= /** @type string $title */ $title ?></h1>
<?= /** @type \Icinga\Module\Doc\Renderer\DocTocRenderer $toc */ $toc ?>
<?= /** @type \Icinga\Module\Doc\Renderer\DocSectionRenderer $section */ $section ?>
<h1><?= /** @var string $title */ $title ?></h1>
<?= /** @var \Icinga\Module\Doc\Renderer\DocTocRenderer $toc */ $toc ?>
<?= /** @var \Icinga\Module\Doc\Renderer\DocSectionRenderer $section */ $section ?>
</div>

View File

@ -1,5 +1,5 @@
<div class="content">
<?php foreach (/** @type \Icinga\Module\Doc\Renderer\DocSearchRenderer[] $searches */ $searches as $title => $search): ?>
<?php foreach (/** @var \Icinga\Module\Doc\Renderer\DocSearchRenderer[] $searches */ $searches as $title => $search): ?>
<?php if (! $search->isEmpty()): ?>
<h1><?= $this->escape($title) ?></h1>
<?= $search ?>

View File

@ -1,7 +1,7 @@
<div class="controls">
<?= /** @type \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton() ?>
<h1><?= /** @type string $title */ $title ?></h1>
<?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs->showOnlyCloseButton() ?>
<h1><?= /** @var string $title */ $title ?></h1>
</div>
<div class="content">
<?= /** @type \Icinga\Module\Doc\Renderer\DocTocRenderer $toc */ $toc ?>
<?= /** @var \Icinga\Module\Doc\Renderer\DocTocRenderer $toc */ $toc ?>
</div>

View File

@ -1,7 +1,7 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
/** @type $this \Icinga\Application\Modules\Module */
/** @var $this \Icinga\Application\Modules\Module */
$section = $this->menuSection($this->translate('Documentation'), array(
'title' => 'Documentation',

View File

@ -19,7 +19,7 @@ class DocIterator implements Countable, IteratorAggregate
/**
* Ordered files
*
* @type array
* @var array
*/
protected $fileInfo;

View File

@ -18,14 +18,14 @@ class DocParser
/**
* Path to the documentation
*
* @type string
* @var string
*/
protected $path;
/**
* Iterator over documentation files
*
* @type DocIterator
* @var DocIterator
*/
protected $docIterator;
@ -130,7 +130,7 @@ class DocParser
$tree = new SimpleTree();
$stack = new SplStack();
foreach ($this->docIterator as $fileInfo) {
/** @type $fileInfo \SplFileInfo */
/** @var $fileInfo \SplFileInfo */
$file = $fileInfo->openFile();
$lastLine = null;
foreach ($file as $line) {
@ -143,7 +143,7 @@ class DocParser
if ($id === null) {
$path = array();
foreach ($stack as $section) {
/** @type $section DocSection */
/** @var $section DocSection */
$path[] = $section->getTitle();
}
$path[] = $title;

View File

@ -13,35 +13,35 @@ class DocSection extends TreeNode
/**
* Chapter the section belongs to
*
* @type DocSection
* @var DocSection
*/
protected $chapter;
/**
* Content of the section
*
* @type array
* @var array
*/
protected $content = array();
/**
* Header level
*
* @type int
* @var int
*/
protected $level;
/**
* Whether to instruct search engines to not index the link to the section
*
* @type bool
* @var bool
*/
protected $noFollow;
/**
* Title of the section
*
* @type string
* @var string
*/
protected $title;

View File

@ -19,7 +19,7 @@ class DocSectionFilterIterator extends RecursiveFilterIterator implements Counta
/**
* Chapter to filter for
*
* @type string
* @var string
*/
protected $chapter;
@ -44,7 +44,7 @@ class DocSectionFilterIterator extends RecursiveFilterIterator implements Counta
public function accept()
{
$section = $this->current();
/** @type \Icinga\Module\Doc\DocSection $section */
/** @var \Icinga\Module\Doc\DocSection $section */
if ($section->getChapter()->getId() === $this->chapter) {
return true;
}

View File

@ -16,21 +16,21 @@ abstract class DocRenderer extends RecursiveIteratorIterator
/**
* URL to replace links with
*
* @type string
* @var string
*/
protected $url;
/**
* Additional URL parameters
*
* @type array
* @var array
*/
protected $urlParams = array();
/**
* View
*
* @type View|null
* @var View|null
*/
protected $view;

View File

@ -19,7 +19,7 @@ class DocSearchRenderer extends DocRenderer
/**
* The content to render
*
* @type array
* @var array
*/
protected $content = array();
@ -105,7 +105,7 @@ class DocSearchRenderer extends DocRenderer
$path,
array('highlight-search' => $this->getInnerIterator()->getSearch()->getInput())
);
/** @type \Icinga\Web\Url $url */
/** @var \Icinga\Web\Url $url */
$url->setAnchor($this->encodeAnchor($section->getId()));
$urlAttributes = array(
'data-base-target' => '_next',

View File

@ -26,28 +26,28 @@ class DocSectionRenderer extends DocRenderer
/**
* Content to render
*
* @type array
* @var array
*/
protected $content = array();
/**
* Search criteria to highlight
*
* @type string
* @var string
*/
protected $highlightSearch;
/**
* Parsedown instance
*
* @type Parsedown
* @var Parsedown
*/
protected $parsedown;
/**
* Documentation tree
*
* @type SimpleTree
* @var SimpleTree
*/
protected $tree;
@ -169,7 +169,7 @@ class DocSectionRenderer extends DocRenderer
$doc->loadHTML($match[0]);
$xpath = new DOMXPath($doc);
$blockquote = $xpath->query('//blockquote[1]')->item(0);
/** @type \DOMElement $blockquote */
/** @var \DOMElement $blockquote */
if (strtolower(substr(trim($blockquote->nodeValue), 0, 5)) === 'note:') {
$blockquote->setAttribute('class', 'note');
}
@ -189,7 +189,7 @@ class DocSectionRenderer extends DocRenderer
$doc->loadHTML($match[0]);
$xpath = new DOMXPath($doc);
$img = $xpath->query('//img[1]')->item(0);
/** @type \DOMElement $img */
/** @var \DOMElement $img */
$img->setAttribute('src', Url::fromPath($img->getAttribute('src'))->getAbsoluteUrl());
return substr_replace($doc->saveXML($img), '', -2, 1); // Replace '/>' with '>'
}
@ -206,7 +206,7 @@ class DocSectionRenderer extends DocRenderer
if (($section = $this->tree->getNode($this->decodeAnchor($match['fragment']))) === null) {
return $match[0];
}
/** @type \Icinga\Module\Doc\DocSection $section */
/** @var \Icinga\Module\Doc\DocSection $section */
$path = $this->getView()->getHelper('Url')->url(
array_merge(
$this->urlParams,
@ -219,7 +219,7 @@ class DocSectionRenderer extends DocRenderer
false
);
$url = $this->getView()->url($path);
/** @type \Icinga\Web\Url $url */
/** @var \Icinga\Web\Url $url */
$url->setAnchor($this->encodeAnchor($section->getId()));
return sprintf(
'<a %s%shref="%s"',

View File

@ -19,7 +19,7 @@ class DocTocRenderer extends DocRenderer
/**
* Content to render
*
* @type array
* @var array
*/
protected $content = array();
@ -85,7 +85,7 @@ class DocTocRenderer extends DocRenderer
false
);
$url = $view->url($path);
/** @type \Icinga\Web\Url $url */
/** @var \Icinga\Web\Url $url */
$url->setAnchor($this->encodeAnchor($section->getId()));
$urlAttributes = array(
'data-base-target' => '_next',

View File

@ -11,14 +11,14 @@ class DocSearch
/**
* Search string
*
* @type string
* @var string
*/
protected $input;
/**
* Search criteria
*
* @type array
* @var array
*/
protected $search;

View File

@ -19,14 +19,14 @@ class DocSearchIterator extends RecursiveFilterIterator
/**
* Search criteria
*
* @type DocSearch
* @var DocSearch
*/
protected $search;
/**
* Current search matches
*
* @type DocSearchMatch[]|null
* @var DocSearchMatch[]|null
*/
protected $matches;
@ -51,7 +51,7 @@ class DocSearchIterator extends RecursiveFilterIterator
public function accept()
{
$section = $this->current();
/** @type $section \Icinga\Module\Doc\DocSection */
/** @var $section \Icinga\Module\Doc\DocSection */
$matches = array();
if (($match = $this->search->search($section->getTitle())) !== null) {
$matches[] = $match->setMatchType(DocSearchMatch::MATCH_HEADER);

View File

@ -15,56 +15,56 @@ class DocSearchMatch
/**
* CSS class for highlighting matches
*
* @type string
* @var string
*/
const HIGHLIGHT_CSS_CLASS = 'search-highlight';
/**
* Header match
*
* @type int
* @var int
*/
const MATCH_HEADER = 1;
/**
* Content match
*
* @type int
* @var int
*/
const MATCH_CONTENT = 2;
/**
* Line
*
* @type string
* @var string
*/
protected $line;
/**
* Line number
*
* @type int
* @var int
*/
protected $lineno;
/**
* Type of the match
*
* @type int
* @var int
*/
protected $matchType;
/**
* Matches
*
* @type array
* @var array
*/
protected $matches = array();
/**
* View
*
* @type View|null
* @var View|null
*/
protected $view;

View File

@ -17,7 +17,7 @@ class BackendConfigForm extends ConfigForm
/**
* The available monitoring backend resources split by type
*
* @type array
* @var array
*/
protected $resources;

View File

@ -1,6 +1,6 @@
<?php
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
if ($object->getType() === $object::TYPE_HOST) {
$isService = false;

View File

@ -2,7 +2,7 @@
<th><?= $this->translate('Comments'); ?></th>
<td>
<?php if ($this->hasPermission('monitoring/command/comment/add')) {
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
if ($object->getType() === $object::TYPE_HOST) {
echo $this->qlink(
$this->translate('Add comment'),

View File

@ -2,7 +2,7 @@
<th><?= $this->translate('Downtimes'); ?></th>
<td>
<?php if ($this->hasPermission('monitoring/command/downtime/schedule')) {
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
if ($object->getType() === $object::TYPE_HOST) {
echo $this->qlink(
$this->translate('Schedule downtime'),

View File

@ -1,7 +1,7 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
/** @type $this \Icinga\Application\Modules\Module */
/** @var $this \Icinga\Application\Modules\Module */
$this->providePermission(
'monitoring/command/*',

View File

@ -120,7 +120,7 @@ abstract class MonitoredObject implements Filterable
/**
* Filter
*
* @type Filter
* @var Filter
*/
protected $filter;