Skip to content

Commit 33b2147

Browse files
Add return types - batch 1/n
1 parent 2cd5175 commit 33b2147

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Exception/IOException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(string $message, int $code = 0, \Throwable $previous
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function getPath()
35+
public function getPath(): ?string
3636
{
3737
return $this->path;
3838
}

Exception/IOExceptionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ interface IOExceptionInterface extends ExceptionInterface
2323
*
2424
* @return string|null The path
2525
*/
26-
public function getPath();
26+
public function getPath(): ?string;
2727
}

Filesystem.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function mkdir(string|iterable $dirs, int $mode = 0777)
102102
*
103103
* @return bool true if the file exists, false otherwise
104104
*/
105-
public function exists(string|iterable $files)
105+
public function exists(string|iterable $files): bool
106106
{
107107
$maxPathLength = \PHP_MAXPATHLEN - 2;
108108

@@ -399,10 +399,8 @@ private function linkException(string $origin, string $target, string $linkType)
399399
* With $canonicalize = true
400400
* - if $path does not exist, returns null
401401
* - if $path exists, returns its absolute fully resolved final version
402-
*
403-
* @return string|null
404402
*/
405-
public function readlink(string $path, bool $canonicalize = false)
403+
public function readlink(string $path, bool $canonicalize = false): ?string
406404
{
407405
if (!$canonicalize && !is_link($path)) {
408406
return null;
@@ -424,7 +422,7 @@ public function readlink(string $path, bool $canonicalize = false)
424422
*
425423
* @return string Path of target relative to starting path
426424
*/
427-
public function makePathRelative(string $endPath, string $startPath)
425+
public function makePathRelative(string $endPath, string $startPath): string
428426
{
429427
if (!$this->isAbsolutePath($startPath)) {
430428
throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
@@ -570,10 +568,8 @@ public function mirror(string $originDir, string $targetDir, \Traversable $itera
570568

571569
/**
572570
* Returns whether the file path is an absolute path.
573-
*
574-
* @return bool
575571
*/
576-
public function isAbsolutePath(string $file)
572+
public function isAbsolutePath(string $file): bool
577573
{
578574
return '' !== $file && (strspn($file, '/\\', 0, 1)
579575
|| (\strlen($file) > 3 && ctype_alpha($file[0])
@@ -593,7 +589,7 @@ public function isAbsolutePath(string $file)
593589
*
594590
* @return string The new temporary filename (with path), or throw an exception on failure
595591
*/
596-
public function tempnam(string $dir, string $prefix/*, string $suffix = ''*/)
592+
public function tempnam(string $dir, string $prefix/*, string $suffix = ''*/): string
597593
{
598594
$suffix = \func_num_args() > 2 ? func_get_arg(2) : '';
599595
[$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir);

0 commit comments

Comments
 (0)