Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9e37873

Browse filesBrowse files
committed
Always show all deprecations except legacy ones
When using any mode but the weak mode, you want your build to fail on some or all deprecations, but it is still nice to be able to see what you could fix without having to change modes.
1 parent f74bda5 commit 9e37873
Copy full SHA for 9e37873

File tree

6 files changed

+26
-7
lines changed
Filter options

6 files changed

+26
-7
lines changed

‎src/Symfony/Bridge/PhpUnit/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
4.1.0
5+
-----
6+
7+
* all deprecations but those from tests marked with `@group legacy` are always
8+
displayed when not in `weak` mode.
9+
410
4.0.0
511
-----
612

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ public static function register($mode = 0)
110110

111111
$trace = debug_backtrace(true);
112112
$group = 'other';
113-
$isVendor = false;
114-
$isWeak = DeprecationErrorHandler::MODE_WEAK === $mode || (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $isVendor = $inVendors($file));
113+
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
115114

116115
$i = count($trace);
117116
while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_') || 0 === strpos($trace[$i]['class'], 'PHPUnit\\')))) {
@@ -128,7 +127,7 @@ public static function register($mode = 0)
128127
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
129128
// then we need to use the serialized information to determine
130129
// if the error has been triggered from vendor code.
131-
$isWeak = DeprecationErrorHandler::MODE_WEAK === $mode || (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $isVendor = isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']));
130+
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
132131
} else {
133132
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
134133
$method = $trace[$i]['function'];
@@ -145,7 +144,7 @@ public static function register($mode = 0)
145144
|| in_array('legacy', $Test::getGroups($class, $method), true)
146145
) {
147146
$group = 'legacy';
148-
} elseif (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $isVendor) {
147+
} elseif ($isVendor) {
149148
$group = 'remaining vendor';
150149
} else {
151150
$group = 'remaining';
@@ -165,13 +164,13 @@ public static function register($mode = 0)
165164

166165
exit(1);
167166
}
168-
if ('legacy' !== $group && !$isWeak) {
167+
if ('legacy' !== $group && DeprecationErrorHandler::MODE_WEAK !== $mode) {
169168
$ref = &$deprecations[$group][$msg]['count'];
170169
++$ref;
171170
$ref = &$deprecations[$group][$msg][$class.'::'.$method];
172171
++$ref;
173172
}
174-
} elseif (!$isWeak) {
173+
} elseif (DeprecationErrorHandler::MODE_WEAK !== $mode) {
175174
$ref = &$deprecations[$group][$msg]['count'];
176175
++$ref;
177176
}

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ Unsilenced deprecation notices (1)
3737
Legacy deprecation notices (1)
3838

3939
Other deprecation notices (1)
40-

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ eval("@trigger_error('who knows where I come from?', E_USER_DEPRECATED);")
2121
--EXPECTF--
2222

2323
Other deprecation notices (1)
24+
25+
1x: who knows where I come from?

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_phar_deprecation.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_phar_deprecation.phpt
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ include 'phar://deprecation.phar/deprecation.php';
2323
--EXPECTF--
2424

2525
Other deprecation notices (1)
26+
27+
1x: I come from… afar! :D

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,19 @@ require __DIR__.'/fake_vendor/acme/lib/deprecation_riddled.php';
2222
--EXPECTF--
2323
Unsilenced deprecation notices (2)
2424

25+
1x: unsilenced foo deprecation
26+
1x in FooTestCase::testLegacyFoo
27+
28+
1x: unsilenced bar deprecation
29+
1x in FooTestCase::testNonLegacyBar
30+
2531
Remaining vendor deprecation notices (1)
2632

33+
1x: silenced bar deprecation
34+
1x in FooTestCase::testNonLegacyBar
35+
2736
Legacy deprecation notices (1)
2837

2938
Other deprecation notices (1)
39+
40+
1x: root deprecation

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.