Skip to content

Commit cf2e986

Browse files
committed
made deprecation notices less verbose
1 parent 512d655 commit cf2e986

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
4.1.0
55
-----
66

7-
* Deprecated the `checkDNS` and `dnsMessage` options of the `Url` constraint. They will be removed in 5.0.
7+
* Deprecated the `checkDNS` and `dnsMessage` options of the `Url` constraint.
88
* added a `values` option to the `Expression` constraint
99

1010
4.0.0

Constraints/Email.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ class Email extends Constraint
5151
public $checkHost = false;
5252

5353
/**
54-
* @deprecated since Symfony 4.1, to be removed in 5.0. Set mode to "strict" instead.
54+
* @deprecated since Symfony 4.1. Set mode to "strict" instead.
5555
*/
5656
public $strict;
5757
public $mode;
5858

5959
public function __construct($options = null)
6060
{
6161
if (is_array($options) && array_key_exists('strict', $options)) {
62-
@trigger_error(sprintf('The "strict" property is deprecated since Symfony 4.1 and will be removed in 5.0. Use "mode"=>"%s" instead.', self::VALIDATION_MODE_STRICT), E_USER_DEPRECATED);
62+
@trigger_error(sprintf('The "strict" property is deprecated since Symfony 4.1. Use "mode"=>"%s" instead.', self::VALIDATION_MODE_STRICT), E_USER_DEPRECATED);
6363
}
6464

6565
if (is_array($options) && array_key_exists('mode', $options) && !in_array($options['mode'], self::$validationModes, true)) {

Constraints/EmailValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class EmailValidator extends ConstraintValidator
4949
public function __construct($defaultMode = Email::VALIDATION_MODE_LOOSE)
5050
{
5151
if (is_bool($defaultMode)) {
52-
@trigger_error(sprintf('Calling `new %s(%s)` is deprecated since Symfony 4.1 and will be removed in 5.0, use `new %s("%s")` instead.', self::class, $defaultMode ? 'true' : 'false', self::class, $defaultMode ? Email::VALIDATION_MODE_STRICT : Email::VALIDATION_MODE_LOOSE), E_USER_DEPRECATED);
52+
@trigger_error(sprintf('Calling `new %s(%s)` is deprecated since Symfony 4.1, use `new %s("%s")` instead.', self::class, $defaultMode ? 'true' : 'false', self::class, $defaultMode ? Email::VALIDATION_MODE_STRICT : Email::VALIDATION_MODE_LOOSE), E_USER_DEPRECATED);
5353

5454
$defaultMode = $defaultMode ? Email::VALIDATION_MODE_STRICT : Email::VALIDATION_MODE_LOOSE;
5555
}
@@ -81,7 +81,7 @@ public function validate($value, Constraint $constraint)
8181
$value = (string) $value;
8282

8383
if (null !== $constraint->strict) {
84-
@trigger_error(sprintf('The %s::$strict property is deprecated since Symfony 4.1 and will be removed in 5.0. Use %s::mode="%s" instead.', Email::class, Email::class, Email::VALIDATION_MODE_STRICT), E_USER_DEPRECATED);
84+
@trigger_error(sprintf('The %s::$strict property is deprecated since Symfony 4.1. Use %s::mode="%s" instead.', Email::class, Email::class, Email::VALIDATION_MODE_STRICT), E_USER_DEPRECATED);
8585

8686
if ($constraint->strict) {
8787
$constraint->mode = Email::VALIDATION_MODE_STRICT;

Constraints/Url.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,67 +22,67 @@
2222
class Url extends Constraint
2323
{
2424
/**
25-
* @deprecated since Symfony 4.1, to be removed in 5.0
25+
* @deprecated since Symfony 4.1
2626
*/
2727
const CHECK_DNS_TYPE_ANY = 'ANY';
2828

2929
/**
30-
* @deprecated since Symfony 4.1, to be removed in 5.0
30+
* @deprecated since Symfony 4.1
3131
*/
3232
const CHECK_DNS_TYPE_NONE = false;
3333

3434
/**
35-
* @deprecated since Symfony 4.1, to be removed in 5.0
35+
* @deprecated since Symfony 4.1
3636
*/
3737
const CHECK_DNS_TYPE_A = 'A';
3838

3939
/**
40-
* @deprecated since Symfony 4.1, to be removed in 5.0
40+
* @deprecated since Symfony 4.1
4141
*/
4242
const CHECK_DNS_TYPE_A6 = 'A6';
4343

4444
/**
45-
* @deprecated since Symfony 4.1, to be removed in 5.0
45+
* @deprecated since Symfony 4.1
4646
*/
4747
const CHECK_DNS_TYPE_AAAA = 'AAAA';
4848

4949
/**
50-
* @deprecated since Symfony 4.1, to be removed in 5.0
50+
* @deprecated since Symfony 4.1
5151
*/
5252
const CHECK_DNS_TYPE_CNAME = 'CNAME';
5353

5454
/**
55-
* @deprecated since Symfony 4.1, to be removed in 5.0
55+
* @deprecated since Symfony 4.1
5656
*/
5757
const CHECK_DNS_TYPE_MX = 'MX';
5858

5959
/**
60-
* @deprecated since Symfony 4.1, to be removed in 5.0
60+
* @deprecated since Symfony 4.1
6161
*/
6262
const CHECK_DNS_TYPE_NAPTR = 'NAPTR';
6363

6464
/**
65-
* @deprecated since Symfony 4.1, to be removed in 5.0
65+
* @deprecated since Symfony 4.1
6666
*/
6767
const CHECK_DNS_TYPE_NS = 'NS';
6868

6969
/**
70-
* @deprecated since Symfony 4.1, to be removed in 5.0
70+
* @deprecated since Symfony 4.1
7171
*/
7272
const CHECK_DNS_TYPE_PTR = 'PTR';
7373

7474
/**
75-
* @deprecated since Symfony 4.1, to be removed in 5.0
75+
* @deprecated since Symfony 4.1
7676
*/
7777
const CHECK_DNS_TYPE_SOA = 'SOA';
7878

7979
/**
80-
* @deprecated since Symfony 4.1, to be removed in 5.0
80+
* @deprecated since Symfony 4.1
8181
*/
8282
const CHECK_DNS_TYPE_SRV = 'SRV';
8383

8484
/**
85-
* @deprecated since Symfony 4.1, to be removed in 5.0
85+
* @deprecated since Symfony 4.1
8686
*/
8787
const CHECK_DNS_TYPE_TXT = 'TXT';
8888

@@ -95,13 +95,13 @@ class Url extends Constraint
9595
public $message = 'This value is not a valid URL.';
9696

9797
/**
98-
* @deprecated since Symfony 4.1, to be removed in 5.0
98+
* @deprecated since Symfony 4.1
9999
*/
100100
public $dnsMessage = 'The host could not be resolved.';
101101
public $protocols = array('http', 'https');
102102

103103
/**
104-
* @deprecated since Symfony 4.1, to be removed in 5.0
104+
* @deprecated since Symfony 4.1
105105
*/
106106
public $checkDNS = self::CHECK_DNS_TYPE_NONE;
107107
public $relativeProtocol = false;
@@ -110,10 +110,10 @@ public function __construct($options = null)
110110
{
111111
if (is_array($options)) {
112112
if (array_key_exists('checkDNS', $options)) {
113-
@trigger_error(sprintf('The "checkDNS" option in "%s" is deprecated since Symfony 4.1 and will be removed in 5.0. Its false-positive rate is too high to be relied upon.', self::class), E_USER_DEPRECATED);
113+
@trigger_error(sprintf('The "checkDNS" option in "%s" is deprecated since Symfony 4.1. Its false-positive rate is too high to be relied upon.', self::class), E_USER_DEPRECATED);
114114
}
115115
if (array_key_exists('dnsMessage', $options)) {
116-
@trigger_error(sprintf('The "dnsMessage" option in "%s" is deprecated since Symfony 4.1 and will be removed in 5.0.', self::class), E_USER_DEPRECATED);
116+
@trigger_error(sprintf('The "dnsMessage" option in "%s" is deprecated since Symfony 4.1.', self::class), E_USER_DEPRECATED);
117117
}
118118
}
119119

Tests/Constraints/EmailTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class EmailTest extends TestCase
1818
{
1919
/**
20-
* @expectedDeprecation The "strict" property is deprecated since Symfony 4.1 and will be removed in 5.0. Use "mode"=>"strict" instead.
20+
* @expectedDeprecation The "strict" property is deprecated since Symfony 4.1. Use "mode"=>"strict" instead.
2121
* @group legacy
2222
*/
2323
public function testLegacyConstructorStrict()

Tests/Constraints/EmailValidatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function createValidator()
2727
}
2828

2929
/**
30-
* @expectedDeprecation Calling `new Symfony\Component\Validator\Constraints\EmailValidator(true)` is deprecated since Symfony 4.1 and will be removed in 5.0, use `new Symfony\Component\Validator\Constraints\EmailValidator("strict")` instead.
30+
* @expectedDeprecation Calling `new Symfony\Component\Validator\Constraints\EmailValidator(true)` is deprecated since Symfony 4.1, use `new Symfony\Component\Validator\Constraints\EmailValidator("strict")` instead.
3131
* @group legacy
3232
*/
3333
public function testLegacyValidatorConstructorStrict()
@@ -226,8 +226,8 @@ public function testUnknownModesOnValidateTriggerException()
226226
}
227227

228228
/**
229-
* @expectedDeprecation The "strict" property is deprecated since Symfony 4.1 and will be removed in 5.0. Use "mode"=>"strict" instead.
230-
* @expectedDeprecation The Symfony\Component\Validator\Constraints\Email::$strict property is deprecated since Symfony 4.1 and will be removed in 5.0. Use Symfony\Component\Validator\Constraints\Email::mode="strict" instead.
229+
* @expectedDeprecation The "strict" property is deprecated since Symfony 4.1. Use "mode"=>"strict" instead.
230+
* @expectedDeprecation The Symfony\Component\Validator\Constraints\Email::$strict property is deprecated since Symfony 4.1. Use Symfony\Component\Validator\Constraints\Email::mode="strict" instead.
231231
* @group legacy
232232
*/
233233
public function testStrict()

Tests/Constraints/UrlValidatorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function getValidCustomUrls()
265265
* @dataProvider getCheckDns
266266
* @requires function Symfony\Bridge\PhpUnit\DnsMock::withMockedHosts
267267
* @group legacy
268-
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1 and will be removed in 5.0. Its false-positive rate is too high to be relied upon.
268+
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1. Its false-positive rate is too high to be relied upon.
269269
*/
270270
public function testCheckDns($violation)
271271
{
@@ -297,7 +297,7 @@ public function getCheckDns()
297297
* @dataProvider getCheckDnsTypes
298298
* @requires function Symfony\Bridge\PhpUnit\DnsMock::withMockedHosts
299299
* @group legacy
300-
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1 and will be removed in 5.0. Its false-positive rate is too high to be relied upon.
300+
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1. Its false-positive rate is too high to be relied upon.
301301
*/
302302
public function testCheckDnsByType($type)
303303
{
@@ -335,8 +335,8 @@ public function getCheckDnsTypes()
335335
* @expectedException \Symfony\Component\Validator\Exception\InvalidOptionsException
336336
* @requires function Symfony\Bridge\PhpUnit\DnsMock::withMockedHosts
337337
* @group legacy
338-
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1 and will be removed in 5.0. Its false-positive rate is too high to be relied upon.
339-
* @expectedDeprecation The "dnsMessage" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1 and will be removed in 5.0.
338+
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1. Its false-positive rate is too high to be relied upon.
339+
* @expectedDeprecation The "dnsMessage" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1.
340340
*/
341341
public function testCheckDnsWithInvalidType()
342342
{
@@ -352,7 +352,7 @@ public function testCheckDnsWithInvalidType()
352352

353353
/**
354354
* @group legacy
355-
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1 and will be removed in 5.0. Its false-positive rate is too high to be relied upon.
355+
* @expectedDeprecation The "checkDNS" option in "Symfony\Component\Validator\Constraints\Url" is deprecated since Symfony 4.1. Its false-positive rate is too high to be relied upon.
356356
*/
357357
public function testCheckDnsOptionIsDeprecated()
358358
{

0 commit comments

Comments
 (0)