aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-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
35 files changed, 143 insertions, 108 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();