Skip to content

Commit e55b032

Browse files
committed
fix code styling
1 parent cf426bd commit e55b032

2 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎src/Internal/Io/StreamWrapper.php‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,14 @@ public function stream_open(string $path, string $mode, int $options, ?string &$
352352

353353
self::unregister();
354354

355-
$exists = (bool) self::silent(static fn() => file_exists($path));
356-
$resolvedPath = $exists ? self::silent(static fn() => realpath($path)) : false;
355+
$exists = (bool) self::silent(static fn () => file_exists($path));
356+
$resolvedPath = $exists ? self::silent(static fn () => realpath($path)) : false;
357357

358358
if (! $exists || $resolvedPath === false || ! self::isApplicationFile($path, $resolvedPath)) {
359359
$target = ($resolvedPath !== false) ? $resolvedPath : $path;
360360
/** @var resource|false $handle */
361361
$handle = self::silent(
362-
fn() => ($this->context !== null)
362+
fn () => ($this->context !== null)
363363
? fopen($target, $mode, false, $this->context)
364364
: fopen($target, $mode)
365365
);
@@ -403,7 +403,7 @@ private function openDirectHandle(string $targetFile, string $mode, int $options
403403
self::unregister();
404404
/** @var resource|false $handle */
405405
$handle = self::silent(
406-
fn() => ($this->context !== null)
406+
fn () => ($this->context !== null)
407407
? fopen($targetFile, $mode, $useIncludePath, $this->context)
408408
: fopen($targetFile, $mode, $useIncludePath)
409409
);
@@ -561,7 +561,7 @@ public function url_stat(string $path, int $flags): array|false
561561

562562
self::unregister();
563563
/** @var array<int|string, int>|false $result */
564-
$result = self::silent(static fn() => $isLink ? @lstat($path) : @stat($path));
564+
$result = self::silent(static fn () => $isLink ? @lstat($path) : @stat($path));
565565
self::register();
566566

567567
if ($result !== false) {
@@ -598,11 +598,11 @@ public function stream_metadata(string $path, int $option, mixed $value): bool
598598
$valueArray = \is_array($value) ? $value : [];
599599
$time = $valueArray[0] ?? time();
600600
$atime = $valueArray[1] ?? $time;
601-
$result = (bool) self::silent(fn() => @touch($path, (int) $time, (int) $atime));
601+
$result = (bool) self::silent(fn () => @touch($path, (int) $time, (int) $atime));
602602
} elseif ($option === STREAM_META_ACCESS) {
603603
/** @var int $mode */
604604
$mode = \is_int($value) ? $value : 0777;
605-
$result = (bool) self::silent(fn() => @chmod($path, $mode));
605+
$result = (bool) self::silent(fn () => @chmod($path, $mode));
606606
}
607607
self::register();
608608

@@ -614,7 +614,7 @@ public function dir_opendir(string $path, int $options): bool
614614
self::unregister();
615615
/** @var resource|false $dh */
616616
$dh = self::silent(
617-
fn() => ($this->context !== null)
617+
fn () => ($this->context !== null)
618618
? @opendir($path, $this->context)
619619
: @opendir($path)
620620
);
@@ -741,7 +741,7 @@ public function rename(string $pathFrom, string $pathTo): bool
741741
*/
742742
private static function silent(callable $callback): mixed
743743
{
744-
set_error_handler(static fn() => true);
744+
set_error_handler(static fn () => true);
745745

746746
try {
747747
return $callback();

‎tests/Internal/Io/StreamWrapperTest.php‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,9 @@ function sampleAction(int $id): string
472472

473473
expect(\App\Test\sampleAction(42))->toBe('id_42');
474474

475-
expect(fn() => \App\Test\sampleAction(-5))
476-
->toThrow(TypeError::class, 'positive-int');
475+
expect(fn () => \App\Test\sampleAction(-5))
476+
->toThrow(TypeError::class, 'positive-int')
477+
;
477478
} finally {
478479
if (file_exists($testFile)) {
479480
@unlink($testFile);
@@ -602,10 +603,10 @@ public function create()
602603
PHP;
603604
StreamWrapper::transformSource($source, 'VirtualServiceFactory.php');
604605

605-
$obj = (new class() {
606+
$obj = (new class () {
606607
public function create(): object
607608
{
608-
return new class() {
609+
return new class () {
609610
/** @use \TypePHP\Tests\Fixtures\Generics\GenericItemLoggerTrait<int> */
610611
use TypePHP\Tests\Fixtures\Generics\GenericItemLoggerTrait;
611612
};
@@ -667,7 +668,7 @@ function testLiteralFunc(int $id): int
667668
$transformed = StreamWrapper::transformSource($source, 'literal_test_file.php');
668669

669670
expect($transformed)->toContain('RuntimeTypeChecker::setupScope')
670-
->and(\TypePHP\Internal\Util\IgnoreManager::isFileIgnored('literal_test_file.php'))->toBeFalse()
671+
->and(TypePHP\Internal\Util\IgnoreManager::isFileIgnored('literal_test_file.php'))->toBeFalse()
671672
;
672673
});
673674
});

0 commit comments

Comments
 (0)