Skip to content

Commit 5c6509b

Browse files
[PhpUnitBridge] bump "php" to 7.1+ and "phpunit" to 7.5+
1 parent 753e48c commit 5c6509b

28 files changed

+59
-675
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
5.3.0
5+
-----
6+
7+
* bumped the minimum PHP version to 7.1.3
8+
* bumped the minimum PHPUnit version to 7.5
9+
410
5.1.0
511
-----
612

Diff for: ClassExistsMock.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static function trait_exists($name, $autoload = true)
4545

4646
public static function register($class)
4747
{
48-
$self = \get_called_class();
48+
$self = static::class;
4949

5050
$mockedNs = [substr($class, 0, strrpos($class, '\\'))];
5151
if (0 < strpos($class, '\\Tests\\')) {

Diff for: ClockMock.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function gmdate($format, $timestamp = null)
9292

9393
public static function register($class)
9494
{
95-
$self = \get_called_class();
95+
$self = static::class;
9696

9797
$mockedNs = [substr($class, 0, strrpos($class, '\\'))];
9898
if (0 < strpos($class, '\\Tests\\')) {

Diff for: ConstraintTrait.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
use ReflectionClass;
1616

1717
$r = new ReflectionClass(Constraint::class);
18-
if (\PHP_VERSION_ID < 70000 || !$r->getMethod('matches')->hasReturnType()) {
19-
trait ConstraintTrait
20-
{
21-
use Legacy\ConstraintTraitForV6;
22-
}
23-
} elseif ($r->getProperty('exporter')->isProtected()) {
18+
if ($r->getProperty('exporter')->isProtected()) {
2419
trait ConstraintTrait
2520
{
2621
use Legacy\ConstraintTraitForV7;

Diff for: CoverageListener.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111

1212
namespace Symfony\Bridge\PhpUnit;
1313

14-
if (version_compare(\PHPUnit\Runner\Version::id(), '6.0.0', '<')) {
15-
class_alias('Symfony\Bridge\PhpUnit\Legacy\CoverageListenerForV5', 'Symfony\Bridge\PhpUnit\CoverageListener');
16-
} elseif (version_compare(\PHPUnit\Runner\Version::id(), '7.0.0', '<')) {
17-
class_alias('Symfony\Bridge\PhpUnit\Legacy\CoverageListenerForV6', 'Symfony\Bridge\PhpUnit\CoverageListener');
18-
} else {
19-
class_alias('Symfony\Bridge\PhpUnit\Legacy\CoverageListenerForV7', 'Symfony\Bridge\PhpUnit\CoverageListener');
20-
}
14+
class_alias('Symfony\Bridge\PhpUnit\Legacy\CoverageListenerForV7', 'Symfony\Bridge\PhpUnit\CoverageListener');
2115

2216
if (false) {
2317
class CoverageListener

Diff for: DeprecationErrorHandler.php

+4-10
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
*/
2626
class DeprecationErrorHandler
2727
{
28-
const MODE_DISABLED = 'disabled';
29-
const MODE_WEAK = 'max[total]=999999&verbose=0';
30-
const MODE_STRICT = 'max[total]=0';
28+
public const MODE_DISABLED = 'disabled';
29+
public const MODE_WEAK = 'max[total]=999999&verbose=0';
30+
public const MODE_STRICT = 'max[total]=0';
3131

3232
private $mode;
3333
private $configuration;
@@ -238,13 +238,7 @@ private function getConfiguration()
238238
return $this->configuration;
239239
}
240240
if (false === $mode = $this->mode) {
241-
if (isset($_SERVER['SYMFONY_DEPRECATIONS_HELPER'])) {
242-
$mode = $_SERVER['SYMFONY_DEPRECATIONS_HELPER'];
243-
} elseif (isset($_ENV['SYMFONY_DEPRECATIONS_HELPER'])) {
244-
$mode = $_ENV['SYMFONY_DEPRECATIONS_HELPER'];
245-
} else {
246-
$mode = getenv('SYMFONY_DEPRECATIONS_HELPER');
247-
}
241+
$mode = $_SERVER['SYMFONY_DEPRECATIONS_HELPER'] ?? $_ENV['SYMFONY_DEPRECATIONS_HELPER'] ?? getenv('SYMFONY_DEPRECATIONS_HELPER');
248242
}
249243
if ('strict' === $mode) {
250244
return $this->configuration = Configuration::inStrictMode();

Diff for: DeprecationErrorHandler/Configuration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public static function fromUrlEncodedString($serializedConfiguration)
278278
}
279279

280280
return new self(
281-
isset($normalizedConfiguration['max']) ? $normalizedConfiguration['max'] : [],
281+
$normalizedConfiguration['max'] ?? [],
282282
'',
283283
$verboseOutput,
284284
filter_var($normalizedConfiguration['generateBaseline'], \FILTER_VALIDATE_BOOLEAN),

Diff for: DeprecationErrorHandler/Deprecation.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
*/
2222
class Deprecation
2323
{
24-
const PATH_TYPE_VENDOR = 'path_type_vendor';
25-
const PATH_TYPE_SELF = 'path_type_internal';
26-
const PATH_TYPE_UNDETERMINED = 'path_type_undetermined';
24+
public const PATH_TYPE_VENDOR = 'path_type_vendor';
25+
public const PATH_TYPE_SELF = 'path_type_internal';
26+
public const PATH_TYPE_UNDETERMINED = 'path_type_undetermined';
2727

28-
const TYPE_SELF = 'type_self';
29-
const TYPE_DIRECT = 'type_direct';
30-
const TYPE_INDIRECT = 'type_indirect';
31-
const TYPE_UNDETERMINED = 'type_undetermined';
28+
public const TYPE_SELF = 'type_self';
29+
public const TYPE_DIRECT = 'type_direct';
30+
public const TYPE_INDIRECT = 'type_indirect';
31+
public const TYPE_UNDETERMINED = 'type_undetermined';
3232

3333
private $trace = [];
3434
private $message;
@@ -61,10 +61,10 @@ public function __construct($message, array $trace, $file)
6161

6262
$this->trace = $trace;
6363

64-
if ('trigger_error' === (isset($trace[1]['function']) ? $trace[1]['function'] : null)
65-
&& (DebugClassLoader::class === ($class = (isset($trace[2]['class']) ? $trace[2]['class'] : null)) || LegacyDebugClassLoader::class === $class)
66-
&& 'checkClass' === (isset($trace[2]['function']) ? $trace[2]['function'] : null)
67-
&& null !== ($extraFile = (isset($trace[2]['args'][1]) ? $trace[2]['args'][1] : null))
64+
if ('trigger_error' === ($trace[1]['function'] ?? null)
65+
&& (DebugClassLoader::class === ($class = $trace[2]['class'] ?? null) || LegacyDebugClassLoader::class === $class)
66+
&& 'checkClass' === ($trace[2]['function'] ?? null)
67+
&& null !== ($extraFile = $trace[2]['args'][1] ?? null)
6868
&& '' !== $extraFile
6969
&& false !== $extraFile = realpath($extraFile)
7070
) {
@@ -118,7 +118,7 @@ private function lineShouldBeSkipped(array $line)
118118
}
119119
$class = $line['class'];
120120

121-
return 'ReflectionMethod' === $class || 0 === strpos($class, 'PHPUnit_') || 0 === strpos($class, 'PHPUnit\\');
121+
return 'ReflectionMethod' === $class || 0 === strpos($class, 'PHPUnit\\');
122122
}
123123

124124
/**
@@ -290,7 +290,7 @@ private static function getVendors()
290290
foreach (get_declared_classes() as $class) {
291291
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
292292
$r = new \ReflectionClass($class);
293-
$v = \dirname(\dirname($r->getFileName()));
293+
$v = \dirname($r->getFileName(), 2);
294294
if (file_exists($v.'/composer/installed.json')) {
295295
self::$vendors[] = $v;
296296
$loader = require $v.'/autoload.php';

Diff for: DeprecationErrorHandler/DeprecationGroup.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ public function addNotice()
5555
*/
5656
private function deprecationNotice($message)
5757
{
58-
if (!isset($this->deprecationNotices[$message])) {
59-
$this->deprecationNotices[$message] = new DeprecationNotice();
60-
}
61-
62-
return $this->deprecationNotices[$message];
58+
return $this->deprecationNotices[$message] ?? $this->deprecationNotices[$message] = new DeprecationNotice();
6359
}
6460

6561
public function count()

Diff for: DnsMock.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static function dns_get_record($hostname, $type = \DNS_ANY, &$authns = nu
152152
$records = [];
153153

154154
foreach (self::$hosts[$hostname] as $record) {
155-
if (isset(self::$dnsTypes[$record['type']]) && (self::$dnsTypes[$record['type']] & $type)) {
155+
if ((self::$dnsTypes[$record['type']] ?? 0) & $type) {
156156
$records[] = array_merge(['host' => $hostname, 'class' => 'IN', 'ttl' => 1, 'type' => $record['type']], $record);
157157
}
158158
}
@@ -163,7 +163,7 @@ public static function dns_get_record($hostname, $type = \DNS_ANY, &$authns = nu
163163

164164
public static function register($class)
165165
{
166-
$self = \get_called_class();
166+
$self = static::class;
167167

168168
$mockedNs = [substr($class, 0, strrpos($class, '\\'))];
169169
if (0 < strpos($class, '\\Tests\\')) {

Diff for: Legacy/CommandForV5.php

-57
This file was deleted.

Diff for: Legacy/CommandForV6.php renamed to Legacy/CommandForV7.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
*
2222
* @internal
2323
*/
24-
class CommandForV6 extends BaseCommand
24+
class CommandForV7 extends BaseCommand
2525
{
2626
/**
2727
* {@inheritdoc}
2828
*/
2929
protected function createRunner(): BaseRunner
3030
{
31-
$this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : [];
31+
$this->arguments['listeners'] ?? $this->arguments['listeners'] = [];
3232

3333
$registeredLocally = false;
3434

Diff for: Legacy/CommandForV9.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CommandForV9 extends BaseCommand
3131
*/
3232
protected function createRunner(): BaseRunner
3333
{
34-
$this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : [];
34+
$this->arguments['listeners'] ?? $this->arguments['listeners'] = [];
3535

3636
$registeredLocally = false;
3737

Diff for: Legacy/ConstraintTraitForV6.php

-130
This file was deleted.

0 commit comments

Comments
 (0)