Skip to content

Commit d59f674

Browse files
authored
Merge pull request #7790 from kai890707/20230807-file-phpstan
Fix: Remove the `File` ignore errors.
2 parents 273e8c8 + ebf6c57 commit d59f674

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

phpstan-baseline.php

-20
Original file line numberDiff line numberDiff line change
@@ -906,26 +906,6 @@
906906
'count' => 1,
907907
'path' => __DIR__ . '/system/Exceptions/TestException.php',
908908
];
909-
$ignoreErrors[] = [
910-
'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileException\\:\\:forExpectedDirectory\\(\\) has no return type specified\\.$#',
911-
'count' => 1,
912-
'path' => __DIR__ . '/system/Files/Exceptions/FileException.php',
913-
];
914-
$ignoreErrors[] = [
915-
'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileException\\:\\:forExpectedFile\\(\\) has no return type specified\\.$#',
916-
'count' => 1,
917-
'path' => __DIR__ . '/system/Files/Exceptions/FileException.php',
918-
];
919-
$ignoreErrors[] = [
920-
'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileException\\:\\:forUnableToMove\\(\\) has no return type specified\\.$#',
921-
'count' => 1,
922-
'path' => __DIR__ . '/system/Files/Exceptions/FileException.php',
923-
];
924-
$ignoreErrors[] = [
925-
'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileNotFoundException\\:\\:forFileNotFound\\(\\) has no return type specified\\.$#',
926-
'count' => 1,
927-
'path' => __DIR__ . '/system/Files/Exceptions/FileNotFoundException.php',
928-
];
929909
$ignoreErrors[] = [
930910
'message' => '#^Property CodeIgniter\\\\Files\\\\File\\:\\:\\$size \\(int\\) on left side of \\?\\? is not nullable\\.$#',
931911
'count' => 1,

system/Files/Exceptions/FileException.php

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class FileException extends RuntimeException implements ExceptionInterface
1919
{
2020
use DebugTraceableTrait;
2121

22+
/**
23+
* @return static
24+
*/
2225
public static function forUnableToMove(?string $from = null, ?string $to = null, ?string $error = null)
2326
{
2427
return new static(lang('Files.cannotMove', [$from, $to, $error]));
@@ -28,6 +31,8 @@ public static function forUnableToMove(?string $from = null, ?string $to = null,
2831
* Throws when an item is expected to be a directory but is not or is missing.
2932
*
3033
* @param string $caller The method causing the exception
34+
*
35+
* @return static
3136
*/
3237
public static function forExpectedDirectory(string $caller)
3338
{
@@ -38,6 +43,8 @@ public static function forExpectedDirectory(string $caller)
3843
* Throws when an item is expected to be a file but is not or is missing.
3944
*
4045
* @param string $caller The method causing the exception
46+
*
47+
* @return static
4148
*/
4249
public static function forExpectedFile(string $caller)
4350
{

system/Files/Exceptions/FileNotFoundException.php

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class FileNotFoundException extends RuntimeException implements ExceptionInterfa
1919
{
2020
use DebugTraceableTrait;
2121

22+
/**
23+
* @return static
24+
*/
2225
public static function forFileNotFound(string $path)
2326
{
2427
return new static(lang('Files.fileNotFound', [$path]));

0 commit comments

Comments
 (0)