Skip to content

Commit

Permalink
fix: Fix static analysis issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Jan 24, 2024
1 parent fd3dc17 commit e8b1677
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.5.17

* fix: Fix static analysis issues.

## 0.5.16

* perf: Optimize `guessTypeFromVariable`
Expand Down
6 changes: 3 additions & 3 deletions src/Command/MappingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$id = $entry->getId();
$variantTargetType = $entry->isVariantTargetType();

if ($sourceOption) {
if ($sourceOption !== null) {
if (preg_match('/' . preg_quote($sourceOption) . '/i', $entry->getSourceTypeString()) === 0) {
continue;
}

$sourceType = preg_replace('/(' . preg_quote($sourceOption) . ')/i', '<bg=yellow>$1</>', $sourceType);
}

if ($targetOption) {
if ($targetOption !== null) {
if (preg_match('/' . preg_quote($targetOption) . '/i', $entry->getTargetTypeString()) === 0) {
continue;
}

$targetType = preg_replace('/(' . preg_quote($targetOption) . ')/i', '<bg=yellow>$1</>', $targetType);
}

if ($classOption) {
if ($classOption !== null) {
if (
preg_match('/' . preg_quote($classOption) . '/i', $entry->getClass()) === 0
&& preg_match('/' . preg_quote($classOption) . '/i', $entry->getId()) === 0
Expand Down
6 changes: 4 additions & 2 deletions src/TypeResolver/CachingTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function __construct(

public function getTypeString(Type|MixedType $type): string
{
if ($result = $this->typeStringCache[$type] ?? null) {
$result = $this->typeStringCache[$type] ?? null;
if ($result !== null) {
return $result;
}

Expand All @@ -62,7 +63,8 @@ public function getSimpleTypes(Type|MixedType $type): array

$key = rawurlencode(serialize($type));

if ($result = $this->simpleTypesCache[$key] ?? null) {
$result = $this->simpleTypesCache[$key] ?? null;
if ($result !== null) {
return $result;
}

Expand Down

0 comments on commit e8b1677

Please sign in to comment.