Skip to content

Commit

Permalink
level 4
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Jan 7, 2024
1 parent 4f3b4a2 commit d2ba9a3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="5"
errorLevel="4"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
19 changes: 8 additions & 11 deletions src/Collector/Console/CommandCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,14 @@ public function collect(ConsoleEvent|ConsoleErrorEvent|ConsoleTerminateEvent $ev
return;
}

/** @noinspection PhpConditionAlreadyCheckedInspection */
if ($event instanceof ConsoleEvent) {
$this->commands[$event::class] = [
'name' => $command->getName(),
'command' => $command,
'input' => $this->castInputToString($event->getInput()),
'output' => $this->fetchOutput($event->getOutput()),
'arguments' => $command->getDefinition()->getArguments(),
'options' => $command->getDefinition()->getOptions(),
];
}
$this->commands[$event::class] = [
'name' => $command->getName(),
'command' => $command,
'input' => $this->castInputToString($event->getInput()),
'output' => $this->fetchOutput($event->getOutput()),
'arguments' => $command->getDefinition()->getArguments(),
'options' => $command->getDefinition()->getOptions(),
];
}

public function getSummary(): array
Expand Down
4 changes: 2 additions & 2 deletions src/Collector/Stream/FilesystemStreamProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

use const SEEK_SET;

class FilesystemStreamProxy implements StreamWrapperInterface
final class FilesystemStreamProxy implements StreamWrapperInterface
{
public static bool $registered = false;
/**
* @var resource|null
*/
public $context;
public StreamWrapperInterface $decorated;
public StreamWrapper $decorated;
public bool $ignored = false;

public static ?FilesystemStreamCollector $collector = null;
Expand Down
4 changes: 2 additions & 2 deletions src/Collector/Stream/HttpStreamProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use const SEEK_SET;

class HttpStreamProxy implements StreamWrapperInterface
final class HttpStreamProxy implements StreamWrapperInterface
{
public static bool $registered = false;
public static array $ignoredPathPatterns = [];
Expand All @@ -23,7 +23,7 @@ class HttpStreamProxy implements StreamWrapperInterface
* @var resource|null
*/
public $context;
public StreamWrapperInterface $decorated;
public StreamWrapper $decorated;
public bool $ignored = false;

public static ?HttpStreamCollector $collector = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Collector/Web/RequestCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getCollected(): array

public function collect(object $event): void
{
if (!is_object($event) || !$this->isActive()) {
if (!$this->isActive()) {
return;
}

Expand Down
10 changes: 9 additions & 1 deletion src/Helper/StreamWrapper/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ final class StreamWrapper implements StreamWrapperInterface
public function dir_closedir(): bool
{
closedir($this->stream);

/**
* @psalm-suppress RedundantCondition
*/
return is_resource($this->stream);
}

Expand All @@ -54,7 +58,11 @@ public function dir_rewinddir(): bool
}

rewinddir($this->stream);
/** @noinspection PhpConditionAlreadyCheckedInspection */

/**
* @noinspection PhpConditionAlreadyCheckedInspection
* @psalm-suppress RedundantCondition
*/
return is_resource($this->stream);
}

Expand Down

0 comments on commit d2ba9a3

Please sign in to comment.