Skip to content

Commit

Permalink
fix phpcs-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ahjdev committed Jul 27, 2024
1 parent 983ad12 commit 6d5ac03
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 39 deletions.
16 changes: 8 additions & 8 deletions src/PseudoTypes/Conditional.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public function getSubject(): Type
public function __toString(): string
{
return sprintf(
'(%s %s %s ? %s : %s)',
$this->subject,
$this->negated ? 'is not' : 'is',
$this->target,
$this->if,
$this->else
);
}
'(%s %s %s ? %s : %s)',
$this->subject,

Check failure on line 44 in src/PseudoTypes/Conditional.php

View workflow job for this annotation

GitHub Actions / Static analysis / Static Code Analysis (8.0)

ImplicitToStringCast

src/PseudoTypes/Conditional.php:44:13: ImplicitToStringCast: Argument 2 of sprintf expects float|int|string, but phpDocumentor\Reflection\Type provided with a __toString method (see https://psalm.dev/060)
$this->negated ? 'is not' : 'is',
$this->target,

Check failure on line 46 in src/PseudoTypes/Conditional.php

View workflow job for this annotation

GitHub Actions / Static analysis / Static Code Analysis (8.0)

ImplicitToStringCast

src/PseudoTypes/Conditional.php:46:13: ImplicitToStringCast: Argument 4 of sprintf expects float|int|string, but phpDocumentor\Reflection\Type provided with a __toString method (see https://psalm.dev/060)
$this->if,

Check failure on line 47 in src/PseudoTypes/Conditional.php

View workflow job for this annotation

GitHub Actions / Static analysis / Static Code Analysis (8.0)

ImplicitToStringCast

src/PseudoTypes/Conditional.php:47:13: ImplicitToStringCast: Argument 5 of sprintf expects float|int|string, but phpDocumentor\Reflection\Type provided with a __toString method (see https://psalm.dev/060)
$this->else

Check failure on line 48 in src/PseudoTypes/Conditional.php

View workflow job for this annotation

GitHub Actions / Static analysis / Static Code Analysis (8.0)

ImplicitToStringCast

src/PseudoTypes/Conditional.php:48:13: ImplicitToStringCast: Argument 6 of sprintf expects float|int|string, but phpDocumentor\Reflection\Type provided with a __toString method (see https://psalm.dev/060)
);
}
}
16 changes: 8 additions & 8 deletions src/PseudoTypes/ConditionalParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public function getParameterName(): string
public function __toString(): string
{
return sprintf(
'(%s %s %s ? %s : %s)',
$this->parameter,
$this->negated ? 'is not' : 'is',
$this->target,
$this->if,
$this->else
);
}
'(%s %s %s ? %s : %s)',
$this->parameter,
$this->negated ? 'is not' : 'is',
$this->target,

Check failure on line 46 in src/PseudoTypes/ConditionalParameter.php

View workflow job for this annotation

GitHub Actions / Static analysis / Static Code Analysis (8.0)

ImplicitToStringCast

src/PseudoTypes/ConditionalParameter.php:46:13: ImplicitToStringCast: Argument 4 of sprintf expects float|int|string, but phpDocumentor\Reflection\Type provided with a __toString method (see https://psalm.dev/060)
$this->if,

Check failure on line 47 in src/PseudoTypes/ConditionalParameter.php

View workflow job for this annotation

GitHub Actions / Static analysis / Static Code Analysis (8.0)

ImplicitToStringCast

src/PseudoTypes/ConditionalParameter.php:47:13: ImplicitToStringCast: Argument 5 of sprintf expects float|int|string, but phpDocumentor\Reflection\Type provided with a __toString method (see https://psalm.dev/060)
$this->else

Check failure on line 48 in src/PseudoTypes/ConditionalParameter.php

View workflow job for this annotation

GitHub Actions / Static analysis / Static Code Analysis (8.0)

ImplicitToStringCast

src/PseudoTypes/ConditionalParameter.php:48:13: ImplicitToStringCast: Argument 6 of sprintf expects float|int|string, but phpDocumentor\Reflection\Type provided with a __toString method (see https://psalm.dev/060)
);
}
}
14 changes: 7 additions & 7 deletions src/PseudoTypes/OffsetAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public function underlyingType(): Type
*/
public function __toString(): string
{
if (
$this->valueType instanceof Callable_
|| $this->valueType instanceof Nullable
) {
return '(' . $this->valueType . ')[' . $this->offsetType . ']';
}
if (
$this->valueType instanceof Callable_
|| $this->valueType instanceof Nullable
) {
return '(' . $this->valueType . ')[' . $this->offsetType . ']';
}

return $this->valueType . '[' . $this->offsetType . ']';
return $this->valueType . '[' . $this->offsetType . ']';
}
}
33 changes: 17 additions & 16 deletions src/TypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,8 @@
use phpDocumentor\Reflection\PseudoTypes\ProtectedPropertiesOf;
use phpDocumentor\Reflection\PseudoTypes\PublicPropertiesOf;
use phpDocumentor\Reflection\PseudoTypes\ValueOf;
use function trim;
use function strpos;
use function sprintf;
use RuntimeException;
use function in_array;
use function array_map;
use function get_class;
use function strtolower;
use function array_filter;
use function class_exists;
use function array_reverse;
use InvalidArgumentException;
use function array_key_exists;
use function class_implements;
use phpDocumentor\Reflection\Type;
use PHPStan\PhpDocParser\Lexer\Lexer;
use Doctrine\Deprecations\Deprecation;
Expand Down Expand Up @@ -112,7 +100,6 @@
use phpDocumentor\Reflection\PseudoTypes\ArrayShapeItem;
use phpDocumentor\Reflection\PseudoTypes\CallableString;
use phpDocumentor\Reflection\PseudoTypes\NonEmptyString;

use phpDocumentor\Reflection\PseudoTypes\ConstExpression;
use phpDocumentor\Reflection\PseudoTypes\LowercaseString;
use phpDocumentor\Reflection\PseudoTypes\NegativeInteger;
Expand All @@ -125,7 +112,20 @@
use PHPStan\PhpDocParser\Ast\Type\CallableTypeParameterNode;
use phpDocumentor\Reflection\PseudoTypes\ConditionalParameter;
use phpDocumentor\Reflection\PseudoTypes\NonEmptyLowercaseString;

use PHPStan\PhpDocParser\Ast\Type\ConditionalTypeForParameterNode;
use function trim;
use function strpos;
use function sprintf;
use function in_array;
use function array_map;
use function get_class;
use function strtolower;
use function array_filter;
use function class_exists;
use function array_reverse;
use function array_key_exists;
use function class_implements;

final class TypeResolver
{
Expand Down Expand Up @@ -290,6 +290,7 @@ function (ArrayShapeItemNode $item) use ($context): ListShapeItem {
default:
throw new RuntimeException('Unsupported array shape kind');
}
// no break
case ObjectShapeNode::class:
return new ObjectShape(
...array_map(
Expand Down Expand Up @@ -464,7 +465,7 @@ private function createFromGeneric(GenericTypeNode $type, Context $context): Typ
return new PrivatePropertiesOf(
$subType->getFqsen()
);

case 'list':
return new List_(
$this->createType($type->genericTypes[0], $context)
Expand All @@ -474,12 +475,12 @@ private function createFromGeneric(GenericTypeNode $type, Context $context): Typ
return new NonEmptyList(
$this->createType($type->genericTypes[0], $context)
);

case 'key-of':
return new KeyOf(
$this->createType($type->genericTypes[0], $context)
);

case 'value-of':
return new ValueOf(
$this->createType($type->genericTypes[0], $context)
Expand Down

0 comments on commit 6d5ac03

Please sign in to comment.