phpstan-src
phpstan-src copied to clipboard
Introduce `__stringnotstringable`
Naming to debate ? __stringwithoutstringable ? __strictstring ?
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 https://github.com/phpstan/phpstan/issues/6560 Closes https://github.com/phpstan/phpstan-src/pull/1005