Skip to content

Commit

Permalink
Update SA tool and soothe them
Browse files Browse the repository at this point in the history
The commit introduces `is_string` function in a condition in `MethodSignatureString.php`. Several tools in `composer.lock` have been updated to newer versions, including packages like `amphp/amp`, `amphp/byte-stream`, and others. This commit thus refactors the code for improved validation and updates dependencies for enhanced project features.
  • Loading branch information
koriym committed Apr 21, 2024
1 parent 1f50707 commit 56bf55f
Show file tree
Hide file tree
Showing 3 changed files with 305 additions and 291 deletions.
5 changes: 3 additions & 2 deletions sl-src/CacheReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use function array_merge;
use function assert;
use function filemtime;
use function is_string;
use function max;
use function rawurlencode;

Expand Down Expand Up @@ -161,7 +162,7 @@ private function getLastModification(ReflectionClass $class): int // @phpstan-i
$parent = $class->getParentClass();

$lastModification = max(array_merge(
[$filename ? filemtime($filename) : 0],
[is_string($filename) ? filemtime($filename) : 0],
array_map(function (ReflectionClass $reflectionTrait): int {
return $this->getTraitLastModificationTime($reflectionTrait);
}, $class->getTraits()),
Expand All @@ -185,7 +186,7 @@ private function getTraitLastModificationTime(ReflectionClass $reflectionTrait):
}

$lastModificationTime = max(array_merge(
[$fileName ? filemtime($fileName) : 0],
[is_string($fileName) ? filemtime($fileName) : 0],
array_map(function (ReflectionClass $reflectionTrait): int {
return $this->getTraitLastModificationTime($reflectionTrait);
}, $reflectionTrait->getTraits())
Expand Down
3 changes: 2 additions & 1 deletion src/MethodSignatureString.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use function implode;
use function is_numeric;
use function is_string;
use function preg_replace;
use function sprintf;
use function str_replace;
Expand Down Expand Up @@ -40,7 +41,7 @@ public function get(ReflectionMethod $method): string

// PHPDocを取得
$docComment = $method->getDocComment();
if ($docComment) {
if (is_string($docComment)) {
$signatureParts[] = $docComment . PHP_EOL;
}

Expand Down
Loading

0 comments on commit 56bf55f

Please sign in to comment.