Skip to content

Commit c9cdda4

Browse files
Replace more docblocks by type-hints
1 parent 2d9d737 commit c9cdda4

File tree

7 files changed

+7
-16
lines changed

7 files changed

+7
-16
lines changed

Comparator/DateComparator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DateComparator extends Comparator
2323
*
2424
* @throws \InvalidArgumentException If the test is not understood
2525
*/
26-
public function __construct($test)
26+
public function __construct(string $test)
2727
{
2828
if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
2929
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));

Comparator/NumberComparator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class NumberComparator extends Comparator
3939
*
4040
* @throws \InvalidArgumentException If the test is not understood
4141
*/
42-
public function __construct($test)
42+
public function __construct(?string $test)
4343
{
4444
if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
4545
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));

Finder.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,12 +630,7 @@ public function count()
630630
return iterator_count($this->getIterator());
631631
}
632632

633-
/**
634-
* @param $dir
635-
*
636-
* @return \Iterator
637-
*/
638-
private function searchInDirectory($dir)
633+
private function searchInDirectory(string $dir): \Iterator
639634
{
640635
if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
641636
$this->exclude = array_merge($this->exclude, self::$vcsPatterns);

Iterator/DepthRangeFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DepthRangeFilterIterator extends \FilterIterator
2525
* @param int $minDepth The min depth
2626
* @param int $maxDepth The max depth
2727
*/
28-
public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
28+
public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth = 0, int $maxDepth = PHP_INT_MAX)
2929
{
3030
$this->minDepth = $minDepth;
3131
$iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);

Iterator/FileTypeFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class FileTypeFilterIterator extends \FilterIterator
2727
* @param \Iterator $iterator The Iterator to filter
2828
* @param int $mode The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES)
2929
*/
30-
public function __construct(\Iterator $iterator, $mode)
30+
public function __construct(\Iterator $iterator, int $mode)
3131
{
3232
$this->mode = $mode;
3333

Iterator/RecursiveDirectoryIterator.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,9 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
3737
private $directorySeparator = '/';
3838

3939
/**
40-
* @param string $path
41-
* @param int $flags
42-
* @param bool $ignoreUnreadableDirs
43-
*
4440
* @throws \RuntimeException
4541
*/
46-
public function __construct($path, $flags, $ignoreUnreadableDirs = false)
42+
public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = false)
4743
{
4844
if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
4945
throw new \RuntimeException('This iterator only support returning current as fileinfo.');

SplFileInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SplFileInfo extends \SplFileInfo
2626
* @param string $relativePath The relative path
2727
* @param string $relativePathname The relative path name
2828
*/
29-
public function __construct($file, $relativePath, $relativePathname)
29+
public function __construct(string $file, string $relativePath, string $relativePathname)
3030
{
3131
parent::__construct($file);
3232
$this->relativePath = $relativePath;

0 commit comments

Comments
 (0)