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

Update Pie.php #88

Merged
merged 3 commits into from
May 27, 2023
Merged

Update Pie.php #88

merged 3 commits into from
May 27, 2023

Conversation

eclipxe13
Copy link
Contributor

Fix PHP 8.2 deprecation: Creation of dynamic property CpChart\\Chart\\Pie::$Shadow is deprecated. This happens because the property Shadow belongs to $this->pChartObject and not to $this.

Fix PHP 8.2 deprecation: Creation of dynamic property `CpChart\\Chart\\Pie::$Shadow` is deprecated.
This happens because the property Shadow belongs to `$this->pChartObject` and not to `$this`.
@szymach
Copy link
Owner

szymach commented May 22, 2023

Hello!
Sorry for the late response, I was away for the last week. From what I see there is a similar issue here. Can you please change that line too?

Thank you.

@eclipxe13
Copy link
Contributor Author

No worries. I change it as soon I get to my computer.

@eclipxe13
Copy link
Contributor Author

I had search the hole project and only see this issue on Scatter.php, I think that with b31bdb9 is fixed.

@eclipxe13
Copy link
Contributor Author

Please, hold on, after run codecept on PHP 8.2 I see a similar issue here:

There was 1 error:

---------
1) SpringTest: Chart render
 Test  tests/unit/SpringTest.php:testChartRender
                                                                                                                         
  [PHPUnit\Framework\Error\Deprecated] Creation of dynamic property CpChart\Chart\Spring::$MagneticForceA is deprecated  
                                                                                                                         
#1  /home/eclipxe/work/github/c-pchart/src/Chart/Spring.php:871
#2  /home/eclipxe/work/github/c-pchart/tests/unit/SpringTest.php:106
#3  /home/eclipxe/work/github/c-pchart/vendor/bin/codecept:120

ERRORS!
Tests: 37, Assertions: 51, Errors: 1.

@eclipxe13
Copy link
Contributor Author

Related to previous commit ca9a196

The variables are set up on drawSprint and not outside the object, this is why I declared as private.

MagneticForceA, MagneticForceR are used on drawSpring & doPass, doPass is called by drawSpring.

RingSize is used on drawSpring & firstPass, firstPass is called by drawSpring.

A better approach would be to change the signature of doPass and firstPass, but these methods are public (even when they are not intended to be used outside the object). The signature would include change the methods to private and receive the properties as arguments. I has not use this approach since it introduces a breaking compatibility issue.

@szymach
Copy link
Owner

szymach commented May 27, 2023

Hello,
Sorry for the delay. Travis for some reason thinks I have a negative credit balance, even though I do not, so I could not verify the PR through the CI. I have ran your test locally and your changes seem to be OK.

As for your proposed changes to approach, well, they will have to wait. I need to cover the library with static analysis and some tests that verify image output. Without that I have no certainty how any refactors will impact the produced charts.

However, thank you for your contribution :)

@szymach szymach merged commit c022568 into szymach:3.0 May 27, 2023
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.

2 participants