Found a weird thing in PHPStorm. It doesn't like it when you try to "add" (using the plus sign) the output of line item quantities because they are declared to be strings and one cannot sum strings, one can only concatenate them.

So it seems like this is a harmless typo, but unsure. Patch to follow to show what I mean.

String vs. Number error

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joshmiller created an issue. See original summary.

joshmiller’s picture

Status: Active » Needs review
FileSize
769 bytes

I know that some math operations need strings to keep significant figures (zeros behind the decimal point). If that is the case here, can we get a quick comment on that for future devs that like to check up on "errors"?

rszrama’s picture

Category: Bug report » Support request
Status: Needs review » Closed (works as designed)

Closing per our discussion in Slack.

bojanz’s picture

Title: Type the line item quantity returns as float and not string or document why. » Use the calculator for quantity manipulation
Category: Support request » Task
Status: Closed (works as designed) » Active

Let's use this issue to replace the code shown in the summary with the correct code that uses the Calculator.

  • bojanz committed 0c2d9c3 on 8.x-2.x
    Issue #2790583 by joshmiller, bojanz: Use the calculator for quantity...
bojanz’s picture

Status: Active » Fixed

There we go.

joshmiller’s picture

<3

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.