Skip to content

changed $trenType to $trendMethod in case TREND_BEST_FIT #4339

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

Merged
merged 6 commits into from
Mar 12, 2025

Conversation

quonly
Copy link
Contributor

@quonly quonly commented Feb 3, 2025

Fix TREND_BEST_FIT_NO_POLY. This resolves one of the problems in PR #4400. It does not attempt to resolve the other main problem in that issue, the fact that Polynomial Best Fit is mis-coded; it is unclear what needs to be done to fix that.

This change could be consider breaking. I think it is unlikely that any existing code will actually break. Use of Polynomial Best Fit will currently run into errors when it tries to treat a float property as an array, which it does in many places. It will be changed to throw an exception in the constructor until those problems are fixed. One place where BestFit issues triggerError will be replaced with an exception. Trend::calculate will now throw an exception if the trend type is unrecognized rather than returning false; this is not a particularly legitimate use case, and it allows us to always return BestFit rather than mixed. None of the conditions for which we will now throw exceptions were part of the unit test suite; they are now.

Some unit tests are added. Draft PR #1907 does not yet add any unit tests, nor does it address the Polynomial problem. It is not clear if it is compatible with this change.

@oleibman
Copy link
Collaborator

oleibman commented Feb 3, 2025

Is there an issue which you are fixing? If so, please open an issue so that we can track it better. Also, please add a formal unit test which fails with the existing code but succeeds with your change.

oleibman added 4 commits March 9, 2025 20:21
Having Trend:calculate return BestFit rather than mixed eliminates many Phpstan messages in baseline.neon.
@oleibman oleibman enabled auto-merge March 12, 2025 06:46
@oleibman oleibman added this pull request to the merge queue Mar 12, 2025
Merged via the queue into PHPOffice:master with commit 5868f89 Mar 12, 2025
13 of 14 checks passed
@oleibman
Copy link
Collaborator

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants