-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from ably/php82
Improve PHP 8.2 compatibility and testing
- Loading branch information
Showing
5 changed files
with
47 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace tests; | ||
|
||
/** | ||
* PHPUnit has deprecated the old function `assertRegExp` for asserting regular | ||
* expression matches. However, the versions of PHPUnit compatible with PHP 7.2 do | ||
* not have the new version. | ||
* | ||
* This trait adds a version of the method that calls the old version for PHP 7.2 | ||
* or the new version for newer versions. | ||
* | ||
* Can be removed once PHP 7.2 is dropped from CI. | ||
*/ | ||
trait AssertsRegularExpressions | ||
{ | ||
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void | ||
{ | ||
if (version_compare(phpversion(), '7.3.0', '<')) { | ||
self::assertRegExp($pattern, $string, $message); | ||
return; | ||
} | ||
|
||
parent::assertMatchesRegularExpression($pattern, $string, $message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters