Skip to content

Commit ebf6c57

Browse files
committed
Fix: Changed the Exception return type to static.
1 parent 6edcd99 commit ebf6c57

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

phpstan-baseline.php

+5
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,11 @@
946946
'count' => 1,
947947
'path' => __DIR__ . '/system/Exceptions/TestException.php',
948948
];
949+
$ignoreErrors[] = [
950+
'message' => '#^Property CodeIgniter\\\\Files\\\\File\\:\\:\\$size \\(int\\) on left side of \\?\\? is not nullable\\.$#',
951+
'count' => 1,
952+
'path' => __DIR__ . '/system/Files/File.php',
953+
];
949954
$ignoreErrors[] = [
950955
'message' => '#^Expression on left side of \\?\\? is not nullable\\.$#',
951956
'count' => 1,

system/Files/Exceptions/FileException.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FileException extends RuntimeException implements ExceptionInterface
2020
use DebugTraceableTrait;
2121

2222
/**
23-
* @return FileException
23+
* @return static
2424
*/
2525
public static function forUnableToMove(?string $from = null, ?string $to = null, ?string $error = null)
2626
{
@@ -32,7 +32,7 @@ public static function forUnableToMove(?string $from = null, ?string $to = null,
3232
*
3333
* @param string $caller The method causing the exception
3434
*
35-
* @return FileException
35+
* @return static
3636
*/
3737
public static function forExpectedDirectory(string $caller)
3838
{
@@ -44,7 +44,7 @@ public static function forExpectedDirectory(string $caller)
4444
*
4545
* @param string $caller The method causing the exception
4646
*
47-
* @return FileException
47+
* @return static
4848
*/
4949
public static function forExpectedFile(string $caller)
5050
{

system/Files/Exceptions/FileNotFoundException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FileNotFoundException extends RuntimeException implements ExceptionInterfa
2020
use DebugTraceableTrait;
2121

2222
/**
23-
* @return FileNotFoundException
23+
* @return static
2424
*/
2525
public static function forFileNotFound(string $path)
2626
{

system/Files/File.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ class File extends SplFileInfo
2525
{
2626
/**
2727
* The files size in bytes
28+
*
29+
* @var int
2830
*/
29-
protected int $size;
31+
protected $size;
3032

3133
/**
3234
* @var string|null

0 commit comments

Comments
 (0)