Skip to content

Commit 466b5dc

Browse files
committed
Update for latest Psalm
1 parent 6c711ee commit 466b5dc

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/Internal/Posix/PosixHandle.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ static function (string $callbackId, $stream) use (&$status, $deferred, $stdin,
5151
// Don't call proc_close here or close output streams, as there might still be stream reads
5252
$stdin->get()?->close();
5353

54-
\fclose($stream);
54+
if (\is_resource($stream)) {
55+
\fclose($stream);
56+
}
5557

5658
self::asyncWaitPid($shellPid);
5759
},

src/Internal/Posix/PosixRunner.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static function (CancelledException $e) use ($suspension, $callbackId): void {
109109
$cancellation->unsubscribe($cancellationId);
110110
}
111111

112+
/** @psalm-suppress RiskyTruthyFalsyComparison */
112113
$pid = \rtrim(\fgets($extraDataPipe) ?: '');
113114
if (!$pid || !\is_numeric($pid)) {
114115
\proc_terminate($proc);

src/Internal/Windows/WindowsRunner.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function start(
6161
});
6262

6363
try {
64+
/** @psalm-suppress RiskyTruthyFalsyComparison */
6465
$proc = \proc_open(
6566
$this->makeCommand($workingDirectory ?? ''),
6667
self::FD_SPEC,
@@ -113,6 +114,7 @@ public function start(
113114

114115
$cancellation->throwIfRequested();
115116

117+
/** @psalm-suppress RiskyTruthyFalsyComparison */
116118
throw new ProcessException(\trim($message ?: 'Process did not connect to server before timeout elapsed'));
117119
}
118120

src/Process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function start(
6262
? \implode(" ", \array_map(escapeArgument(...), $command))
6363
: $command;
6464

65-
if (!$workingDirectory) {
65+
if ($workingDirectory === null) {
6666
$cwd = \getcwd();
6767
if ($cwd === false) {
6868
throw new ProcessException('Failed to determine current working directory');

0 commit comments

Comments
 (0)