Skip to content

Commit 34e97d4

Browse files
authored
Merge pull request #2 from Megatherium/master
Conditionally avoid method calls deprecated in PHP8
2 parents d057559 + b49068a commit 34e97d4

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

PHPUnit/Util/Class.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,24 +149,19 @@ public static function getMethodParameters($method, $forCall = FALSE)
149149
$typeHint = '';
150150

151151
if (!$forCall) {
152-
if ($parameter->isArray()) {
153-
$typeHint = 'array ';
154-
}
155-
156-
else if (version_compare(PHP_VERSION, '5.4', '>') &&
152+
if (PHP_VERSION_ID >= 80000 ) {
153+
$typeHint = $parameter->hasType() ? (string)$parameter->getType() : 'mixed';
154+
} elseif ($parameter->isArray()) {
155+
$typeHint = 'array';
156+
} elseif (version_compare(PHP_VERSION, '5.4', '>') &&
157157
$parameter->isCallable()) {
158158
$typeHint = 'callable ';
159-
}
160-
161-
else {
159+
} else {
162160
try {
163161
$class = $parameter->getClass();
164-
}
165-
166-
catch (ReflectionException $e) {
162+
} catch (ReflectionException $e) {
167163
$class = FALSE;
168164
}
169-
170165
if ($class) {
171166
$typeHint = $class->getName() . ' ';
172167
}

PHPUnit/Util/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ protected function __construct($filename)
196196
/**
197197
* @since Method available since Release 3.4.0
198198
*/
199-
private final function __clone()
199+
private function __clone()
200200
{
201201
}
202202

Tests/_files/Singleton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ protected function __construct()
77
{
88
}
99

10-
private final function __clone()
10+
private function __clone()
1111
{
1212
}
1313

0 commit comments

Comments
 (0)