Skip to content

Commit a6c9a5e

Browse files
committed
test: apply rector fixes to FaultyStream
1 parent e4a9039 commit a6c9a5e

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎rector.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
2626
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
2727
use Rector\DeadCode\Rector\MethodCall\RemoveNullArgOnNullDefaultParamRector;
28+
use Rector\DeadCode\Rector\Property\RemoveDefaultValueFromAssignedPropertyRector;
2829
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
2930
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
3031
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
@@ -103,6 +104,9 @@
103104
__DIR__ . '/system/HTTP/Response.php',
104105
],
105106

107+
// Keep property defaults for backward compatibility.
108+
RemoveDefaultValueFromAssignedPropertyRector::class,
109+
106110
ReadOnlyPropertyRector::class => [
107111
__DIR__ . '/system/Cache/ResponseCache.php',
108112
__DIR__ . '/system/HotReloader/IteratorFilter.php',

‎tests/_support/Session/FaultyStream.php‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ public static function reset(): void
5252
self::$failWrite = false;
5353
}
5454

55-
public function stream_open(string $path, string $mode, int $options, ?string &$openedPath): bool
55+
public function stream_open(): bool
5656
{
5757
$this->stream = fopen('php://temp', 'c+b');
58-
5958
return $this->stream !== false;
6059
}
6160

@@ -69,9 +68,9 @@ public function stream_write(string $data): false|int
6968
return self::$failWrite ? false : fwrite($this->stream, $data);
7069
}
7170

72-
public function stream_lock(int $operation): bool
71+
public function stream_lock(): bool
7372
{
74-
return self::$failLock ? false : true;
73+
return !self::$failLock;
7574
}
7675

7776
public function stream_close(): void
@@ -110,7 +109,7 @@ public function stream_stat(): array
110109
*
111110
* @return array<string, int>
112111
*/
113-
public function url_stat(string $path, int $flags): array
112+
public function url_stat(): array
114113
{
115114
return [
116115
'dev' => 0,

0 commit comments

Comments
 (0)