mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-21 10:32:24 +00:00
Updated Rector to commit 5d1286061c8bf264c95085edf8b24731cf62c91e
5d1286061c
BinaryOpBetweenNumberAndStringRector don't trust phpdoc (#5199)
This commit is contained in:
parent
1b058fde9f
commit
fe7a135a9e
|
@ -245,7 +245,7 @@ final class NodeTypeResolver
|
|||
}
|
||||
public function isNumberType(Expr $expr) : bool
|
||||
{
|
||||
$nodeType = $this->getType($expr);
|
||||
$nodeType = $this->getNativeType($expr);
|
||||
if ($nodeType->isInteger()->yes()) {
|
||||
return \true;
|
||||
}
|
||||
|
|
|
@ -88,17 +88,17 @@ CODE_SAMPLE
|
|||
if ($this->exprAnalyzer->isNonTypedFromParam($node->right)) {
|
||||
return null;
|
||||
}
|
||||
if ($this->isStringOrStaticNonNumbericString($node->left) && $this->nodeTypeResolver->isNumberType($node->right)) {
|
||||
if ($this->isStringOrStaticNonNumericString($node->left) && $this->nodeTypeResolver->isNumberType($node->right)) {
|
||||
$node->left = new LNumber(0);
|
||||
return $node;
|
||||
}
|
||||
if ($this->isStringOrStaticNonNumbericString($node->right) && $this->nodeTypeResolver->isNumberType($node->left)) {
|
||||
if ($this->isStringOrStaticNonNumericString($node->right) && $this->nodeTypeResolver->isNumberType($node->left)) {
|
||||
$node->right = new LNumber(0);
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private function isStringOrStaticNonNumbericString(Expr $expr) : bool
|
||||
private function isStringOrStaticNonNumericString(Expr $expr) : bool
|
||||
{
|
||||
// replace only scalar values, not variables/constants/etc.
|
||||
if (!$expr instanceof Scalar && !$expr instanceof Variable) {
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '98bb8581e5794641db7e2acf0cefa14f62f5e8a9';
|
||||
public const PACKAGE_VERSION = '5d1286061c8bf264c95085edf8b24731cf62c91e';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-10-25 15:07:54';
|
||||
public const RELEASE_DATE = '2023-10-25 20:41:16';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user