Skip to content

Commit 5a6106e

Browse files
committed
test: fix AutoReview and PHPStan issues in FileHandlerTest
1 parent 4672828 commit 5a6106e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎tests/system/Session/Handlers/FileHandlerTest.php‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@
1313

1414
namespace CodeIgniter\Session\Handlers;
1515

16+
use Closure;
1617
use CodeIgniter\Session\Exceptions\SessionException;
1718
use CodeIgniter\Test\CIUnitTestCase;
1819
use CodeIgniter\Test\TestLogger;
1920
use Config\Logger as LoggerConfig;
2021
use Config\Session as SessionConfig;
22+
use PHPUnit\Framework\Attributes\Group;
2123
use Tests\Support\Session\FaultyStream;
2224
use Tests\Support\Session\FileHandlerCloseFail;
2325

2426
/**
2527
* @internal
2628
*/
29+
#[Group('Others')]
2730
final class FileHandlerTest extends CIUnitTestCase
2831
{
2932
private string $sessionDriver = FileHandler::class;
@@ -92,8 +95,10 @@ protected function getInstance($options = []): FileHandler
9295

9396
/**
9497
* Runs a callback while suppressing any PHP warnings it raises.
98+
*
99+
* @param Closure(): mixed $callback
95100
*/
96-
private function withSuppressedErrors(callable $callback): mixed
101+
private function withSuppressedErrors(Closure $callback): mixed
97102
{
98103
set_error_handler(static fn (int $severity, string $message): bool => true);
99104

@@ -110,7 +115,9 @@ private function removeDirectory(string $path): void
110115
return;
111116
}
112117

113-
foreach (scandir($path) ?: [] as $item) {
118+
$items = scandir($path);
119+
120+
foreach ($items === false ? [] : $items as $item) {
114121
if ($item === '.' || $item === '..') {
115122
continue;
116123
}

0 commit comments

Comments
 (0)