Skip to content
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

[11.x] Feauture / Convert Number To A Stringable Format #54073

Closed

Conversation

rmunate
Copy link
Contributor

@rmunate rmunate commented Jan 3, 2025

Hello,

This PR proposes that the spell and spellOrdinal methods, which are already understood to return a string, should directly return a Stringable instance. This would make it easier to manipulate the result by allowing direct use of the methods provided by the Illuminate\Support\Stringable class.

Examples:

Number::spell(10, 'es')->upper();  
Number::spell(10, 'es')->mask('*', 1, 2); // Result: "d**z"

This way, we avoid having to wrap the result manually, as in the following example:

new Stringable(Number::spell(10, 'es'));

This simplifies the workflow and enhances the developer experience. 😊

@rodrigopedra
Copy link
Contributor

As this is a breaking change (even the tests needed to be changed), this should be sent to the master branch.

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

@rmunate rmunate deleted the 11.x]-feature/spell-number-stringable branch January 7, 2025 12:40
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