aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2017-11-07 16:59:21 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2017-11-07 16:59:21 +0100
commit4a08e30f2fce376bf63d646cb83b559a9c838cc0 (patch)
tree9a11bec86303993d66c95fda8cd9392e273ea537
parente478b4b196afcd11f774774dc5edcf79ff94858d (diff)
downloadIterator-4a08e30f2fce376bf63d646cb83b559a9c838cc0.zip
Iterator-4a08e30f2fce376bf63d646cb83b559a9c838cc0.tar.gz
Iterator-4a08e30f2fce376bf63d646cb83b559a9c838cc0.tar.bz2
chore(php) Update to PHP 7.
-rw-r--r--Source/Aggregate.php3
-rw-r--r--Source/Append.php3
-rw-r--r--Source/Buffer.php23
-rw-r--r--Source/CallbackFilter.php3
-rw-r--r--Source/CallbackGenerator.php9
-rw-r--r--Source/Counter.php15
-rw-r--r--Source/Demultiplexer.php7
-rw-r--r--Source/Directory.php9
-rw-r--r--Source/Exception.php3
-rw-r--r--Source/FileSystem.php5
-rw-r--r--Source/Filter.php3
-rw-r--r--Source/Glob.php3
-rw-r--r--Source/Infinite.php3
-rw-r--r--Source/Iterator.php3
-rw-r--r--Source/IteratorIterator.php3
-rw-r--r--Source/Limit.php3
-rw-r--r--Source/Lookahead.php9
-rw-r--r--Source/Lookbehind.php9
-rw-r--r--Source/Map.php3
-rw-r--r--Source/Mock.php3
-rw-r--r--Source/Multiple.php5
-rw-r--r--Source/NoRewind.php3
-rw-r--r--Source/Outer.php3
-rw-r--r--Source/Recursive/CallbackFilter.php3
-rw-r--r--Source/Recursive/Directory.php9
-rw-r--r--Source/Recursive/Filter.php3
-rw-r--r--Source/Recursive/Iterator.php3
-rw-r--r--Source/Recursive/Map.php3
-rw-r--r--Source/Recursive/Mock.php7
-rw-r--r--Source/Recursive/Recursive.php3
-rw-r--r--Source/Recursive/RegularExpression.php17
-rw-r--r--Source/RegularExpression.php45
-rw-r--r--Source/Repeater.php7
-rw-r--r--Source/Seekable.php3
-rw-r--r--Source/SplFileInfo.php15
-rw-r--r--Test/Unit/Append.php9
-rw-r--r--Test/Unit/Buffer.php23
-rw-r--r--Test/Unit/CallbackFilter.php17
-rw-r--r--Test/Unit/CallbackGenerator.php5
-rw-r--r--Test/Unit/Counter.php13
-rw-r--r--Test/Unit/Demultiplexer.php9
-rw-r--r--Test/Unit/Directory.php21
-rw-r--r--Test/Unit/FileSystem.php11
-rw-r--r--Test/Unit/Filter.php10
-rw-r--r--Test/Unit/Infinite.php5
-rw-r--r--Test/Unit/IteratorIterator.php13
-rw-r--r--Test/Unit/Limit.php13
-rw-r--r--Test/Unit/Lookahead.php11
-rw-r--r--Test/Unit/Lookbehind.php11
-rw-r--r--Test/Unit/Map.php11
-rw-r--r--Test/Unit/Mock.php9
-rw-r--r--Test/Unit/Multiple.php11
-rw-r--r--Test/Unit/NoRewind.php5
-rw-r--r--Test/Unit/RegularExpression.php9
-rw-r--r--Test/Unit/Repeater.php12
-rw-r--r--Test/Unit/SplFileInfo.php13
56 files changed, 274 insertions, 218 deletions
diff --git a/Source/Aggregate.php b/Source/Aggregate.php
index 1abd0d8..a08f0df 100644
--- a/Source/Aggregate.php
+++ b/Source/Aggregate.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL IteratorAggregate interface.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
interface Aggregate extends \IteratorAggregate
diff --git a/Source/Append.php b/Source/Append.php
index c98a008..d3beb82 100644
--- a/Source/Append.php
+++ b/Source/Append.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL AppendIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Append extends \AppendIterator
diff --git a/Source/Buffer.php b/Source/Buffer.php
index 5e027b4..c4c395b 100644
--- a/Source/Buffer.php
+++ b/Source/Buffer.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Buffer iterator: Can go backward up to a certain limit, and forward.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Buffer extends IteratorIterator implements Outer
@@ -51,14 +52,14 @@ class Buffer extends IteratorIterator implements Outer
*
* @const int
*/
- const BUFFER_KEY = 0;
+ public const BUFFER_KEY = 0;
/**
* Buffer value index.
*
* @const int
*/
- const BUFFER_VALUE = 1;
+ public const BUFFER_VALUE = 1;
/**
* Current iterator.
@@ -89,7 +90,7 @@ class Buffer extends IteratorIterator implements Outer
* @param \Iterator $iterator Iterator.
* @param int $bufferSize Buffer size.
*/
- public function __construct(\Iterator $iterator, $bufferSize)
+ public function __construct(\Iterator $iterator, int $bufferSize)
{
$this->_iterator = $iterator;
$this->_bufferSize = max($bufferSize, 1);
@@ -103,7 +104,7 @@ class Buffer extends IteratorIterator implements Outer
*
* @return \Iterator
*/
- public function getInnerIterator()
+ public function getInnerIterator(): \Iterator
{
return $this->_iterator;
}
@@ -113,7 +114,7 @@ class Buffer extends IteratorIterator implements Outer
*
* @return \SplDoublyLinkedList
*/
- protected function getBuffer()
+ protected function getBuffer(): \SplDoublyLinkedList
{
return $this->_buffer;
}
@@ -123,7 +124,7 @@ class Buffer extends IteratorIterator implements Outer
*
* @return int
*/
- public function getBufferSize()
+ public function getBufferSize(): int
{
return $this->_bufferSize;
}
@@ -153,7 +154,7 @@ class Buffer extends IteratorIterator implements Outer
*
* @return void
*/
- public function next()
+ public function next(): void
{
$innerIterator = $this->getInnerIterator();
$buffer = $this->getBuffer();
@@ -192,7 +193,7 @@ class Buffer extends IteratorIterator implements Outer
*
* @return void
*/
- public function previous()
+ public function previous(): void
{
$this->getBuffer()->prev();
@@ -204,7 +205,7 @@ class Buffer extends IteratorIterator implements Outer
*
* @return void
*/
- public function rewind()
+ public function rewind(): void
{
$innerIterator = $this->getInnerIterator();
$buffer = $this->getBuffer();
@@ -228,7 +229,7 @@ class Buffer extends IteratorIterator implements Outer
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return
$this->getBuffer()->valid() &&
diff --git a/Source/CallbackFilter.php b/Source/CallbackFilter.php
index d23cef8..b619f33 100644
--- a/Source/CallbackFilter.php
+++ b/Source/CallbackFilter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL CallbackFilterIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class CallbackFilter extends \CallbackFilterIterator
diff --git a/Source/CallbackGenerator.php b/Source/CallbackGenerator.php
index 4d4407a..f096f42 100644
--- a/Source/CallbackGenerator.php
+++ b/Source/CallbackGenerator.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Yield a value based on a callback.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class CallbackGenerator implements Iterator
@@ -108,7 +109,7 @@ class CallbackGenerator implements Iterator
*
* @return void
*/
- public function next()
+ public function next(): void
{
++$this->_key;
@@ -120,7 +121,7 @@ class CallbackGenerator implements Iterator
*
* @return void
*/
- public function rewind()
+ public function rewind(): void
{
$this->_key = 0;
$this->_current = null;
@@ -133,7 +134,7 @@ class CallbackGenerator implements Iterator
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return true;
}
diff --git a/Source/Counter.php b/Source/Counter.php
index 3286399..17c41a3 100644
--- a/Source/Counter.php
+++ b/Source/Counter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* A counter.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Counter implements Iterator
@@ -93,7 +94,7 @@ class Counter implements Iterator
* @param int $step Step.
* @throws \Hoa\Iterator\Exception
*/
- public function __construct($from, $to, $step)
+ public function __construct(int $from, int $to, int $step)
{
if ($step <= 0) {
throw new Exception(
@@ -115,7 +116,7 @@ class Counter implements Iterator
*
* @return int
*/
- public function current()
+ public function current(): int
{
return $this->_i;
}
@@ -125,7 +126,7 @@ class Counter implements Iterator
*
* @return int
*/
- public function key()
+ public function key(): int
{
return $this->_key;
}
@@ -135,7 +136,7 @@ class Counter implements Iterator
*
* @return void
*/
- public function next()
+ public function next(): void
{
++$this->_key;
$this->_i += $this->_step;
@@ -148,7 +149,7 @@ class Counter implements Iterator
*
* @return void
*/
- public function rewind()
+ public function rewind(): void
{
$this->_key = 0;
$this->_i = $this->_from;
@@ -161,7 +162,7 @@ class Counter implements Iterator
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return $this->_i < $this->_to;
}
diff --git a/Source/Demultiplexer.php b/Source/Demultiplexer.php
index 108e692..1531e19 100644
--- a/Source/Demultiplexer.php
+++ b/Source/Demultiplexer.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -42,7 +44,6 @@ namespace Hoa\Iterator;
* Demux result from another iterator.
* This iterator is somehow the opposite of the Hoa\Iterator\Multiple iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Demultiplexer implements Iterator
@@ -77,7 +78,7 @@ class Demultiplexer implements Iterator
* @param callable $demuxer Demuxer.
* @throws \Hoa\Iterator\Exception
*/
- public function __construct(\Traversable $iterator, $demuxer)
+ public function __construct(\Traversable $iterator, callable $demuxer)
{
if ($iterator instanceof \IteratorAggregate) {
$iterator = $iterator->getIterator();
@@ -142,7 +143,7 @@ class Demultiplexer implements Iterator
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return $this->_iterator->valid();
}
diff --git a/Source/Directory.php b/Source/Directory.php
index 0d0431d..09cf673 100644
--- a/Source/Directory.php
+++ b/Source/Directory.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL DirectoryIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Directory extends \DirectoryIterator
@@ -70,7 +71,7 @@ class Directory extends \DirectoryIterator
* @param string $path Path.
* @param string $splFileInfoClass SplFileInfo classname.
*/
- public function __construct($path, $splFileInfoClass = null)
+ public function __construct(string $path, string $splFileInfoClass = null)
{
$this->_splFileInfoClass = $splFileInfoClass;
parent::__construct($path);
@@ -108,7 +109,7 @@ class Directory extends \DirectoryIterator
* @param string $relativePath Relative path.
* @return string
*/
- protected function setRelativePath($path)
+ protected function setRelativePath($path): string
{
$old = $this->_relativePath;
$this->_relativePath = $path;
@@ -121,7 +122,7 @@ class Directory extends \DirectoryIterator
*
* @return string
*/
- public function getRelativePath()
+ public function getRelativePath(): string
{
return $this->_relativePath;
}
diff --git a/Source/Exception.php b/Source/Exception.php
index ce40b8c..6a992d8 100644
--- a/Source/Exception.php
+++ b/Source/Exception.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Exception as HoaException;
*
* Extending the \Hoa\Exception\Exception class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Exception extends HoaException
diff --git a/Source/FileSystem.php b/Source/FileSystem.php
index b029997..f0e9a62 100644
--- a/Source/FileSystem.php
+++ b/Source/FileSystem.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL FileSystemIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class FileSystem extends \FilesystemIterator
@@ -64,7 +65,7 @@ class FileSystem extends \FilesystemIterator
* @param int $flags Flags.
* @param string $splFileInfoClass SplFileInfo classname.
*/
- public function __construct($path, $flags = null, $splFileInfoClass = null)
+ public function __construct(string $path, int $flags = null, string $splFileInfoClass = null)
{
$this->_splFileInfoClass = $splFileInfoClass;
diff --git a/Source/Filter.php b/Source/Filter.php
index aa2ecef..6dcd92b 100644
--- a/Source/Filter.php
+++ b/Source/Filter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL FilterIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
abstract class Filter extends \FilterIterator
diff --git a/Source/Glob.php b/Source/Glob.php
index f47458d..115a5a4 100644
--- a/Source/Glob.php
+++ b/Source/Glob.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL GlobIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Glob extends \GlobIterator
diff --git a/Source/Infinite.php b/Source/Infinite.php
index fce473f..182b1bf 100644
--- a/Source/Infinite.php
+++ b/Source/Infinite.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL InfiniteIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Infinite extends \InfiniteIterator
diff --git a/Source/Iterator.php b/Source/Iterator.php
index 228d90d..6a46192 100644
--- a/Source/Iterator.php
+++ b/Source/Iterator.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Consistency;
*
* Extending the SPL Iterator interface.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
interface Iterator extends \Iterator
diff --git a/Source/IteratorIterator.php b/Source/IteratorIterator.php
index 376b22e..89ef8b8 100644
--- a/Source/IteratorIterator.php
+++ b/Source/IteratorIterator.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL IteratorIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class IteratorIterator extends \IteratorIterator
diff --git a/Source/Limit.php b/Source/Limit.php
index 349bfd1..2c63680 100644
--- a/Source/Limit.php
+++ b/Source/Limit.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL LimitIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Limit extends \LimitIterator
diff --git a/Source/Lookahead.php b/Source/Lookahead.php
index 01eff9a..5ccec47 100644
--- a/Source/Lookahead.php
+++ b/Source/Lookahead.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Look ahead iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Lookahead extends IteratorIterator implements Outer
@@ -93,7 +94,7 @@ class Lookahead extends IteratorIterator implements Outer
*
* @return \Iterator
*/
- public function getInnerIterator()
+ public function getInnerIterator(): \Iterator
{
return $this->_iterator;
}
@@ -156,7 +157,7 @@ class Lookahead extends IteratorIterator implements Outer
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return $this->_valid;
}
@@ -166,7 +167,7 @@ class Lookahead extends IteratorIterator implements Outer
*
* @return bool
*/
- public function hasNext()
+ public function hasNext(): bool
{
return $this->getInnerIterator()->valid();
}
diff --git a/Source/Lookbehind.php b/Source/Lookbehind.php
index ba23e59..f700a65 100644
--- a/Source/Lookbehind.php
+++ b/Source/Lookbehind.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Look behind iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Lookbehind extends IteratorIterator implements Outer
@@ -86,7 +87,7 @@ class Lookbehind extends IteratorIterator implements Outer
*
* @return \Iterator
*/
- public function getInnerIterator()
+ public function getInnerIterator(): \Iterator
{
return $this->_iterator;
}
@@ -142,7 +143,7 @@ class Lookbehind extends IteratorIterator implements Outer
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return $this->getInnerIterator()->valid();
}
@@ -152,7 +153,7 @@ class Lookbehind extends IteratorIterator implements Outer
*
* @return bool
*/
- public function hasPrevious()
+ public function hasPrevious(): bool
{
return -1 !== $this->_previousKey;
}
diff --git a/Source/Map.php b/Source/Map.php
index 8cb9447..4fb6371 100644
--- a/Source/Map.php
+++ b/Source/Map.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL ArrayIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Map extends \ArrayIterator
diff --git a/Source/Mock.php b/Source/Mock.php
index 3d0d457..eda96ac 100644
--- a/Source/Mock.php
+++ b/Source/Mock.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL EmptyIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Mock extends \EmptyIterator
diff --git a/Source/Multiple.php b/Source/Multiple.php
index a8154e6..0004a64 100644
--- a/Source/Multiple.php
+++ b/Source/Multiple.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL MultipleIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Multiple extends \MultipleIterator
@@ -86,7 +87,7 @@ class Multiple extends \MultipleIterator
*
* @return array
*/
- public function current()
+ public function current(): array
{
$out = parent::current();
diff --git a/Source/NoRewind.php b/Source/NoRewind.php
index 9af8bbe..5c3b050 100644
--- a/Source/NoRewind.php
+++ b/Source/NoRewind.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL NoRewindIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class NoRewind extends \NoRewindIterator
diff --git a/Source/Outer.php b/Source/Outer.php
index 7299846..8b8b555 100644
--- a/Source/Outer.php
+++ b/Source/Outer.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL OuterIterator interface.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
interface Outer extends \OuterIterator
diff --git a/Source/Recursive/CallbackFilter.php b/Source/Recursive/CallbackFilter.php
index d4caa88..06af2e3 100644
--- a/Source/Recursive/CallbackFilter.php
+++ b/Source/Recursive/CallbackFilter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator\Recursive;
*
* Extending the SPL RecursiveCallbackFilterIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class CallbackFilter extends \RecursiveCallbackFilterIterator
diff --git a/Source/Recursive/Directory.php b/Source/Recursive/Directory.php
index 55421d3..1a3bca7 100644
--- a/Source/Recursive/Directory.php
+++ b/Source/Recursive/Directory.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator\Recursive;
*
* Extending the SPL RecursiveDirectoryIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Directory extends \RecursiveDirectoryIterator
@@ -78,7 +79,7 @@ class Directory extends \RecursiveDirectoryIterator
* @param int $flags Flags.
* @param string $splFileInfoClass SplFileInfo classname.
*/
- public function __construct($path, $flags = null, $splFileInfoClass = null)
+ public function __construct(string $path, int $flags = null, string $splFileInfoClass = null)
{
if (null === $flags) {
parent::__construct($path);
@@ -145,7 +146,7 @@ class Directory extends \RecursiveDirectoryIterator
* @param string $splFileInfoClass SplFileInfo classname.
* @return void
*/
- public function setSplFileInfoClass($splFileInfoClass)
+ public function setSplFileInfoClass(string $splFileInfoClass): void
{
$this->_splFileInfoClass = $splFileInfoClass;
@@ -157,7 +158,7 @@ class Directory extends \RecursiveDirectoryIterator
*
* @return string
*/
- public function getRelativePath()
+ public function getRelativePath(): string
{
return $this->_relativePath;
}
diff --git a/Source/Recursive/Filter.php b/Source/Recursive/Filter.php
index cf6e98b..ff32e75 100644
--- a/Source/Recursive/Filter.php
+++ b/Source/Recursive/Filter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator\Recursive;
*
* Extending the SPL RecursiveFilterIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
abstract class Filter extends \RecursiveFilterIterator
diff --git a/Source/Recursive/Iterator.php b/Source/Recursive/Iterator.php
index a7b4ccd..1651be5 100644
--- a/Source/Recursive/Iterator.php
+++ b/Source/Recursive/Iterator.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator\Recursive;
*
* Extending the SPL RecursiveIteratorIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Iterator extends \RecursiveIteratorIterator
diff --git a/Source/Recursive/Map.php b/Source/Recursive/Map.php
index 4743424..b0717a5 100644
--- a/Source/Recursive/Map.php
+++ b/Source/Recursive/Map.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator\Recursive;
*
* Extending the SPL RecursiveArrayIterator class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Map extends \RecursiveArrayIterator
diff --git a/Source/Recursive/Mock.php b/Source/Recursive/Mock.php
index 6f13365..8d029ad 100644
--- a/Source/Recursive/Mock.php
+++ b/Source/Recursive/Mock.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -42,7 +44,6 @@ namespace Hoa\Iterator\Recursive;
* Mock a recursive iterator with no children.
* It allows to use regular iterators with a recursive iterator iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Mock implements Recursive
@@ -117,7 +118,7 @@ class Mock implements Recursive
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return $this->_iterator->valid();
}
@@ -139,7 +140,7 @@ class Mock implements Recursive
*
* @return bool
*/
- public function hasChildren()
+ public function hasChildren(): bool
{
return false;
}
diff --git a/Source/Recursive/Recursive.php b/Source/Recursive/Recursive.php
index 730c1e1..c102444 100644
--- a/Source/Recursive/Recursive.php
+++ b/Source/Recursive/Recursive.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Consistency;
*
* Extending the SPL RecursiveIterator interface.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
interface Recursive extends \RecursiveIterator
diff --git a/Source/Recursive/RegularExpression.php b/Source/Recursive/RegularExpression.php
index 6368be9..75defc0 100644
--- a/Source/Recursive/RegularExpression.php
+++ b/Source/Recursive/RegularExpression.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -47,7 +49,6 @@ use Hoa\Iterator;
*
* Inspired by hhvm://hphp/system/php/spl/iterators/RecursiveRegexIterator.php
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class RegularExpression extends Iterator\RegularExpression implements Recursive
@@ -69,10 +70,10 @@ class RegularExpression extends Iterator\RegularExpression implements Recursive
*/
public function __construct(
\RecursiveIterator $iterator,
- $regex,
- $mode = self::MATCH,
- $flags = 0,
- $pregFlags = 0
+ string $regex,
+ int $mode = self::MATCH,
+ int $flags = 0,
+ int $pregFlags = 0
) {
parent::__construct($iterator, $regex, $mode, $flags, $pregFlags);
@@ -84,7 +85,7 @@ class RegularExpression extends Iterator\RegularExpression implements Recursive
*
* @return bool
*/
- public function accept()
+ public function accept(): bool
{
return
true === $this->hasChildren() ||
@@ -96,7 +97,7 @@ class RegularExpression extends Iterator\RegularExpression implements Recursive
*
* @return \Hoa\Iterator\Recursive\RegularExpression
*/
- public function getChildren()
+ public function getChildren(): RegularExpression
{
return new static(
true === $this->hasChildren()
@@ -114,7 +115,7 @@ class RegularExpression extends Iterator\RegularExpression implements Recursive
*
* @return bool
*/
- public function hasChildren()
+ public function hasChildren(): bool
{
return $this->getInnerIterator()->hasChildren();
}
diff --git a/Source/RegularExpression.php b/Source/RegularExpression.php
index f26cb5e..5e96445 100644
--- a/Source/RegularExpression.php
+++ b/Source/RegularExpression.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -45,7 +47,6 @@ namespace Hoa\Iterator;
*
* Inspired by hhvm://hphp/system/php/spl/iterators/RegexIterator.php
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class RegularExpression extends Filter
@@ -55,49 +56,49 @@ class RegularExpression extends Filter
*
* @const int
*/
- const USE_KEY = 1;
+ public const USE_KEY = 1;
/**
* Flag: invert match.
*
* @const int
*/
- const INVERT_MATCH = 2;
+ public const INVERT_MATCH = 2;
/**
* Mode and preg flag: only execute match (filter) for the current entry.
*
* @const int
*/
- const MATCH = 0;
+ public const MATCH = 0;
/**
* Mode and preg flag: first match for the current entry.
*
* @const int
*/
- const GET_MATCH = 1;
+ public const GET_MATCH = 1;
/**
* Mode and preg flag: all matches for the current entry.
*
* @const int
*/
- const ALL_MATCHES = 2;
+ public const ALL_MATCHES = 2;
/**
* Mode and preg flag: split values for the current entry.
*
* @const int
*/
- const SPLIT = 3;
+ public const SPLIT = 3;
/**
* Mode and preg flag: replace the current entry.
*
* @const int
*/
- const REPLACE = 4;
+ public const REPLACE = 4;
/**
* The regular expression to match.
@@ -169,10 +170,10 @@ class RegularExpression extends Filter
*/
public function __construct(
\Iterator $iterator,
- $regex,
- $mode = self::MATCH,
- $flags = 0,
- $pregFlags = 0
+ string $regex,
+ int $mode = self::MATCH,
+ int $flags = 0,
+ int $pregFlags = 0
) {
parent::__construct($iterator);
@@ -190,7 +191,7 @@ class RegularExpression extends Filter
*
* @return bool
*/
- public function accept()
+ public function accept(): bool
{
if (is_array(parent::current())) {
return false;
@@ -298,7 +299,7 @@ class RegularExpression extends Filter
*
* @return int
*/
- public function key()
+ public function key(): int
{
return $this->_key;
}
@@ -308,7 +309,7 @@ class RegularExpression extends Filter
*
* @return string
*/
- public function current()
+ public function current(): string
{
return $this->_current;
}
@@ -319,7 +320,7 @@ class RegularExpression extends Filter
* @param int $mode Mode.
* @return void
*/
- public function setMode($mode)
+ public function setMode(int $mode): void
{
if ($mode < self::MATCH || $mode > self::REPLACE) {
throw new \InvalidArgumentException(
@@ -338,7 +339,7 @@ class RegularExpression extends Filter
* @param int $flags Flags.
* @return void
*/
- public function setFlags($flags)
+ public function setFlags(int $flags): void
{
$this->_flags = $flags;
@@ -351,7 +352,7 @@ class RegularExpression extends Filter
* @param int $pregFlags Preg flags.
* @return void
*/
- public function setPregFlags($pregFlags)
+ public function setPregFlags(int $pregFlags): void
{
$this->_pregFlags = $pregFlags;
@@ -363,7 +364,7 @@ class RegularExpression extends Filter
*
* @return string
*/
- public function getRegex()
+ public function getRegex(): string
{
return $this->_regex;
}
@@ -373,7 +374,7 @@ class RegularExpression extends Filter
*
* @return int
*/
- public function getMode()
+ public function getMode(): int
{
return $this->_mode;
}
@@ -383,7 +384,7 @@ class RegularExpression extends Filter
*
* @return int
*/
- public function getFlags()
+ public function getFlags(): int
{
return $this->_flags;
}
@@ -393,7 +394,7 @@ class RegularExpression extends Filter
*
* @return int
*/
- public function getPregFlags()
+ public function getPregFlags(): int
{
return $this->_pregFlags;
}
diff --git a/Source/Repeater.php b/Source/Repeater.php
index 0b9fd66..efbb898 100644
--- a/Source/Repeater.php
+++ b/Source/Repeater.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Repeat an iterator n-times.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Repeater implements Iterator
@@ -84,7 +85,7 @@ class Repeater implements Iterator
* @param callable $body Body.
* @throws \Hoa\Iterator\Exception
*/
- public function __construct(\Traversable $iterator, $n, $body = null)
+ public function __construct(\Traversable $iterator, int $n, callable $body = null)
{
if (0 >= $n) {
throw new Exception(
@@ -150,7 +151,7 @@ class Repeater implements Iterator
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
$valid = $this->_iterator->valid();
diff --git a/Source/Seekable.php b/Source/Seekable.php
index 2656ffc..dcfb303 100644
--- a/Source/Seekable.php
+++ b/Source/Seekable.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Extending the SPL SeekableIterator interface.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
interface Seekable extends \SeekableIterator
diff --git a/Source/SplFileInfo.php b/Source/SplFileInfo.php
index af8c9a1..0a2353b 100644
--- a/Source/SplFileInfo.php
+++ b/Source/SplFileInfo.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Iterator;
*
* Enhance SplFileInfo implementation.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class SplFileInfo extends \SplFileInfo
@@ -68,7 +69,7 @@ class SplFileInfo extends \SplFileInfo
* @param string $filename Filename.
* @param string $relativePath Relative path.
*/
- public function __construct($filename, $relativePath = null)
+ public function __construct(string $filename, string $relativePath = null)
{
parent::__construct($filename);
@@ -86,7 +87,7 @@ class SplFileInfo extends \SplFileInfo
*
* @return string
*/
- public function getHash()
+ public function getHash(): string
{
return $this->_hash;
}
@@ -96,7 +97,7 @@ class SplFileInfo extends \SplFileInfo
*
* @return int
*/
- public function getMTime()
+ public function getMTime(): int
{
try {
return parent::getMTime();
@@ -111,7 +112,7 @@ class SplFileInfo extends \SplFileInfo
* @param string $relativePath Relative path.
* @return string
*/
- public function setRelativePath($relativePath)
+ public function setRelativePath(string $relativePath): string
{
$old = $this->_relativePath;
$this->_relativePath = $relativePath;
@@ -124,7 +125,7 @@ class SplFileInfo extends \SplFileInfo
*
* @return string
*/
- public function getRelativePath()
+ public function getRelativePath(): string
{
return $this->_relativePath;
}
@@ -134,7 +135,7 @@ class SplFileInfo extends \SplFileInfo
*
* @return string
*/
- public function getRelativePathname()
+ public function getRelativePathname(): string
{
if (null === $relative = $this->getRelativePath()) {
return $this->getPathname();
diff --git a/Test/Unit/Append.php b/Test/Unit/Append.php
index 425e652..345a5af 100644
--- a/Test/Unit/Append.php
+++ b/Test/Unit/Append.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the repeater iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Append extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -75,7 +76,7 @@ class Append extends Test\Unit\Suite
]);
}
- public function case_singleton()
+ public function case_singleton(): void
{
$this
->given(
@@ -94,7 +95,7 @@ class Append extends Test\Unit\Suite
]);
}
- public function case_empty()
+ public function case_empty(): void
{
$this
->given($append = new LUT\Append())
diff --git a/Test/Unit/Buffer.php b/Test/Unit/Buffer.php
index b8fcbd4..e7a7a75 100644
--- a/Test/Unit/Buffer.php
+++ b/Test/Unit/Buffer.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -45,12 +47,11 @@ use Hoa\Test;
*
* Test suite of the buffer iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Buffer extends Test\Unit\Suite
{
- public function case_constructor()
+ public function case_constructor(): void
{
$this
->given(
@@ -70,7 +71,7 @@ class Buffer extends Test\Unit\Suite
->isTrue();
}
- public function case_negative_buffer_size()
+ public function case_negative_buffer_size(): void
{
$this
->given(
@@ -83,7 +84,7 @@ class Buffer extends Test\Unit\Suite
->isEqualTo(1);
}
- public function case_null_buffer_size()
+ public function case_null_buffer_size(): void
{
$this
->given(
@@ -96,7 +97,7 @@ class Buffer extends Test\Unit\Suite
->isEqualTo(1);
}
- public function case_fast_forward()
+ public function case_fast_forward(): void
{
$this
->given($iterator = new SUT($this->getInnerIterator(), 3))
@@ -121,7 +122,7 @@ class Buffer extends Test\Unit\Suite
]);
}
- public function case_fast_forward_with_too_big_buffer()
+ public function case_fast_forward_with_too_big_buffer(): void
{
$this
->given($iterator = new SUT($this->getInnerIterator(), 10))
@@ -158,7 +159,7 @@ class Buffer extends Test\Unit\Suite
]);
}
- public function case_fast_forward_with_smallest_buffer()
+ public function case_fast_forward_with_smallest_buffer(): void
{
$this
->given($iterator = new SUT($this->getInnerIterator(), 1))
@@ -175,7 +176,7 @@ class Buffer extends Test\Unit\Suite
]);
}
- public function case_forward_forward_forward()
+ public function case_forward_forward_forward(): void
{
$this
->when($result = new SUT(new LUT\Map(['a', 'b', 'c']), 2))
@@ -217,7 +218,7 @@ class Buffer extends Test\Unit\Suite
->isNull();
}
- public function case_forward_forward_backward_backward_forward_forward_forward_step_by_step()
+ public function case_forward_forward_backward_backward_forward_forward_forward_step_by_step(): void
{
$this
->when($result = new SUT(new LUT\Map(['a', 'b', 'c']), 3))
@@ -404,7 +405,7 @@ class Buffer extends Test\Unit\Suite
->isNull();
}
- public function case_backward_out_of_buffer()
+ public function case_backward_out_of_buffer(): void
{
$this
->when($result = new SUT(new LUT\Map(['a', 'b', 'c']), 1))
@@ -433,7 +434,7 @@ class Buffer extends Test\Unit\Suite
->isFalse();
}
- public function case_rewind_rewind()
+ public function case_rewind_rewind(): void
{
$this
->when($result = new SUT(new LUT\Map(['a', 'b']), 3))
diff --git a/Test/Unit/CallbackFilter.php b/Test/Unit/CallbackFilter.php
index 2b120a0..25d03ac 100644
--- a/Test/Unit/CallbackFilter.php
+++ b/Test/Unit/CallbackFilter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the callback filter iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class CallbackFilter extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -71,7 +72,7 @@ class CallbackFilter extends Test\Unit\Suite
]);
}
- public function case_all_callback_parameters()
+ public function case_all_callback_parameters(): void
{
$self = $this;
@@ -111,7 +112,7 @@ class CallbackFilter extends Test\Unit\Suite
->isEqualTo(iterator_to_array($foobar));
}
- public function case_remove_all()
+ public function case_remove_all(): void
{
$this
->given(
@@ -129,7 +130,7 @@ class CallbackFilter extends Test\Unit\Suite
->isEmpty();
}
- public function case_remove_none()
+ public function case_remove_none(): void
{
$this
->given(
@@ -150,7 +151,7 @@ class CallbackFilter extends Test\Unit\Suite
->isEqualTo($filterResult);
}
- public function case_recursive()
+ public function case_recursive(): void
{
$this
->given(
@@ -173,7 +174,7 @@ class CallbackFilter extends Test\Unit\Suite
]);
}
- public function case_recursive_remove_all()
+ public function case_recursive_remove_all(): void
{
$this
->given(
@@ -192,7 +193,7 @@ class CallbackFilter extends Test\Unit\Suite
->isEmpty();
}
- public function case_recursive_remove_none()
+ public function case_recursive_remove_none(): void
{
$this
->given(
diff --git a/Test/Unit/CallbackGenerator.php b/Test/Unit/CallbackGenerator.php
index f521fc9..7218cf9 100644
--- a/Test/Unit/CallbackGenerator.php
+++ b/Test/Unit/CallbackGenerator.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the callback generator iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class CallbackGenerator extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
diff --git a/Test/Unit/Counter.php b/Test/Unit/Counter.php
index 3322fec..4b460df 100644
--- a/Test/Unit/Counter.php
+++ b/Test/Unit/Counter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the counter iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Counter extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given($iterator = new LUT\Counter(0, 12, 3))
@@ -59,7 +60,7 @@ class Counter extends Test\Unit\Suite
->isEqualTo([0, 3, 6, 9]);
}
- public function case_offset()
+ public function case_offset(): void
{
$this
->given($iterator = new LUT\Counter(6, 12, 3))
@@ -69,16 +70,16 @@ class Counter extends Test\Unit\Suite
->isEqualTo([6, 9]);
}
- public function case_too_small()
+ public function case_too_small(): void
{
$this
- ->exception(function () {
+ ->exception(function (): void {
new LUT\Counter(0, 0, 0);
})
->isInstanceOf(LUT\Exception::class);
}
- public function case_too_big()
+ public function case_too_big(): void
{
$this
->given($iterator = new LUT\Counter(0, 12, 13))
diff --git a/Test/Unit/Demultiplexer.php b/Test/Unit/Demultiplexer.php
index 1b93c19..1892582 100644
--- a/Test/Unit/Demultiplexer.php
+++ b/Test/Unit/Demultiplexer.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the demultiplexer iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Demultiplexer extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -81,7 +82,7 @@ class Demultiplexer extends Test\Unit\Suite
]);
}
- public function case_associative_keys()
+ public function case_associative_keys(): void
{
$this
->given(
@@ -90,7 +91,7 @@ class Demultiplexer extends Test\Unit\Suite
LUT\Multiple::MIT_NEED_ANY
| LUT\Multiple::MIT_KEYS_ASSOC
),
- $multiple->attachIterator($counter, 'one'),
+ $multiple->attachIterator($counter, 'one'),
$multiple->attachIterator(clone $counter, 'two'),
$demultiplexer = new LUT\Demultiplexer(
$multiple,
diff --git a/Test/Unit/Directory.php b/Test/Unit/Directory.php
index b406a82..2b28392 100644
--- a/Test/Unit/Directory.php
+++ b/Test/Unit/Directory.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the directory iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Directory extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -60,7 +61,7 @@ class Directory extends Test\Unit\Suite
$iterator = new LUT\Directory($root),
$result = []
)
- ->when(function () use ($iterator, &$result) {
+ ->when(function () use ($iterator, &$result): void {
foreach ($iterator as $key => $file) {
$result[$key] = $file->getFilename();
@@ -78,7 +79,7 @@ class Directory extends Test\Unit\Suite
]);
}
- public function case_seek_and_dots()
+ public function case_seek_and_dots(): void
{
$this
->given(
@@ -119,7 +120,7 @@ class Directory extends Test\Unit\Suite
->isEqualTo('Skip');
}
- public function case_recursive()
+ public function case_recursive(): void
{
$this
->given(
@@ -139,7 +140,7 @@ class Directory extends Test\Unit\Suite
$iterator = new LUT\Recursive\Iterator($directory),
$result = []
)
- ->when(function () use ($iterator, &$result) {
+ ->when(function () use ($iterator, &$result): void {
foreach ($iterator as $file) {
$result[] = $file->getFilename();
}
@@ -159,7 +160,7 @@ class Directory extends Test\Unit\Suite
]);
}
- public function case_splFileClassInfo()
+ public function case_splFileClassInfo(): void
{
$this
->given(
@@ -177,7 +178,7 @@ class Directory extends Test\Unit\Suite
),
$result = []
)
- ->when(function () use ($iterator, $splFileInfo, &$result) {
+ ->when(function () use ($iterator, $splFileInfo, &$result): void {
foreach ($iterator as $file) {
$this
->object($file)
@@ -198,7 +199,7 @@ class Directory extends Test\Unit\Suite
]);
}
- public function case_recursive_splFileClassInfo()
+ public function case_recursive_splFileClassInfo(): void
{
$this
->given(
@@ -221,7 +222,7 @@ class Directory extends Test\Unit\Suite
$iterator = new LUT\Recursive\Iterator($directory),
$result = []
)
- ->when(function () use ($iterator, $splFileInfo, &$result) {
+ ->when(function () use ($iterator, $splFileInfo, &$result): void {
foreach ($iterator as $file) {
$this
->object($file)
diff --git a/Test/Unit/FileSystem.php b/Test/Unit/FileSystem.php
index d32b521..388f3c9 100644
--- a/Test/Unit/FileSystem.php
+++ b/Test/Unit/FileSystem.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the filesystem iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class FileSystem extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -61,7 +62,7 @@ class FileSystem extends Test\Unit\Suite
$iterator = new LUT\FileSystem($root),
$result = []
)
- ->when(function () use ($iterator, &$result) {
+ ->when(function () use ($iterator, &$result): void {
foreach ($iterator as $pathname => $file) {
$this
->object($file)
@@ -77,7 +78,7 @@ class FileSystem extends Test\Unit\Suite
]);
}
- public function case_splFileClassInfo()
+ public function case_splFileClassInfo(): void
{
$this
->given(
@@ -96,7 +97,7 @@ class FileSystem extends Test\Unit\Suite
),
$result = []
)
- ->when(function () use ($iterator, $splFileInfo, &$result) {
+ ->when(function () use ($iterator, $splFileInfo, &$result): void {
foreach ($iterator as $file) {
$this
->object($file)
diff --git a/Test/Unit/Filter.php b/Test/Unit/Filter.php
index 42e235b..9d4fbbf 100644
--- a/Test/Unit/Filter.php
+++ b/Test/Unit/Filter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,7 +46,6 @@ use Hoa\Test;
*
* Basic filter.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class MyFilter extends LUT\Filter
@@ -60,12 +61,11 @@ class MyFilter extends LUT\Filter
*
* Test suite of the filter iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Filter extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -87,7 +87,7 @@ class Filter extends Test\Unit\Suite
]);
}
- public function case_remove_all()
+ public function case_remove_all(): void
{
$this
->given(
@@ -101,7 +101,7 @@ class Filter extends Test\Unit\Suite
->isEmpty();
}
- public function case_remove_none()
+ public function case_remove_none(): void
{
$this
->given(
diff --git a/Test/Unit/Infinite.php b/Test/Unit/Infinite.php
index 5d41640..6c56f2e 100644
--- a/Test/Unit/Infinite.php
+++ b/Test/Unit/Infinite.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the infinite iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Infinite extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
diff --git a/Test/Unit/IteratorIterator.php b/Test/Unit/IteratorIterator.php
index c0ed3f8..2a5b978 100644
--- a/Test/Unit/IteratorIterator.php
+++ b/Test/Unit/IteratorIterator.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the iterator iterator iterator (;-)).
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class IteratorIterator extends Test\Unit\Suite
{
- public function case_inner_iterator()
+ public function case_inner_iterator(): void
{
$this
->given(
@@ -62,7 +63,7 @@ class IteratorIterator extends Test\Unit\Suite
->isIdenticalTo($iterator);
}
- public function case_traverse()
+ public function case_traverse(): void
{
$this
->given(
@@ -75,7 +76,7 @@ class IteratorIterator extends Test\Unit\Suite
->isEqualTo(['a', 'b', 'c']);
}
- public function case_recursive_leaves_only()
+ public function case_recursive_leaves_only(): void
{
$this
->given(
@@ -95,7 +96,7 @@ class IteratorIterator extends Test\Unit\Suite
->isEqualTo(['b', 'c', 'd', 'f', 'g', 'i']);
}
- public function case_recursive_self_first()
+ public function case_recursive_self_first(): void
{
$this
->given(
@@ -124,7 +125,7 @@ class IteratorIterator extends Test\Unit\Suite
]);
}
- public function case_recursive_child_first()
+ public function case_recursive_child_first(): void
{
$this
->given(
diff --git a/Test/Unit/Limit.php b/Test/Unit/Limit.php
index 239040e..68d3cad 100644
--- a/Test/Unit/Limit.php
+++ b/Test/Unit/Limit.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,7 +46,6 @@ use Hoa\Test;
*
* Test suite of the limit iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Limit extends Test\Unit\Suite
@@ -53,7 +54,7 @@ class Limit extends Test\Unit\Suite
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -70,24 +71,24 @@ class Limit extends Test\Unit\Suite
]);
}
- public function case_negative_offset()
+ public function case_negative_offset(): void
{
$this
->given($iterator = new LUT\Map(self::$_dummyArray))
- ->exception(function () use ($iterator) {
+ ->exception(function () use ($iterator): void {
new LUT\Limit($iterator, -2, 3);
})
->isInstanceOf(\OutOfRangeException::class);
}
- public function case_empty()
+ public function case_empty(): void
{
$this
->given(
$iterator = new LUT\Map(self::$_dummyArray),
$limit = new LUT\Limit($iterator, 0, 0)
)
- ->exception(function () use ($limit) {
+ ->exception(function () use ($limit): void {
iterator_to_array($limit);
})
->isInstanceOf(\OutOfBoundsException::class);
diff --git a/Test/Unit/Lookahead.php b/Test/Unit/Lookahead.php
index fb4d372..83c924e 100644
--- a/Test/Unit/Lookahead.php
+++ b/Test/Unit/Lookahead.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the look ahead iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Lookahead extends Test\Unit\Suite
{
- public function case_traverse()
+ public function case_traverse(): void
{
$this
->given(
@@ -62,7 +63,7 @@ class Lookahead extends Test\Unit\Suite
->isEqualTo(['a', 'b', 'c']);
}
- public function case_check_ahead()
+ public function case_check_ahead(): void
{
$this
->given(
@@ -121,7 +122,7 @@ class Lookahead extends Test\Unit\Suite
->isNull();
}
- public function case_double_rewind()
+ public function case_double_rewind(): void
{
$this
->given(
@@ -163,7 +164,7 @@ class Lookahead extends Test\Unit\Suite
->isEqualTo('b');
}
- public function case_empty()
+ public function case_empty(): void
{
$this
->given(
diff --git a/Test/Unit/Lookbehind.php b/Test/Unit/Lookbehind.php
index 1c6ce1c..5442e01 100644
--- a/Test/Unit/Lookbehind.php
+++ b/Test/Unit/Lookbehind.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the look behind iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Lookbehind extends Test\Unit\Suite
{
- public function case_traverse()
+ public function case_traverse(): void
{
$this
->given(
@@ -62,7 +63,7 @@ class Lookbehind extends Test\Unit\Suite
->isEqualTo(['a', 'b', 'c']);
}
- public function case_check_behind()
+ public function case_check_behind(): void
{
$this
->given(
@@ -121,7 +122,7 @@ class Lookbehind extends Test\Unit\Suite
->isEqualTo('b');
}
- public function case_double_rewind()
+ public function case_double_rewind(): void
{
$this
->given(
@@ -157,7 +158,7 @@ class Lookbehind extends Test\Unit\Suite
->isFalse();
}
- public function case_empty()
+ public function case_empty(): void
{
$this
->given(
diff --git a/Test/Unit/Map.php b/Test/Unit/Map.php
index ba5dc49..ee605c1 100644
--- a/Test/Unit/Map.php
+++ b/Test/Unit/Map.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,7 +46,6 @@ use Hoa\Test;
*
* Test suite of the map iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Map extends Test\Unit\Suite
@@ -53,7 +54,7 @@ class Map extends Test\Unit\Suite
- public function case_classic()
+ public function case_classic(): void
{
$this
->given($iterator = new LUT\Map(self::$_dummyArray))
@@ -63,7 +64,7 @@ class Map extends Test\Unit\Suite
->isEqualTo(self::$_dummyArray);
}
- public function case_empty()
+ public function case_empty(): void
{
$this
->given($iterator = new LUT\Map())
@@ -73,7 +74,7 @@ class Map extends Test\Unit\Suite
->isEmpty();
}
- public function case_recursive()
+ public function case_recursive(): void
{
$this
->given(
@@ -84,7 +85,7 @@ class Map extends Test\Unit\Suite
],
$iterator = new LUT\Recursive\Map($array)
)
- ->when(function () use ($iterator) {
+ ->when(function () use ($iterator): void {
foreach ($iterator as $key => $value) {
if ('a' === $key) {
$this
diff --git a/Test/Unit/Mock.php b/Test/Unit/Mock.php
index 71703dd..09d2013 100644
--- a/Test/Unit/Mock.php
+++ b/Test/Unit/Mock.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the mock iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Mock extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given($iterator = new LUT\Mock())
@@ -59,7 +60,7 @@ class Mock extends Test\Unit\Suite
->isEmpty();
}
- public function case_recursive_mock_mock()
+ public function case_recursive_mock_mock(): void
{
$this
->when($iterator = new LUT\Recursive\Mock(new LUT\Mock()))
@@ -70,7 +71,7 @@ class Mock extends Test\Unit\Suite
->isFalse();
}
- public function case_recursive()
+ public function case_recursive(): void
{
$this
->given(
diff --git a/Test/Unit/Multiple.php b/Test/Unit/Multiple.php
index b4924e0..65af348 100644
--- a/Test/Unit/Multiple.php
+++ b/Test/Unit/Multiple.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the multiple iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Multiple extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -72,7 +73,7 @@ class Multiple extends Test\Unit\Suite
]);
}
- public function case_default_value()
+ public function case_default_value(): void
{
$this
->given(
@@ -83,7 +84,7 @@ class Multiple extends Test\Unit\Suite
| LUT\Multiple::MIT_KEYS_ASSOC
),
$multiple->attachIterator($foobar, 'one', '!'),
- $multiple->attachIterator($baz, 'two', '?')
+ $multiple->attachIterator($baz, 'two', '?')
)
->when($result = iterator_to_array($multiple, false))
->then
@@ -98,7 +99,7 @@ class Multiple extends Test\Unit\Suite
]);
}
- public function case_empty()
+ public function case_empty(): void
{
$this
->given($multiple = new LUT\Multiple())
diff --git a/Test/Unit/NoRewind.php b/Test/Unit/NoRewind.php
index 76b499b..89a0fb7 100644
--- a/Test/Unit/NoRewind.php
+++ b/Test/Unit/NoRewind.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the no-rewind iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class NoRewind extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
diff --git a/Test/Unit/RegularExpression.php b/Test/Unit/RegularExpression.php
index 5cd433e..9957c53 100644
--- a/Test/Unit/RegularExpression.php
+++ b/Test/Unit/RegularExpression.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the regular expression iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class RegularExpression extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -72,7 +73,7 @@ class RegularExpression extends Test\Unit\Suite
]);
}
- public function case_recursive()
+ public function case_recursive(): void
{
$this
->given(
@@ -93,7 +94,7 @@ class RegularExpression extends Test\Unit\Suite
]);
}
- public function case_recursive_children_flags()
+ public function case_recursive_children_flags(): void
{
$this
->given(
diff --git a/Test/Unit/Repeater.php b/Test/Unit/Repeater.php
index 61dfe40..06ac8f1 100644
--- a/Test/Unit/Repeater.php
+++ b/Test/Unit/Repeater.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,7 +46,6 @@ use Hoa\Test;
*
* Test suite of the repeater iterator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Repeater extends Test\Unit\Suite
@@ -53,7 +54,7 @@ class Repeater extends Test\Unit\Suite
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -70,7 +71,7 @@ class Repeater extends Test\Unit\Suite
);
}
- public function case_with_body()
+ public function case_with_body(): void
{
$self = $this;
@@ -81,13 +82,14 @@ class Repeater extends Test\Unit\Suite
$repeater = new LUT\Repeater(
$iterator,
3,
- function ($repetition) use ($self, &$count) {
+ function ($repetition) use ($self, &$count): void {
$this
->integer($repetition)
->isEqualTo($count + 1);
++$count;
- })
+ }
+ )
)
->when($result = iterator_to_array($repeater))
->then
diff --git a/Test/Unit/SplFileInfo.php b/Test/Unit/SplFileInfo.php
index bb780c5..7cd9085 100644
--- a/Test/Unit/SplFileInfo.php
+++ b/Test/Unit/SplFileInfo.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the SplFileInfo class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class SplFileInfo extends Test\Unit\Suite
{
- public function case_file()
+ public function case_file(): void
{
$this
->given($pathname = 'hoa://Test/Vfs/Foo.bar?type=file')
@@ -61,7 +62,7 @@ class SplFileInfo extends Test\Unit\Suite
->isEqualTo('file');
}
- public function case_directory()
+ public function case_directory(): void
{
$this
->given($pathname = 'hoa://Test/Vfs/Foo?type=directory')
@@ -73,7 +74,7 @@ class SplFileInfo extends Test\Unit\Suite
->isEqualTo('dir');
}
- public function case_path_informations()
+ public function case_path_informations(): void
{
$this
->given(
@@ -99,7 +100,7 @@ class SplFileInfo extends Test\Unit\Suite
->isEqualTo($pathname . '?type=file');
}
- public function case_times()
+ public function case_times(): void
{
$this
->given(
@@ -129,7 +130,7 @@ class SplFileInfo extends Test\Unit\Suite
->isEqualTo($mtime);
}
- public function case_permissions()
+ public function case_permissions(): void
{
$this
->given($pathname = 'hoa://Test/Vfs/Fo.bar?type=file&permissions=0744')