diff --git a/library/Icinga/Application/Config.php b/library/Icinga/Application/Config.php index a6bcb8c66..006c40fbc 100644 --- a/library/Icinga/Application/Config.php +++ b/library/Icinga/Application/Config.php @@ -122,7 +122,7 @@ class Config implements Countable, Iterator, Selectable * * @return int */ - public function count() + public function count(): int { return $this->select()->count(); } @@ -130,11 +130,11 @@ class Config implements Countable, Iterator, Selectable /** * Reset the current position of the internal config object * - * @return ConfigObject + * @return void */ - public function rewind() + public function rewind(): void { - return $this->config->rewind(); + $this->config->rewind(); } /** @@ -142,7 +142,7 @@ class Config implements Countable, Iterator, Selectable * * @return ConfigObject */ - public function current() + public function current(): ConfigObject { return $this->config->current(); } @@ -152,7 +152,7 @@ class Config implements Countable, Iterator, Selectable * * @return bool */ - public function valid() + public function valid(): bool { return $this->config->valid(); } @@ -162,7 +162,7 @@ class Config implements Countable, Iterator, Selectable * * @return string */ - public function key() + public function key(): string { return $this->config->key(); } @@ -170,11 +170,11 @@ class Config implements Countable, Iterator, Selectable /** * Advance the position of the current iteration and return the new section * - * @return ConfigObject + * @return void */ - public function next() + public function next(): void { - return $this->config->next(); + $this->config->next(); } /** diff --git a/library/Icinga/Application/Hook/Ticket/TicketPattern.php b/library/Icinga/Application/Hook/Ticket/TicketPattern.php index 8116ca6be..e37fcc1f8 100644 --- a/library/Icinga/Application/Hook/Ticket/TicketPattern.php +++ b/library/Icinga/Application/Hook/Ticket/TicketPattern.php @@ -34,26 +34,17 @@ class TicketPattern implements ArrayAccess */ protected $pattern; - /** - * {@inheritdoc} - */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->match[$offset]); } - /** - * {@inheritdoc} - */ - public function offsetGet($offset) + public function offsetGet($offset): ?string { return array_key_exists($offset, $this->match) ? $this->match[$offset] : null; } - /** - * {@inheritdoc} - */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if ($offset === null) { $this->match[] = $value; @@ -62,10 +53,7 @@ class TicketPattern implements ArrayAccess } } - /** - * {@inheritdoc} - */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->match[$offset]); } diff --git a/library/Icinga/Application/Libraries.php b/library/Icinga/Application/Libraries.php index f250210f8..63662fde9 100644 --- a/library/Icinga/Application/Libraries.php +++ b/library/Icinga/Application/Libraries.php @@ -6,6 +6,7 @@ namespace Icinga\Application; use ArrayIterator; use IteratorAggregate; use Icinga\Application\Libraries\Library; +use Traversable; class Libraries implements IteratorAggregate { @@ -17,7 +18,7 @@ class Libraries implements IteratorAggregate * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->libraries); } diff --git a/library/Icinga/Authentication/AuthChain.php b/library/Icinga/Authentication/AuthChain.php index cdae75adb..39468e3cf 100644 --- a/library/Icinga/Authentication/AuthChain.php +++ b/library/Icinga/Authentication/AuthChain.php @@ -184,12 +184,12 @@ class AuthChain implements Authenticatable, Iterator /** * Rewind the chain * - * @return ConfigObject + * @return void */ - public function rewind() + public function rewind(): void { $this->currentBackend = null; - return $this->config->rewind(); + $this->config->rewind(); } /** @@ -197,7 +197,7 @@ class AuthChain implements Authenticatable, Iterator * * @return UserBackendInterface */ - public function current() + public function current(): UserBackendInterface { return $this->currentBackend; } @@ -207,7 +207,7 @@ class AuthChain implements Authenticatable, Iterator * * @return string */ - public function key() + public function key(): string { return $this->config->key(); } @@ -215,11 +215,11 @@ class AuthChain implements Authenticatable, Iterator /** * Move forward to the next user backend config * - * @return ConfigObject + * @return void */ - public function next() + public function next(): void { - return $this->config->next(); + $this->config->next(); } /** @@ -228,7 +228,7 @@ class AuthChain implements Authenticatable, Iterator * * @return bool */ - public function valid() + public function valid(): bool { if (! $this->config->valid()) { // Stop when there are no more backends to check diff --git a/library/Icinga/Data/ConfigObject.php b/library/Icinga/Data/ConfigObject.php index 1cbc6873a..2ab5522ab 100644 --- a/library/Icinga/Data/ConfigObject.php +++ b/library/Icinga/Data/ConfigObject.php @@ -50,11 +50,11 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess /** * Reset the current position of $this->data * - * @return mixed + * @return void */ - public function rewind() + public function rewind(): void { - return reset($this->data); + reset($this->data); } /** @@ -62,6 +62,7 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess * * @return mixed */ + #[\ReturnTypeWillChange] public function current() { return current($this->data); @@ -72,7 +73,7 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess * * @return bool */ - public function valid() + public function valid(): bool { return key($this->data) !== null; } @@ -80,9 +81,9 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess /** * Return the section's or property's name of the current iteration * - * @return mixed + * @return string */ - public function key() + public function key(): string { return key($this->data); } @@ -90,11 +91,11 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess /** * Advance the position of the current iteration and return the new section's or property's value * - * @return mixed + * @return void */ - public function next() + public function next(): void { - return next($this->data); + next($this->data); } /** @@ -153,7 +154,7 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess * * @return bool */ - public function offsetExists($key) + public function offsetExists($key): bool { return isset($this->$key); } @@ -163,8 +164,9 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess * * @param string $key The name of the property or section * - * @return mixed|NULL The value or NULL in case $key does not exist + * @return ?mixed The value or NULL in case $key does not exist */ + #[\ReturnTypeWillChange] public function offsetGet($key) { return $this->get($key); @@ -178,7 +180,7 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess * * @throws ProgrammingError If the key is null */ - public function offsetSet($key, $value) + public function offsetSet($key, $value): void { if ($key === null) { throw new ProgrammingError('Appending values without an explicit key is not supported'); @@ -192,7 +194,7 @@ class ConfigObject extends ArrayDatasource implements Iterator, ArrayAccess * * @param string $key The property or section to remove */ - public function offsetUnset($key) + public function offsetUnset($key): void { unset($this->$key); } diff --git a/library/Icinga/Data/Db/DbQuery.php b/library/Icinga/Data/Db/DbQuery.php index 8b3ee082d..457308093 100644 --- a/library/Icinga/Data/Db/DbQuery.php +++ b/library/Icinga/Data/Db/DbQuery.php @@ -410,7 +410,7 @@ class DbQuery extends SimpleQuery * * @return int */ - public function count() + public function count(): int { if ($this->count === null) { $this->count = parent::count(); diff --git a/library/Icinga/Data/SimpleQuery.php b/library/Icinga/Data/SimpleQuery.php index e4b9f1f9b..7e854eb64 100644 --- a/library/Icinga/Data/SimpleQuery.php +++ b/library/Icinga/Data/SimpleQuery.php @@ -165,7 +165,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator /** * Start or rewind the iteration */ - public function rewind() + public function rewind(): void { if ($this->iterator === null) { $iterator = $this->ds->query($this); @@ -184,8 +184,9 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator /** * Fetch and return the current row of this query's result * - * @return object + * @return mixed */ + #[\ReturnTypeWillChange] public function current() { return $this->iterator->current(); @@ -196,7 +197,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator * * @return bool */ - public function valid() + public function valid(): bool { $valid = $this->iterator->valid(); if ($valid && $this->peekAhead && $this->hasLimit() && $this->iteratorPosition + 1 === $this->getLimit()) { @@ -221,6 +222,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator * * @return mixed */ + #[\ReturnTypeWillChange] public function key() { return $this->iterator->key(); @@ -229,7 +231,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator /** * Advance to the next row of this query's result */ - public function next() + public function next(): void { $this->iterator->next(); $this->iteratorPosition += 1; @@ -648,7 +650,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator * * @return int */ - public function count() + public function count(): int { $query = clone $this; $query->limit(0, 0); diff --git a/library/Icinga/Data/Tree/SimpleTree.php b/library/Icinga/Data/Tree/SimpleTree.php index d4ffc1567..e89f58929 100644 --- a/library/Icinga/Data/Tree/SimpleTree.php +++ b/library/Icinga/Data/Tree/SimpleTree.php @@ -5,6 +5,7 @@ namespace Icinga\Data\Tree; use IteratorAggregate; use LogicException; +use Traversable; /** * A simple tree @@ -80,10 +81,9 @@ class SimpleTree implements IteratorAggregate } /** - * {@inheritdoc} * @return TreeNodeIterator */ - public function getIterator() + public function getIterator(): Traversable { return new TreeNodeIterator($this->sentinel); } diff --git a/library/Icinga/Data/Tree/TreeNodeIterator.php b/library/Icinga/Data/Tree/TreeNodeIterator.php index 839b1a1d0..cffc9f451 100644 --- a/library/Icinga/Data/Tree/TreeNodeIterator.php +++ b/library/Icinga/Data/Tree/TreeNodeIterator.php @@ -28,59 +28,37 @@ class TreeNodeIterator implements RecursiveIterator $this->children = new ArrayIterator($node->getChildren()); } - /** - * {@inheritdoc} - */ - public function current() + public function current(): TreeNode { return $this->children->current(); } - /** - * {@inheritdoc} - */ - public function key() + public function key(): int { return $this->children->key(); } - /** - * {@inheritdoc} - */ - public function next() + public function next(): void { $this->children->next(); } - /** - * {@inheritdoc} - */ - public function rewind() + public function rewind(): void { $this->children->rewind(); } - /** - * {@inheritdoc} - */ - public function valid() + public function valid(): bool { return $this->children->valid(); } - /** - * {@inheritdoc} - */ - public function hasChildren() + public function hasChildren(): bool { return $this->current()->hasChildren(); } - /** - * {@inheritdoc} - * @return TreeNodeIterator - */ - public function getChildren() + public function getChildren(): TreeNodeIterator { return new static($this->current()); } diff --git a/library/Icinga/File/Storage/LocalFileStorage.php b/library/Icinga/File/Storage/LocalFileStorage.php index e3ed5d679..e38167e5a 100644 --- a/library/Icinga/File/Storage/LocalFileStorage.php +++ b/library/Icinga/File/Storage/LocalFileStorage.php @@ -11,6 +11,7 @@ use Icinga\Exception\NotWritableError; use InvalidArgumentException; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; +use Traversable; use UnexpectedValueException; /** @@ -35,7 +36,7 @@ class LocalFileStorage implements StorageInterface $this->baseDir = rtrim($baseDir, DIRECTORY_SEPARATOR); } - public function getIterator() + public function getIterator(): Traversable { try { return new RecursiveIteratorIterator( diff --git a/library/Icinga/File/Storage/StorageInterface.php b/library/Icinga/File/Storage/StorageInterface.php index cdcec777a..f416b009d 100644 --- a/library/Icinga/File/Storage/StorageInterface.php +++ b/library/Icinga/File/Storage/StorageInterface.php @@ -19,7 +19,7 @@ interface StorageInterface extends IteratorAggregate * * @throws NotReadableError If the file list can't be read */ - public function getIterator(); + public function getIterator(): Traversable; /** * Return whether the given file exists diff --git a/library/Icinga/Protocol/File/FileIterator.php b/library/Icinga/Protocol/File/FileIterator.php index b43b76075..64b66008c 100644 --- a/library/Icinga/Protocol/File/FileIterator.php +++ b/library/Icinga/Protocol/File/FileIterator.php @@ -44,7 +44,7 @@ class FileIterator extends EnumeratingFilterIterator * * @return array */ - public function current() + public function current(): array { return $this->currentData; } @@ -56,7 +56,7 @@ class FileIterator extends EnumeratingFilterIterator * * @throws FileReaderException If PHP failed parsing the PCRE pattern */ - public function accept() + public function accept(): bool { $data = array(); $matched = preg_match( diff --git a/library/Icinga/Protocol/File/FileReader.php b/library/Icinga/Protocol/File/FileReader.php index da6bb2886..d16038741 100644 --- a/library/Icinga/Protocol/File/FileReader.php +++ b/library/Icinga/Protocol/File/FileReader.php @@ -89,7 +89,7 @@ class FileReader implements Selectable, Countable * * @return int */ - public function count() + public function count(): int { if ($this->count === null) { $this->count = iterator_count($this->iterate()); diff --git a/library/Icinga/Protocol/File/LogFileIterator.php b/library/Icinga/Protocol/File/LogFileIterator.php index 61cfc35cc..67a4d99d1 100644 --- a/library/Icinga/Protocol/File/LogFileIterator.php +++ b/library/Icinga/Protocol/File/LogFileIterator.php @@ -30,7 +30,7 @@ class LogFileIterator implements Iterator /** * Value for static::current() * - * @var string + * @var array */ protected $current; @@ -68,40 +68,31 @@ class LogFileIterator implements Iterator $this->fields = $fields; } - public function rewind() + public function rewind(): void { $this->file->rewind(); $this->index = 0; $this->nextMessage(); } - public function next() + public function next(): void { $this->file->next(); ++$this->index; $this->nextMessage(); } - /** - * @return string - */ - public function current() + public function current(): array { return $this->current; } - /** - * @return int - */ - public function key() + public function key(): int { return $this->index; } - /** - * @return boolean - */ - public function valid() + public function valid(): bool { return $this->valid; } diff --git a/library/Icinga/Repository/RepositoryQuery.php b/library/Icinga/Repository/RepositoryQuery.php index 6e4297180..31395324c 100644 --- a/library/Icinga/Repository/RepositoryQuery.php +++ b/library/Icinga/Repository/RepositoryQuery.php @@ -690,7 +690,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera * * @return int */ - public function count() + public function count(): int { return $this->query->count(); } @@ -708,7 +708,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera /** * Start or rewind the iteration */ - public function rewind() + public function rewind(): void { if ($this->iterator === null) { if (! $this->hasOrder()) { @@ -735,8 +735,9 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera /** * Fetch and return the current row of this query's result * - * @return object + * @return mixed */ + #[\ReturnTypeWillChange] public function current() { $row = $this->iterator->current(); @@ -763,7 +764,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera * * @return bool */ - public function valid() + public function valid(): bool { if (! $this->iterator->valid()) { Benchmark::measure('Query result iteration finished'); @@ -778,6 +779,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera * * @return mixed */ + #[\ReturnTypeWillChange] public function key() { return $this->iterator->key(); @@ -786,7 +788,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera /** * Advance to the next row of this query's result */ - public function next() + public function next(): void { $this->iterator->next(); } diff --git a/library/Icinga/User/Preferences.php b/library/Icinga/User/Preferences.php index 03a87f368..b09462bc5 100644 --- a/library/Icinga/User/Preferences.php +++ b/library/Icinga/User/Preferences.php @@ -49,7 +49,7 @@ class Preferences implements Countable * * @return int The number of preferences */ - public function count() + public function count(): int { return count($this->preferences); } diff --git a/library/Icinga/Util/DirectoryIterator.php b/library/Icinga/Util/DirectoryIterator.php index 60368733e..a2bed1c27 100644 --- a/library/Icinga/Util/DirectoryIterator.php +++ b/library/Icinga/Util/DirectoryIterator.php @@ -50,7 +50,7 @@ class DirectoryIterator implements RecursiveIterator /** * Current key * - * @var string + * @var string|false */ private $key; @@ -122,35 +122,23 @@ class DirectoryIterator implements RecursiveIterator return is_dir($path) && is_readable($path); } - /** - * {@inheritdoc} - */ - public function hasChildren() + public function hasChildren(): bool { return static::isReadable($this->current); } - /** - * {@inheritdoc} - */ - public function getChildren() + public function getChildren(): DirectoryIterator { return new static($this->current, $this->extension, $this->flags); } - - /** - * {@inheritdoc} - */ + #[\ReturnTypeWillChange] public function current() { return $this->current; } - /** - * {@inheritdoc} - */ - public function next() + public function next(): void { do { $this->files->next(); @@ -200,26 +188,18 @@ class DirectoryIterator implements RecursiveIterator $this->key = $file; } - /** - * {@inheritdoc} - */ + #[\ReturnTypeWillChange] public function key() { return $this->key; } - /** - * {@inheritdoc} - */ - public function valid() + public function valid(): bool { return $this->current !== false; } - /** - * {@inheritdoc} - */ - public function rewind() + public function rewind(): void { if ($this->files === null) { $files = scandir($this->path); diff --git a/library/Icinga/Util/EnumeratingFilterIterator.php b/library/Icinga/Util/EnumeratingFilterIterator.php index bfb2abb94..065996105 100644 --- a/library/Icinga/Util/EnumeratingFilterIterator.php +++ b/library/Icinga/Util/EnumeratingFilterIterator.php @@ -17,19 +17,13 @@ abstract class EnumeratingFilterIterator extends FilterIterator */ private $index; - /** - * @return void - */ - public function rewind() + public function rewind(): void { parent::rewind(); $this->index = 0; } - /** - * @return int - */ - public function key() + public function key(): int { return $this->index++; } diff --git a/library/Icinga/Util/File.php b/library/Icinga/Util/File.php index 1dde440e9..dad332aea 100644 --- a/library/Icinga/Util/File.php +++ b/library/Icinga/Util/File.php @@ -114,9 +114,7 @@ class File extends SplFileObject } } - /** - * @see SplFileObject::fwrite() - */ + #[\ReturnTypeWillChange] public function fwrite($str, $length = null) { $this->assertOpenForWriting(); @@ -126,10 +124,7 @@ class File extends SplFileObject return $retVal; } - /** - * @see SplFileObject::ftruncate() - */ - public function ftruncate($size) + public function ftruncate($size): bool { $this->assertOpenForWriting(); $this->setupErrorHandler(); @@ -138,9 +133,7 @@ class File extends SplFileObject return $retVal; } - /** - * @see SplFileObject::ftell() - */ + #[\ReturnTypeWillChange] public function ftell() { $this->setupErrorHandler(); @@ -149,10 +142,7 @@ class File extends SplFileObject return $retVal; } - /** - * @see SplFileObject::flock() - */ - public function flock($operation, &$wouldblock = null) + public function flock($operation, &$wouldblock = null): bool { $this->setupErrorHandler(); $retVal = parent::flock($operation, $wouldblock); @@ -160,9 +150,7 @@ class File extends SplFileObject return $retVal; } - /** - * @see SplFileObject::fgetc() - */ + #[\ReturnTypeWillChange] public function fgetc() { $this->setupErrorHandler(); @@ -171,10 +159,7 @@ class File extends SplFileObject return $retVal; } - /** - * @see SplFileObject::fflush() - */ - public function fflush() + public function fflush(): bool { $this->setupErrorHandler(); $retVal = parent::fflush(); diff --git a/library/Icinga/Web/CookieSet.php b/library/Icinga/Web/CookieSet.php index cbc5a430b..019be292b 100644 --- a/library/Icinga/Web/CookieSet.php +++ b/library/Icinga/Web/CookieSet.php @@ -5,6 +5,7 @@ namespace Icinga\Web; use ArrayIterator; use IteratorAggregate; +use Traversable; /** * Maintain a set of cookies @@ -23,7 +24,7 @@ class CookieSet implements IteratorAggregate * * @return ArrayIterator An iterator for traversing the cookies in this set */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->cookies); } diff --git a/library/Icinga/Web/Dom/DomNodeIterator.php b/library/Icinga/Web/Dom/DomNodeIterator.php index b6408751e..1ea20b8e0 100644 --- a/library/Icinga/Web/Dom/DomNodeIterator.php +++ b/library/Icinga/Web/Dom/DomNodeIterator.php @@ -47,59 +47,37 @@ class DomNodeIterator implements RecursiveIterator $this->children = new IteratorIterator($node->childNodes); } - /** - * {@inheritdoc} - */ - public function current() + public function current(): ?DOMNode { return $this->children->current(); } - /** - * {@inheritdoc} - */ - public function key() + public function key(): int { return $this->children->key(); } - /** - * {@inheritdoc} - */ - public function next() + public function next(): void { $this->children->next(); } - /** - * {@inheritdoc} - */ - public function rewind() + public function rewind(): void { $this->children->rewind(); } - /** - * {@inheritdoc} - */ - public function valid() + public function valid(): bool { return $this->children->valid(); } - /** - * {@inheritdoc} - */ - public function hasChildren() + public function hasChildren(): bool { return $this->current()->hasChildNodes(); } - /** - * {@inheritdoc} - * @return DomNodeIterator - */ - public function getChildren() + public function getChildren(): DomNodeIterator { return new static($this->current()); } diff --git a/library/Icinga/Web/Navigation/Navigation.php b/library/Icinga/Web/Navigation/Navigation.php index 423c51894..8cf3f6845 100644 --- a/library/Icinga/Web/Navigation/Navigation.php +++ b/library/Icinga/Web/Navigation/Navigation.php @@ -67,50 +67,32 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate */ protected $layout; - /** - * {@inheritdoc} - */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->items[$offset]); } - /** - * {@inheritdoc} - */ - public function offsetGet($offset) + public function offsetGet($offset): ?NavigationItem { - return isset($this->items[$offset]) ? $this->items[$offset] : null; + return $this->items[$offset] ?? null; } - /** - * {@inheritdoc} - */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->items[$offset] = $value; } - /** - * {@inheritdoc} - */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->items[$offset]); } - /** - * {@inheritdoc} - */ - public function count() + public function count(): int { return count($this->items); } - /** - * {@inheritdoc} - */ - public function getIterator() + public function getIterator(): Traversable { $this->order(); return new ArrayIterator($this->items); diff --git a/library/Icinga/Web/Navigation/NavigationItem.php b/library/Icinga/Web/Navigation/NavigationItem.php index 27f465c93..e262f5af0 100644 --- a/library/Icinga/Web/Navigation/NavigationItem.php +++ b/library/Icinga/Web/Navigation/NavigationItem.php @@ -13,6 +13,7 @@ use Icinga\Exception\IcingaException; use Icinga\Exception\ProgrammingError; use Icinga\Web\Navigation\Renderer\NavigationItemRenderer; use Icinga\Web\Url; +use Traversable; /** * A navigation item @@ -171,9 +172,9 @@ class NavigationItem implements IteratorAggregate } /** - * {@inheritdoc} + * @return Navigation */ - public function getIterator() + public function getIterator(): Traversable { return $this->getChildren(); } diff --git a/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php b/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php index e2fb40b4f..00c0f9af2 100644 --- a/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php +++ b/library/Icinga/Web/Navigation/Renderer/NavigationRenderer.php @@ -165,52 +165,32 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa return $this; } - /** - * {@inheritdoc} - */ - public function getChildren() + public function getChildren(): NavigationRenderer { return new static($this->current()->getChildren(), $this->skipOuterElement); } - /** - * {@inheritdoc} - */ - public function hasChildren() + public function hasChildren(): bool { return $this->current()->hasChildren(); } - /** - * {@inheritdoc} - * - * @return NavigationItem - */ - public function current() + public function current(): NavigationItem { return $this->iterator->current(); } - /** - * {@inheritdoc} - */ - public function key() + public function key(): int { return $this->iterator->key(); } - /** - * {@inheritdoc} - */ - public function next() + public function next(): void { $this->iterator->next(); } - /** - * {@inheritdoc} - */ - public function rewind() + public function rewind(): void { $this->iterator->rewind(); if (! $this->skipOuterElement) { @@ -218,10 +198,7 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa } } - /** - * {@inheritdoc} - */ - public function valid() + public function valid(): bool { $valid = $this->iterator->valid(); if (! $this->skipOuterElement && !$valid) { diff --git a/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php b/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php index 562ed37d6..315c2aa4d 100644 --- a/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php +++ b/library/Icinga/Web/Navigation/Renderer/RecursiveNavigationRenderer.php @@ -121,34 +121,22 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N return $this->getInnerIterator()->getHeading(); } - /** - * {@inheritdoc} - */ - public function beginIteration() + public function beginIteration(): void { $this->content[] = $this->getInnerIterator()->beginMarkup(); } - /** - * {@inheritdoc} - */ - public function endIteration() + public function endIteration(): void { $this->content[] = $this->getInnerIterator()->endMarkup(); } - /** - * {@inheritdoc} - */ - public function beginChildren() + public function beginChildren(): void { $this->content[] = $this->getInnerIterator()->beginChildrenMarkup($this->getDepth() + 1); } - /** - * {@inheritdoc} - */ - public function endChildren() + public function endChildren(): void { $this->content[] = $this->getInnerIterator()->endChildrenMarkup(); $this->content[] = $this->getInnerIterator()->endItemMarkup(); diff --git a/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php b/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php index 36d11ec83..6f103e5ab 100644 --- a/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php +++ b/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php @@ -73,7 +73,7 @@ class QueryAdapter implements Zend_Paginator_Adapter_Interface * * @return int */ - public function count() + public function count(): int { if ($this->count === null) { $this->count = $this->query->count(); diff --git a/library/Icinga/Web/Session/SessionNamespace.php b/library/Icinga/Web/Session/SessionNamespace.php index 19083c05f..1c9c13f7a 100644 --- a/library/Icinga/Web/Session/SessionNamespace.php +++ b/library/Icinga/Web/Session/SessionNamespace.php @@ -7,6 +7,7 @@ use Exception; use ArrayIterator; use Icinga\Exception\IcingaException; use IteratorAggregate; +use Traversable; /** * Container for session values @@ -32,7 +33,7 @@ class SessionNamespace implements IteratorAggregate * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->getAll()); } diff --git a/library/Icinga/Web/Widget/Tabs.php b/library/Icinga/Web/Widget/Tabs.php index f490302a8..5daf86afb 100644 --- a/library/Icinga/Web/Widget/Tabs.php +++ b/library/Icinga/Web/Widget/Tabs.php @@ -403,7 +403,7 @@ EOT; * * @see Countable */ - public function count() + public function count(): int { return count($this->tabs); } diff --git a/library/vendor/Zend/Controller/Action/HelperBroker/PriorityStack.php b/library/vendor/Zend/Controller/Action/HelperBroker/PriorityStack.php index 8f5193f21..c957b10d5 100644 --- a/library/vendor/Zend/Controller/Action/HelperBroker/PriorityStack.php +++ b/library/vendor/Zend/Controller/Action/HelperBroker/PriorityStack.php @@ -64,11 +64,10 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre * Magic property overloading for unsetting if helper is exists by name * * @param string $helperName The helper name - * @return Zend_Controller_Action_Helper_Abstract */ public function __unset($helperName) { - return $this->offsetUnset($helperName); + $this->offsetUnset($helperName); } /** @@ -86,9 +85,9 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre /** * Return something iterable * - * @return array + * @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayObject($this->_helpersByPriority); } @@ -97,9 +96,9 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre * offsetExists() * * @param int|string $priorityOrHelperName - * @return Zend_Controller_Action_HelperBroker_PriorityStack + * @return bool */ - public function offsetExists($priorityOrHelperName) + public function offsetExists($priorityOrHelperName): bool { if (is_string($priorityOrHelperName)) { return array_key_exists($priorityOrHelperName, $this->_helpersByNameRef); @@ -112,9 +111,9 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre * offsetGet() * * @param int|string $priorityOrHelperName - * @return Zend_Controller_Action_HelperBroker_PriorityStack + * @return Zend_Controller_Action_Helper_Abstract */ - public function offsetGet($priorityOrHelperName) + public function offsetGet($priorityOrHelperName): Zend_Controller_Action_Helper_Abstract { if (!$this->offsetExists($priorityOrHelperName)) { throw new Zend_Controller_Action_Exception('A helper with priority ' . $priorityOrHelperName . ' does not exist.'); @@ -132,9 +131,8 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre * * @param int $priority * @param Zend_Controller_Action_Helper_Abstract $helper - * @return Zend_Controller_Action_HelperBroker_PriorityStack */ - public function offsetSet($priority, $helper) + public function offsetSet($priority, $helper): void { $priority = (int) $priority; @@ -161,16 +159,14 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre } krsort($this->_helpersByPriority); // always make sure priority and LIFO are both enforced - return $this; } /** * offsetUnset() * * @param int|string $priorityOrHelperName Priority integer or the helper name - * @return Zend_Controller_Action_HelperBroker_PriorityStack */ - public function offsetUnset($priorityOrHelperName) + public function offsetUnset($priorityOrHelperName): void { if (!$this->offsetExists($priorityOrHelperName)) { throw new Zend_Controller_Action_Exception('A helper with priority or name ' . $priorityOrHelperName . ' does not exist.'); @@ -187,7 +183,6 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre unset($this->_helpersByNameRef[$helperName]); unset($this->_helpersByPriority[$priority]); - return $this; } /** @@ -195,7 +190,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre * * @return int */ - public function count() + public function count(): int { return count($this->_helpersByPriority); } diff --git a/library/vendor/Zend/Db/Statement/Pdo.php b/library/vendor/Zend/Db/Statement/Pdo.php index 5b63a17f0..cf0150a59 100644 --- a/library/vendor/Zend/Db/Statement/Pdo.php +++ b/library/vendor/Zend/Db/Statement/Pdo.php @@ -252,7 +252,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega * * @return IteratorIterator */ - public function getIterator() + public function getIterator(): Traversable { return new IteratorIterator($this->_stmt); } diff --git a/library/vendor/Zend/Form.php b/library/vendor/Zend/Form.php index bd373b41b..213ad301f 100644 --- a/library/vendor/Zend/Form.php +++ b/library/vendor/Zend/Form.php @@ -3246,6 +3246,7 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * @throws Zend_Form_Exception * @return Zend_Form_Element|Zend_Form_DisplayGroup|Zend_Form */ + #[\ReturnTypeWillChange] public function current() { $this->_sort(); @@ -3268,7 +3269,7 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * * @return string */ - public function key() + public function key(): string { $this->_sort(); return key($this->_order); @@ -3279,7 +3280,7 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * * @return void */ - public function next() + public function next(): void { $this->_sort(); next($this->_order); @@ -3290,7 +3291,7 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * * @return void */ - public function rewind() + public function rewind(): void { $this->_sort(); reset($this->_order); @@ -3301,7 +3302,7 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * * @return bool */ - public function valid() + public function valid(): bool { $this->_sort(); return (current($this->_order) !== false); @@ -3312,7 +3313,7 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * * @return int */ - public function count() + public function count(): int { return count($this->_order); } diff --git a/library/vendor/Zend/Form/DisplayGroup.php b/library/vendor/Zend/Form/DisplayGroup.php index 4adc4f32d..73a4cdee6 100644 --- a/library/vendor/Zend/Form/DisplayGroup.php +++ b/library/vendor/Zend/Form/DisplayGroup.php @@ -1036,7 +1036,7 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * * @return Zend_Form_Element */ - public function current() + public function current(): Zend_Form_Element { $this->_sort(); current($this->_elementOrder); @@ -1049,7 +1049,7 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * * @return string */ - public function key() + public function key(): string { $this->_sort(); return key($this->_elementOrder); @@ -1060,7 +1060,7 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * * @return void */ - public function next() + public function next(): void { $this->_sort(); next($this->_elementOrder); @@ -1071,7 +1071,7 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * * @return void */ - public function rewind() + public function rewind(): void { $this->_sort(); reset($this->_elementOrder); @@ -1082,7 +1082,7 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * * @return bool */ - public function valid() + public function valid(): bool { $this->_sort(); return (current($this->_elementOrder) !== false); @@ -1093,7 +1093,7 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * * @return int */ - public function count() + public function count(): int { return count($this->_elements); } diff --git a/library/vendor/Zend/Paginator.php b/library/vendor/Zend/Paginator.php index 49ffb9d1e..e96f88203 100644 --- a/library/vendor/Zend/Paginator.php +++ b/library/vendor/Zend/Paginator.php @@ -510,7 +510,7 @@ class Zend_Paginator implements Countable, IteratorAggregate * * @return integer */ - public function count() + public function count(): int { if (!$this->_pageCount) { $this->_pageCount = $this->_calculatePageCount(); @@ -812,7 +812,7 @@ class Zend_Paginator implements Countable, IteratorAggregate * * @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return $this->getCurrentItems(); } diff --git a/library/vendor/Zend/Paginator/SerializableLimitIterator.php b/library/vendor/Zend/Paginator/SerializableLimitIterator.php index 72c1399c9..504a342e3 100644 --- a/library/vendor/Zend/Paginator/SerializableLimitIterator.php +++ b/library/vendor/Zend/Paginator/SerializableLimitIterator.php @@ -86,6 +86,7 @@ class Zend_Paginator_SerializableLimitIterator extends LimitIterator implements * @param int $offset * @return mixed */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { $currentOffset = $this->key(); @@ -102,7 +103,7 @@ class Zend_Paginator_SerializableLimitIterator extends LimitIterator implements * @param int $offset * @param mixed $value */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { } @@ -111,7 +112,7 @@ class Zend_Paginator_SerializableLimitIterator extends LimitIterator implements * * @param int $offset */ - public function offsetExists($offset) + public function offsetExists($offset): bool { if ($offset > 0 && $offset < $this->_count) { try { @@ -136,7 +137,7 @@ class Zend_Paginator_SerializableLimitIterator extends LimitIterator implements * * @param int $offset */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { } } diff --git a/library/vendor/Zend/View/Helper/HeadLink.php b/library/vendor/Zend/View/Helper/HeadLink.php index 1a15d177d..3b1bcb7f1 100644 --- a/library/vendor/Zend/View/Helper/HeadLink.php +++ b/library/vendor/Zend/View/Helper/HeadLink.php @@ -230,7 +230,7 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S * @param array $value * @return void */ - public function offsetSet($index, $value) + public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { $e = new Zend_View_Exception('offsetSet() expects a data token; please use one of the custom offsetSet*() methods'); @@ -238,7 +238,7 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S throw $e; } - return $this->getContainer()->offsetSet($index, $value); + $this->getContainer()->offsetSet($index, $value); } /** diff --git a/library/vendor/Zend/View/Helper/HeadMeta.php b/library/vendor/Zend/View/Helper/HeadMeta.php index bb112559f..88cd3a7a2 100644 --- a/library/vendor/Zend/View/Helper/HeadMeta.php +++ b/library/vendor/Zend/View/Helper/HeadMeta.php @@ -168,7 +168,8 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S $item = $this->createData($type, $args[0], $args[1], $args[2]); if ('offsetSet' == $action) { - return $this->offsetSet($index, $item); + $this->offsetSet($index, $item); + return $this; } $this->$action($item); @@ -254,7 +255,7 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S * @return void * @throws Zend_View_Exception */ - public function offsetSet($index, $value) + public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetName() or offsetSetHttpEquiv()'); @@ -262,7 +263,7 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S throw $e; } - return $this->getContainer()->offsetSet($index, $value); + $this->getContainer()->offsetSet($index, $value); } /** @@ -272,7 +273,7 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S * @return void * @throws Zend_View_Exception */ - public function offsetUnset($index) + public function offsetUnset($index): void { if (!in_array($index, $this->getContainer()->getKeys())) { $e = new Zend_View_Exception('Invalid index passed to offsetUnset()'); @@ -280,7 +281,7 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S throw $e; } - return $this->getContainer()->offsetUnset($index); + $this->getContainer()->offsetUnset($index); } /** diff --git a/library/vendor/Zend/View/Helper/HeadScript.php b/library/vendor/Zend/View/Helper/HeadScript.php index 95a036577..5b8461d0b 100644 --- a/library/vendor/Zend/View/Helper/HeadScript.php +++ b/library/vendor/Zend/View/Helper/HeadScript.php @@ -363,7 +363,7 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container * @param mixed $value * @return void */ - public function offsetSet($index, $value) + public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { $e = new Zend_View_Exception('Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()'); @@ -371,7 +371,7 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container throw $e; } - return $this->getContainer()->offsetSet($index, $value); + $this->getContainer()->offsetSet($index, $value); } /** diff --git a/library/vendor/Zend/View/Helper/HeadStyle.php b/library/vendor/Zend/View/Helper/HeadStyle.php index 933490166..c28f99701 100644 --- a/library/vendor/Zend/View/Helper/HeadStyle.php +++ b/library/vendor/Zend/View/Helper/HeadStyle.php @@ -217,7 +217,7 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ * @param mixed $value * @return void */ - public function offsetSet($index, $value) + public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetStyle()'); @@ -225,7 +225,7 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ throw $e; } - return $this->getContainer()->offsetSet($index, $value); + $this->getContainer()->offsetSet($index, $value); } /** diff --git a/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php b/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php index c452f0319..c875ca78a 100644 --- a/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php +++ b/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php @@ -258,7 +258,7 @@ abstract class Zend_View_Helper_Placeholder_Container_Standalone extends Zend_Vi * * @return int */ - public function count() + public function count(): int { $container = $this->getContainer(); return count($container); @@ -270,7 +270,7 @@ abstract class Zend_View_Helper_Placeholder_Container_Standalone extends Zend_Vi * @param string|int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return $this->getContainer()->offsetExists($offset); } @@ -281,6 +281,7 @@ abstract class Zend_View_Helper_Placeholder_Container_Standalone extends Zend_Vi * @param string|int $offset * @return mixed */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->getContainer()->offsetGet($offset); @@ -293,9 +294,9 @@ abstract class Zend_View_Helper_Placeholder_Container_Standalone extends Zend_Vi * @param mixed $value * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { - return $this->getContainer()->offsetSet($offset, $value); + $this->getContainer()->offsetSet($offset, $value); } /** @@ -304,9 +305,9 @@ abstract class Zend_View_Helper_Placeholder_Container_Standalone extends Zend_Vi * @param string|int $offset * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { - return $this->getContainer()->offsetUnset($offset); + $this->getContainer()->offsetUnset($offset); } /** @@ -314,7 +315,7 @@ abstract class Zend_View_Helper_Placeholder_Container_Standalone extends Zend_Vi * * @return Iterator */ - public function getIterator() + public function getIterator(): Traversable { return $this->getContainer()->getIterator(); } diff --git a/modules/doc/library/Doc/DocSectionFilterIterator.php b/modules/doc/library/Doc/DocSectionFilterIterator.php index 3ca1c4854..bac5a6742 100644 --- a/modules/doc/library/Doc/DocSectionFilterIterator.php +++ b/modules/doc/library/Doc/DocSectionFilterIterator.php @@ -41,7 +41,7 @@ class DocSectionFilterIterator extends RecursiveFilterIterator implements Counta * @return bool Whether the current element of the iterator is acceptable * through this filter */ - public function accept() + public function accept(): bool { $section = $this->current(); /** @var \Icinga\Module\Doc\DocSection $section */ @@ -51,18 +51,12 @@ class DocSectionFilterIterator extends RecursiveFilterIterator implements Counta return false; } - /** - * {@inheritdoc} - */ - public function getChildren() + public function getChildren(): self { return new static($this->getInnerIterator()->getChildren(), $this->chapter); } - /** - * {@inheritdoc} - */ - public function count() + public function count(): int { return iterator_count($this); } diff --git a/modules/doc/library/Doc/Renderer/DocSearchRenderer.php b/modules/doc/library/Doc/Renderer/DocSearchRenderer.php index 79d2dfd86..c6e9ae2fd 100644 --- a/modules/doc/library/Doc/Renderer/DocSearchRenderer.php +++ b/modules/doc/library/Doc/Renderer/DocSearchRenderer.php @@ -9,10 +9,6 @@ use Icinga\Module\Doc\Search\DocSearchMatch; /** * Renderer for doc searches - * - * @method DocSearchIterator getInnerIterator() { - * @{inheritdoc} - * } */ class DocSearchRenderer extends DocRenderer { @@ -33,45 +29,30 @@ class DocSearchRenderer extends DocRenderer parent::__construct($iterator, RecursiveIteratorIterator::SELF_FIRST); } - /** - * {@inheritdoc} - */ - public function beginIteration() + public function beginIteration(): void { $this->content[] = ''; } - /** - * {@inheritdoc} - */ - public function beginChildren() + public function beginChildren(): void { if ($this->getInnerIterator()->getMatches()) { $this->content[] = '