phpstan-rules icon indicating copy to clipboard operation
phpstan-rules copied to clipboard

allow BcMath\Number in forbidArithmeticOperationOnNonNumber rule

Open JokubasR opened this issue 3 months ago • 1 comments

BcMath\Number class is a class for an arbitrary precision number. These objects support overloaded arithmetic and comparison operators.

https://www.php.net/manual/en/class.bcmath-number.php

Would it be possible to support the BcMath\Number objects in a forbidArithmeticOperationOnNonNumber rule? Arithmetic between BcMath\Number and BcMath\Number or int is supported. BcMath\Number and float give a deprecation warning (https://wiki.php.net/rfc/implicit-float-int-deprecate)

I could try to implement this addition to the rule and provide the PR if there will be any support.

JokubasR avatar Sep 16 '25 17:09 JokubasR

I could try to implement this addition to the rule and provide the PR if there will be any support.

Sure, please send PR.

janedbal avatar Sep 17 '25 08:09 janedbal