Skip to content

Conversation

Dean151
Copy link

@Dean151 Dean151 commented Sep 19, 2025

  • introduced bcround, bcfloor and bcceil polyfills
  • RoundingMode cannot be an enum, and const cannot contain an object. This is the best pick I got to simulate an enum for PHP < 8.1
  • Tests are based on PHP bcmath extension official tests: https://github.com/php/php-src/tree/master/ext/bcmath/tests

@Dean151 Dean151 force-pushed the feat/bcceil-bcfloor-bcround branch 5 times, most recently from 394b10a to dd5eded Compare September 21, 2025 21:30
@Dean151 Dean151 requested a review from stof September 25, 2025 08:48

if (\PHP_VERSION_ID < 80400) {
// @author Thomas Durand <[email protected]>
final class RoundingMode {
Copy link
Member

Choose a reason for hiding this comment

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

when PHP >= 8.1 is used, we should use a real enum

Copy link
Author

@Dean151 Dean151 Oct 16, 2025

Choose a reason for hiding this comment

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

@nicolas-grekas When I try to introduce an enum, even behind an if PHP_VERSION_ID, older PHP version are complaining pretty badly on the syntax.
See this CI run
An idea?

@Dean151 Dean151 force-pushed the feat/bcceil-bcfloor-bcround branch 3 times, most recently from 2f04391 to 41c0a15 Compare October 16, 2025 19:59
@Dean151 Dean151 force-pushed the feat/bcceil-bcfloor-bcround branch from 41c0a15 to 8453863 Compare October 17, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants