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

[REF][PHP8.2] Avoid dynamic properties in api_v3_EventTest #25375

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

braders
Copy link
Contributor

@braders braders commented Jan 18, 2023

Overview

Avoid dynamic properties in api_v3_EventTest, as dynamic properties are deprecated in PHP8.2

Before

This class was a bit of a mess. _events and _eventIds were being used with a mixture of leading underscore and no leading underscore, and neither version was explicitely declared. Whilst the tests were actually working correctly, it meant some of the code was not running quite as originally expected.

After

_events and _eventIds are explicitely declared, no longer dynamic.

I've stuck with the leading underscore (even though I'm not the fan) as these were the params in most frequent use throughout the class.

@civibot
Copy link

civibot bot commented Jan 18, 2023

(Standard links)

@civibot civibot bot added the master label Jan 18, 2023
@@ -82,9 +92,6 @@ public function setUp(): void {
}

public function tearDown(): void {
foreach ($this->eventIds as $eventId) {
$this->eventDelete($eventId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code was never being reached as eventIds was the wrong property. It's also unnecessary as the event and participant tables are truncated a couple of lines down!

Copy link
Member

Choose a reason for hiding this comment

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

🤦

@totten
Copy link
Member

totten commented Jan 18, 2023

I've stuck with the leading underscore (even though I'm not the fan) as these were the params in most frequent use throughout the class.

Aaah, thanks for explaining. That makes perfect sense.

@totten totten merged commit e758fe8 into civicrm:master Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants