Skip to content

Type Casts added #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Type Casts added #22

wants to merge 10 commits into from

Conversation

vansari
Copy link

@vansari vansari commented Jan 2, 2023

PR Description

  • added type casts in builtin function usage

Checklist

  • I agree with the Code Contribution License Agreement in CONTRIBUTING.md

@codecov
Copy link

codecov bot commented Jan 2, 2023

Codecov Report

Merging #22 (fc05559) into master (f2db382) will not change coverage.
The diff coverage is 85.71%.

@@            Coverage Diff            @@
##             master      #22   +/-   ##
=========================================
  Coverage     94.37%   94.37%           
  Complexity      103      103           
=========================================
  Files             1        1           
  Lines           231      231           
=========================================
  Hits            218      218           
  Misses           13       13           
Impacted Files Coverage Δ
src/Decimal.php 94.37% <85.71%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@vansari
Copy link
Author

vansari commented Jan 8, 2023

@dereuromark The phpstan grumbles because of the return value from preg_replace in function fromScientific and I added a check that the result value must be a string and not an array nor null.

But now I have to add an codeCoverageStart / End because the codecov was the next tool which has grumbled now.

Should I revoke the check?

@dereuromark dereuromark added the improvement New feature or request label Feb 15, 2023
@vansari vansari requested a review from dereuromark February 18, 2023 19:57
@@ -831,7 +831,7 @@ protected function fromScientific(string $value, ?int $scale): void
} else {
$this->integralPart = bcmul($matches[2], bcpow('10', (string)$exp));

$pos = strlen((string)$this->integralPart);
$pos = strlen($this->integralPart);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove the string cast here, shouldnt we also remove it in line 841?

$this->fractionalPart = str_pad($this->fractionalPart, $scale - strlen((string)$this->integralPart), '0');

@dereuromark
Copy link
Contributor

@gechetspr will have to check and merge. Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants