php-crisp-api icon indicating copy to clipboard operation
php-crisp-api copied to clipboard

Fix inconsistency in listPeopleEvent method by adding listPeopleEvents & marking listPeopleEvent() deprecated

Open ziming opened this issue 7 months ago • 1 comments

Currently the listPeopleEvent method in Crisp is not consistent with the other methods in the WebsitePeople class. Such as:

  • listPeopleProfiles
  • listPeopleSegments
  • listPeopleConversations

That is, the method name should end with a plural s, but it did not.

This PR adds a listPeopleEvents() method that does the exact same thing. Then mark the listPeopleEvent() method as deprecated using PHP 8.4 deprecated attribute.

According to https://youtrack.jetbrains.com/issue/WI-62847/Option-to-allow-attributes-in-PHP-8.0-in-language-level-inspection

They are not supported in PHP < 8.0, BUT: If every attribute is on a separate line, then PHP 7.0 won't crash, it will simply ignore them.

ziming avatar Jun 22 '25 15:06 ziming

Alternatively you can do this too since the #Deprecated attribute only get triggered in PHP 8.4 (& ignored in earlier versions). trigger_error() is more like a warning rather than a hard code stopping error to my knowledge

/**
 * @deprecated
 *
 */
public function deprecatedMethod(): void
{
    trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
}

ziming avatar Jun 22 '25 17:06 ziming