Skip to content

Conversation

Khartir
Copy link
Contributor

@Khartir Khartir commented Jul 24, 2025

Hope this is OK, I just cloned this rule for thecodingmachine/phpstan-safe-rule#61 and found these deprecated checks.

@Khartir Khartir force-pushed the replace_instanceof_in_JsonThrowOnErrorDynamicReturnTypeExtension branch from 1736892 to cbd6c91 Compare July 24, 2025 19:47
@@ -109,7 +115,7 @@ private function isForceArray(FuncCall $funcCall, Scope $scope): bool
}

$secondArgType = $scope->getType($args[1]->value);
$secondArgValue = $secondArgType instanceof ConstantScalarType ? $secondArgType->getValue() : null;
$secondArgValue = count($secondArgType->getConstantScalarValues()) === 1 ? $secondArgType->getConstantScalarValues()[0] : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$secondArgType->getConstantScalarValues() with more than one value should also be properly handled here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants