Skip to content

Commit bbe3ce8

Browse files
minor symfony#27877 improve deprecation messages (xabbuh)
This PR was merged into the 4.1 branch. Discussion ---------- improve deprecation messages | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- e4ae5a4 improve deprecation messages
2 parents 2b860d5 + e4ae5a4 commit bbe3ce8

File tree

18 files changed

+39
-39
lines changed

18 files changed

+39
-39
lines changed

src/Symfony/Component/Console/Helper/TableStyle.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function setHorizontalBorderChars(string $outside, string $inside = null)
110110
*/
111111
public function setHorizontalBorderChar($horizontalBorderChar)
112112
{
113-
@trigger_error(sprintf('Method %s() is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
113+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
114114

115115
return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar);
116116
}
@@ -124,7 +124,7 @@ public function setHorizontalBorderChar($horizontalBorderChar)
124124
*/
125125
public function getHorizontalBorderChar()
126126
{
127-
@trigger_error(sprintf('Method %s() is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
127+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
128128

129129
return $this->horizontalOutsideBorderChar;
130130
}
@@ -166,7 +166,7 @@ public function setVerticalBorderChars(string $outside, string $inside = null):
166166
*/
167167
public function setVerticalBorderChar($verticalBorderChar)
168168
{
169-
@trigger_error(sprintf('Method %s() is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
169+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
170170

171171
return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
172172
}
@@ -180,7 +180,7 @@ public function setVerticalBorderChar($verticalBorderChar)
180180
*/
181181
public function getVerticalBorderChar()
182182
{
183-
@trigger_error(sprintf('Method %s() is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
183+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
184184

185185
return $this->verticalOutsideBorderChar;
186186
}
@@ -268,7 +268,7 @@ public function setDefaultCrossingChar(string $char): self
268268
*/
269269
public function setCrossingChar($crossingChar)
270270
{
271-
@trigger_error(sprintf('Method %s() is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), E_USER_DEPRECATED);
271+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), E_USER_DEPRECATED);
272272

273273
return $this->setDefaultCrossingChar($crossingChar);
274274
}

src/Symfony/Component/Debug/Exception/FlattenException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function getTrace()
186186
*/
187187
public function setTraceFromException(\Exception $exception)
188188
{
189-
@trigger_error(sprintf('"%s" is deprecated since Symfony 4.1, use "setTraceFromThrowable()" instead.', __METHOD__), E_USER_DEPRECATED);
189+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use "setTraceFromThrowable()" instead.', __METHOD__), E_USER_DEPRECATED);
190190

191191
$this->setTraceFromThrowable($exception);
192192
}

src/Symfony/Component/DependencyInjection/TypedReference.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TypedReference extends Reference
2929
public function __construct(string $id, string $type, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
3030
{
3131
if (\is_string($invalidBehavior) || 3 < \func_num_args()) {
32-
@trigger_error(sprintf('The $requiringClass argument of "%s" is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
32+
@trigger_error(sprintf('The $requiringClass argument of "%s()" is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
3333

3434
$this->requiringClass = $invalidBehavior;
3535
$invalidBehavior = 3 < \func_num_args() ? \func_get_arg(3) : ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
@@ -48,7 +48,7 @@ public function getType()
4848
*/
4949
public function getRequiringClass()
5050
{
51-
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
51+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
5252

5353
return $this->requiringClass ?? '';
5454
}
@@ -58,7 +58,7 @@ public function getRequiringClass()
5858
*/
5959
public function canBeAutoregistered()
6060
{
61-
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
61+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
6262

6363
return $this->requiringClass && (false !== $i = strpos($this->type, '\\')) && 0 === strncasecmp($this->type, $this->requiringClass, 1 + $i);
6464
}

src/Symfony/Component/Form/Extension/Core/Type/CountryType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getBlockPrefix()
7777
*/
7878
public function loadChoiceList($value = null)
7979
{
80-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
80+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
8181

8282
if (null !== $this->choiceList) {
8383
return $this->choiceList;
@@ -93,7 +93,7 @@ public function loadChoiceList($value = null)
9393
*/
9494
public function loadChoicesForValues(array $values, $value = null)
9595
{
96-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
96+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
9797

9898
// Optimize
9999
$values = array_filter($values);
@@ -116,7 +116,7 @@ public function loadChoicesForValues(array $values, $value = null)
116116
*/
117117
public function loadValuesForChoices(array $choices, $value = null)
118118
{
119-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
119+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
120120

121121
// Optimize
122122
$choices = array_filter($choices);

src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getBlockPrefix()
7777
*/
7878
public function loadChoiceList($value = null)
7979
{
80-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
80+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
8181

8282
if (null !== $this->choiceList) {
8383
return $this->choiceList;
@@ -93,7 +93,7 @@ public function loadChoiceList($value = null)
9393
*/
9494
public function loadChoicesForValues(array $values, $value = null)
9595
{
96-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
96+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
9797

9898
// Optimize
9999
$values = array_filter($values);
@@ -116,7 +116,7 @@ public function loadChoicesForValues(array $values, $value = null)
116116
*/
117117
public function loadValuesForChoices(array $choices, $value = null)
118118
{
119-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
119+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
120120

121121
// Optimize
122122
$choices = array_filter($choices);

src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getBlockPrefix()
7777
*/
7878
public function loadChoiceList($value = null)
7979
{
80-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
80+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
8181

8282
if (null !== $this->choiceList) {
8383
return $this->choiceList;
@@ -93,7 +93,7 @@ public function loadChoiceList($value = null)
9393
*/
9494
public function loadChoicesForValues(array $values, $value = null)
9595
{
96-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
96+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
9797

9898
// Optimize
9999
$values = array_filter($values);
@@ -116,7 +116,7 @@ public function loadChoicesForValues(array $values, $value = null)
116116
*/
117117
public function loadValuesForChoices(array $choices, $value = null)
118118
{
119-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
119+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
120120

121121
// Optimize
122122
$choices = array_filter($choices);

src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getBlockPrefix()
7777
*/
7878
public function loadChoiceList($value = null)
7979
{
80-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
80+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
8181

8282
if (null !== $this->choiceList) {
8383
return $this->choiceList;
@@ -93,7 +93,7 @@ public function loadChoiceList($value = null)
9393
*/
9494
public function loadChoicesForValues(array $values, $value = null)
9595
{
96-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
96+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
9797

9898
// Optimize
9999
$values = array_filter($values);
@@ -116,7 +116,7 @@ public function loadChoicesForValues(array $values, $value = null)
116116
*/
117117
public function loadValuesForChoices(array $choices, $value = null)
118118
{
119-
@trigger_error(sprintf('Method "%s" is deprecated since Symfony 4.1, use "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
119+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
120120

121121
// Optimize
122122
$choices = array_filter($choices);

src/Symfony/Component/HttpFoundation/File/UploadedFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function guessClientExtension()
158158
*/
159159
public function getClientSize()
160160
{
161-
@trigger_error(sprintf('"%s" is deprecated since Symfony 4.1. Use getSize() instead.', __METHOD__), E_USER_DEPRECATED);
161+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use getSize() instead.', __METHOD__), E_USER_DEPRECATED);
162162

163163
return $this->getSize();
164164
}

src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private function hasUserChanged(UserInterface $user)
261261
}
262262

263263
if ($this->user instanceof AdvancedUserInterface && $user instanceof AdvancedUserInterface) {
264-
@trigger_error(sprintf('Checking for the AdvancedUserInterface in %s has been deprecated in 4.1. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), E_USER_DEPRECATED);
264+
@trigger_error(sprintf('Checking for the AdvancedUserInterface in "%s()" is deprecated since Symfony 4.1 and support for it will be removed in 5.0. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), E_USER_DEPRECATED);
265265
if ($this->user->isAccountNonExpired() !== $user->isAccountNonExpired()) {
266266
return true;
267267
}
@@ -278,7 +278,7 @@ private function hasUserChanged(UserInterface $user)
278278
return true;
279279
}
280280
} elseif ($this->user instanceof AdvancedUserInterface xor $user instanceof AdvancedUserInterface) {
281-
@trigger_error(sprintf('Checking for the AdvancedUserInterface in %s has been deprecated in 4.1. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), E_USER_DEPRECATED);
281+
@trigger_error(sprintf('Checking for the AdvancedUserInterface in "%s()" is deprecated since Symfony 4.1 and support for it will be removed in 5.0. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), E_USER_DEPRECATED);
282282

283283
return true;
284284
}

src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(ExpressionLanguage $expressionLanguage, Authenticati
4242
*/
4343
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
4444
{
45-
@trigger_error(sprintf('The %s() method is deprecated since Symfony 4.1, register the provider directly on the injected ExpressionLanguage instance instead.', __METHOD__), E_USER_DEPRECATED);
45+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, register the provider directly on the injected ExpressionLanguage instance instead.', __METHOD__), E_USER_DEPRECATED);
4646

4747
$this->expressionLanguage->registerProvider($provider);
4848
}

0 commit comments

Comments
 (0)