Skip to content

Commit

Permalink
fix: Fix issues reported by PHPStan (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Nov 12, 2024
1 parent 3ccf859 commit 1379edd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public function denormalize(
FlagParserInterface $parser,
array $unparsedMethod
): MethodCallInterface {
/** @var string|bool $method */
$method = key($unparsedMethod);

if (false === $method
if (null === $method
|| false === is_string($method)
|| 1 !== count($unparsedMethod)
) {
Expand Down
2 changes: 0 additions & 2 deletions tests/Definition/MethodCall/ConfiguratorMethodCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ public function testReadAccessorsReturnPropertiesValues(): void
$caller = new InstantiatedReference('user.factory');
$method = 'setUsername';
$arguments = [new stdClass()];
$percentage = 30;
$stringValue = 'user.factory->setUsername';

$methodCallProphecy = $this->prophesize(MethodCallInterface::class);
$methodCallProphecy->getCaller()->willReturn($caller);
$methodCallProphecy->getMethod()->willReturn($method);
$methodCallProphecy->getArguments()->willReturn($arguments);
$methodCallProphecy->__toString()->willReturn($stringValue);
/** @var MethodCallInterface $caller */
$methodCall = $methodCallProphecy->reveal();

$definition = new ConfiguratorMethodCall($methodCall);
Expand Down
1 change: 0 additions & 1 deletion tests/Definition/MethodCall/OptionalMethodCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function testReadAccessorsReturnPropertiesValues(): void
$methodCallProphecy->getMethod()->willReturn($method);
$methodCallProphecy->getArguments()->willReturn($arguments);
$methodCallProphecy->__toString()->willReturn($stringValue);
/** @var MethodCallInterface $caller */
$methodCall = $methodCallProphecy->reveal();

$flag = new OptionalFlag($percentage);
Expand Down

0 comments on commit 1379edd

Please sign in to comment.