Skip to content

Commit ca07fb9

Browse files
committed
[PhpUnitBridge] Add ExpectUserDeprecationMessageTrait
1 parent 5b396e1 commit ca07fb9

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.2
5+
---
6+
7+
* Add `ExpectUserDeprecationMessageTrait` with a polyfill of PHPUnit's `expectUserDeprecationMessage()`
8+
49
6.4
510
---
611

ExpectUserDeprecationMessageTrait.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\PhpUnit;
13+
14+
use PHPUnit\Runner\Version;
15+
16+
if (version_compare(Version::id(), '11.0.0', '<')) {
17+
trait ExpectUserDeprecationMessageTrait
18+
{
19+
use ExpectDeprecationTrait;
20+
21+
final protected function expectUserDeprecationMessage(string $expectedUserDeprecationMessage): void
22+
{
23+
$this->expectDeprecation($expectedUserDeprecationMessage);
24+
}
25+
}
26+
} else {
27+
trait ExpectUserDeprecationMessageTrait
28+
{
29+
}
30+
}

0 commit comments

Comments
 (0)