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

introduce Teller class #630

Merged
merged 18 commits into from
Jun 14, 2023
Merged

introduce Teller class #630

merged 18 commits into from
Jun 14, 2023

Conversation

pmjones
Copy link
Contributor

@pmjones pmjones commented Mar 16, 2021

This PR introduces a Teller class, nominally to help ease legacy codebases away from float math over to using Money object.

It differs from the tentative offering in #629 in several ways, most notably that it is PHP 5.6 compatible, and reproduces a larger number of Money methods, using their same names.

I have attempted to match the existing project conventions; please let me know if changes of any kind are needed.

Tests and docs are included.

fixes #629

@pmjones
Copy link
Contributor Author

pmjones commented Mar 16, 2021

After making several changes to soothe the CI checks, all remaining failures appear to be problem with the build system, not with the PR.

@pmjones pmjones mentioned this pull request Mar 16, 2021
@frederikbosch frederikbosch self-assigned this Apr 22, 2021
@frederikbosch frederikbosch added this to the 4.0.0 milestone Apr 22, 2021
@frederikbosch frederikbosch modified the milestones: 4.0.0, 4.1.0 May 2, 2021
@frederikbosch frederikbosch removed their assignment May 6, 2021
@lukeholder
Copy link

lukeholder commented May 31, 2023

Is this planned to be merged?

@frederikbosch
Copy link
Member

We should rebase this towards current master.

@lukeholder
Copy link

@frederikbosch looks like it’s merged

also, PhpCalculator is gone, so use default calculator
@pmjones
Copy link
Contributor Author

pmjones commented Jun 7, 2023

@frederikbosch @lukeholder I have updated to master. However, a problem is revealed in testing.

Previously, I used the PhpCalculator for the Teller tests, and the it_multiplies_amounts and it_divides_amounts tests passed; however, using the default calculator, they do not -- the multiplication and division appear to be off. (Running the math of the tests through something like a spreadsheet indicates the expected values are correct.)

How to proceed?

Copy link
Member

@frederikbosch frederikbosch left a comment

Choose a reason for hiding this comment

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

First review. I think there be a second one needed, because of the time I have myself to review a PR of this size, but I feel this is close to the finish line already.

src/Teller.php Outdated Show resolved Hide resolved
src/Teller.php Outdated Show resolved Hide resolved
tests/TellerTest.php Outdated Show resolved Hide resolved
tests/TellerTest.php Show resolved Hide resolved
tests/TellerTest.php Outdated Show resolved Hide resolved
@frederikbosch
Copy link
Member

Great work @pmjones, and thanks for the quick response, especially after us not giving this time in the first place.

@pmjones
Copy link
Contributor Author

pmjones commented Jun 13, 2023

@frederikbosch I will make the changes as noted. Shall I also add property typehints?

@pmjones
Copy link
Contributor Author

pmjones commented Jun 13, 2023

@frederikbosch All corrections made, and added some more typehinting to soothe Psalm (though it still complains a bit).

@frederikbosch
Copy link
Member

If you can allow edits from maintainers, I am happy to commit some changes.

@pmjones
Copy link
Contributor Author

pmjones commented Jun 14, 2023

I have sent you a "collaborator" invitation!

@frederikbosch
Copy link
Member

All checks are green. The class is now final, as all classes in this package are I believe. Otherwise, mostly code style and docblock changes.

@frederikbosch
Copy link
Member

@pmjones If you believe this is good to go, we can merge it in.

@pmjones
Copy link
Contributor Author

pmjones commented Jun 14, 2023

@frederikbosch Send it!

@frederikbosch frederikbosch merged commit a1646ad into moneyphp:master Jun 14, 2023
8 checks passed
@frederikbosch
Copy link
Member

Thanks for the work @pmjones. After quite some time, but it did finally get included in the package!

@pmjones
Copy link
Contributor Author

pmjones commented Jun 14, 2023

@frederikbosch I know how these things go -- everyone is working on their own time. Thanks for getting to it at all!

@lukeholder
Copy link

Has this been tagged in a release?

@frederikbosch
Copy link
Member

Not yet, don't know why not. I'll tag today.

@frederikbosch
Copy link
Member

Done!

@pmjones
Copy link
Contributor Author

pmjones commented Aug 16, 2023

Thanks @frederikbosch ! (Not to be a nag, but the moneyphp.org site probably needs the updated docs for Teller as well.)

@frederikbosch
Copy link
Member

In all these years that I am doing this, I think I have maybe once logged in there. I will try to fix this, but it will take some time to figure how this works, and how to gain access. I always believed that we automated this.

@pmjones
Copy link
Contributor Author

pmjones commented Aug 16, 2023

/me nods

No rush on my part, and thanks again!

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.

Offer a "Teller" object
3 participants