Problem/Motivation

Follow up from #3142934-27: Replace \Drupal\Component\Utility\Bytes::toInt() with \Drupal\Component\Utility\Bytes::toNumber() due to return type comment #27

We would need to add a new toFloat() method instead, deprecate toInt(), and file a follow-up to remove in D10. But that would be a separate issue IMHO.

Very large bytes sizes (yottabytes, zettabytes) cannot be represented by an INT, not even in 64-bit PHP. Only FLOAT can support that magnitude.

Proposed resolution

Deprecate method Bytes::toInt() for removal in D10.
Add a Bytes::toNumber() that alwas returns a float.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Original report

Follow up from #3142934-27: Replace \Drupal\Component\Utility\Bytes::toInt() with \Drupal\Component\Utility\Bytes::toNumber() due to return type comment #27

Comments

DevJoJodae created an issue. See original summary.

mondrake’s picture

Title: Rename method Bytes::toInt() to Bytes::toByte() » Rename method Bytes::toInt() to Bytes::toNumber()
Issue summary: View changes
Parent issue: » #3161730: [META] Refactor \Drupal\Component\Utility\Bytes::toInt()

I'd rather suggest Bytes::toNumber.

mondrake’s picture

Status: Active » Closed (duplicate)

Closing in favor of the parent, which has been rescoped.