Skip to content

Conversation

@blobaugh
Copy link
Contributor

Description

The tests were throwing deprecation notices due to dynamic class properties being set. This PR resolves them by explicitly setting the properties.

Example of a notice that was thrown:

Deprecated: Creation of dynamic property WorkOS\WebhookTest::$payload is deprecated

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@blobaugh blobaugh requested a review from a team as a code owner August 27, 2025 15:10
@blobaugh blobaugh requested a review from nicknisi August 27, 2025 15:10
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR addresses PHP 8.2+ deprecation notices by explicitly declaring class properties that were previously being created dynamically in test files. The changes affect 10 test files and one library file, with the primary focus being on resolving "Creation of dynamic property" deprecation warnings.

In the test files (WebhookTest.php, MFATest.php, WidgetsTest.php, DirectorySyncTest.php, OrganizationsTest.php, AuditLogsTest.php, PasswordlessTest.php, PortalTest.php, SSOTest.php, and UserManagementTest.php), the developer added explicit protected property declarations with proper PHPDoc type annotations. These properties were previously being assigned in setUp() methods without being declared, which triggers deprecation notices in PHP 8.2+. Each property is now properly typed (e.g., MFA, Widgets, DirectorySync, etc.) and follows consistent naming and documentation patterns.

The WebhookTest.php file received the most extensive changes, with seven properties being explicitly declared and an additional fix removing a deprecated utf8_decode() call that was replaced with direct assignment.

In the library file UserManagement.php, a type annotation improvement was made to the getLogoutUrl method. The $return_to parameter was updated from string to string|null in the PHPDoc and from string $return_to = null to ?string $return_to = null in the method signature, properly reflecting that this parameter is nullable.

These changes maintain full backward compatibility while ensuring the codebase adheres to modern PHP standards and runs without deprecation warnings on PHP 8.2+.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it only adds property declarations and fixes type annotations
  • Score reflects that these are standard modernization changes that improve PHP 8.2+ compatibility without altering functionality
  • No files require special attention as all changes follow established patterns and best practices

11 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

Copy link
Member

@nicknisi nicknisi left a comment

Choose a reason for hiding this comment

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

These changes look good to me. After some checking, I think the removal of the utf8_decode call looks valid. Thanks for the fixes!

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