Skip to content

Commit 1ba8f5b

Browse files
Merge branch '4.4' into 5.0
* 4.4: Use `::class` constants instead of `__NAMESPACE__` when possible
2 parents ca67836 + fb5d2ec commit 1ba8f5b

38 files changed

+44
-44
lines changed

Constraints/AbstractComparisonValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(PropertyAccessorInterface $propertyAccessor = null)
4040
public function validate($value, Constraint $constraint)
4141
{
4242
if (!$constraint instanceof AbstractComparison) {
43-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\AbstractComparison');
43+
throw new UnexpectedTypeException($constraint, AbstractComparison::class);
4444
}
4545

4646
if (null === $value) {

Constraints/AllValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AllValidator extends ConstraintValidator
2727
public function validate($value, Constraint $constraint)
2828
{
2929
if (!$constraint instanceof All) {
30-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\All');
30+
throw new UnexpectedTypeException($constraint, All::class);
3131
}
3232

3333
if (null === $value) {

Constraints/BicValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(PropertyAccessor $propertyAccessor = null)
6161
public function validate($value, Constraint $constraint)
6262
{
6363
if (!$constraint instanceof Bic) {
64-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Bic');
64+
throw new UnexpectedTypeException($constraint, Bic::class);
6565
}
6666

6767
if (null === $value || '' === $value) {

Constraints/BlankValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BlankValidator extends ConstraintValidator
2626
public function validate($value, Constraint $constraint)
2727
{
2828
if (!$constraint instanceof Blank) {
29-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Blank');
29+
throw new UnexpectedTypeException($constraint, Blank::class);
3030
}
3131

3232
if ('' !== $value && null !== $value) {

Constraints/CallbackValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CallbackValidator extends ConstraintValidator
2929
public function validate($object, Constraint $constraint)
3030
{
3131
if (!$constraint instanceof Callback) {
32-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Callback');
32+
throw new UnexpectedTypeException($constraint, Callback::class);
3333
}
3434

3535
$method = $constraint->callback;

Constraints/CardSchemeValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class CardSchemeValidator extends ConstraintValidator
9999
public function validate($value, Constraint $constraint)
100100
{
101101
if (!$constraint instanceof CardScheme) {
102-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\CardScheme');
102+
throw new UnexpectedTypeException($constraint, CardScheme::class);
103103
}
104104

105105
if (null === $value || '' === $value) {

Constraints/ChoiceValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ChoiceValidator extends ConstraintValidator
3232
public function validate($value, Constraint $constraint)
3333
{
3434
if (!$constraint instanceof Choice) {
35-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Choice');
35+
throw new UnexpectedTypeException($constraint, Choice::class);
3636
}
3737

3838
if (!\is_array($constraint->choices) && !$constraint->callback) {

Constraints/CollectionValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CollectionValidator extends ConstraintValidator
2727
public function validate($value, Constraint $constraint)
2828
{
2929
if (!$constraint instanceof Collection) {
30-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Collection');
30+
throw new UnexpectedTypeException($constraint, Collection::class);
3131
}
3232

3333
if (null === $value) {

Constraints/CountValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CountValidator extends ConstraintValidator
2727
public function validate($value, Constraint $constraint)
2828
{
2929
if (!$constraint instanceof Count) {
30-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Count');
30+
throw new UnexpectedTypeException($constraint, Count::class);
3131
}
3232

3333
if (null === $value) {

Constraints/CountryValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CountryValidator extends ConstraintValidator
3030
public function validate($value, Constraint $constraint)
3131
{
3232
if (!$constraint instanceof Country) {
33-
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Country');
33+
throw new UnexpectedTypeException($constraint, Country::class);
3434
}
3535

3636
if (null === $value || '' === $value) {

0 commit comments

Comments
 (0)