Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

Naming to debate ? __stringwithoutstringable ?

intval($stringable) is never allowed, even without strict_types.

The current check in FunctionCallParameterCheck is

$this->ruleLevelHelper->accepts($parameterType, $argumentValueType, $scope->isDeclareStrictTypes());

either we're doing something like

$this->ruleLevelHelper->accepts(
      $parameterType,
      $argumentValueType,
      $scope->isDeclareStrictTypes() || in_array($functionName, ['floatval', 'intval', 'doubleval'], true)
);

either we have to introduce the opposite of StringAlwaysAcceptingObjectWithToStringType like I did.

Closes phpstan/phpstan#6560
Closes #1005

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.

Handle different ways to cast the same

1 participant