Having a 15-year-old project in hand now with Yii 1.1 and PHP 5.4. After a big decision, planned to upgrade the PHP version and keep running the project, and almost achieved it.
After upgrading, I fixed some config and related deprecated functions and successfully ran it on the server. But in some pages/functions, I got this error:
Exception 1 : round(): Argument #1 ($num) must be of type int|float, string given
Exception 2 : Unsupported operand types: string * int
I produced a fix like below,
For Exception 1:
return round($number, 5);
to: (type casting)
return round((int)$number, 5);
For Exception 2:
return ($a + 10);
to: (type cast)
return ((int)$a + 10);
And the error ceased.
It would happen on other files/functions too. Because the project contains almost 4000+ files
So, I want to know, is there some actual solution instead of changing manually in all files with type mismatch?