Skip to content

Commit db06e00

Browse files
CS fix
1 parent 734f5cb commit db06e00

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

src/Intl/Idn/Idn.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Polyfill\Intl\Idn;
1313

14-
use Exception;
15-
use Normalizer;
1614
use Symfony\Polyfill\Intl\Idn\Resources\unidata\DisallowedRanges;
1715
use Symfony\Polyfill\Intl\Idn\Resources\unidata\Regex;
1816

@@ -167,7 +165,7 @@ public static function idn_to_ascii($domainName, $options = self::IDNA_DEFAULT,
167165
if (1 === preg_match('/[^\x00-\x7F]/', $label)) {
168166
try {
169167
$label = 'xn--'.self::punycodeEncode($label);
170-
} catch (Exception $e) {
168+
} catch (\Exception $e) {
171169
$info->errors |= self::ERROR_PUNYCODE;
172170
}
173171

@@ -335,8 +333,8 @@ private static function process($domain, array $options, Info $info)
335333
$domain = self::mapCodePoints($domain, $options, $info);
336334

337335
// Step 2. Normalize the domain name string to Unicode Normalization Form C.
338-
if (!Normalizer::isNormalized($domain, Normalizer::FORM_C)) {
339-
$domain = Normalizer::normalize($domain, Normalizer::FORM_C);
336+
if (!\Normalizer::isNormalized($domain, \Normalizer::FORM_C)) {
337+
$domain = \Normalizer::normalize($domain, \Normalizer::FORM_C);
340338
}
341339

342340
// Step 3. Break the string into labels at U+002E (.) FULL STOP.
@@ -350,7 +348,7 @@ private static function process($domain, array $options, Info $info)
350348
if ('xn--' === substr($label, 0, 4)) {
351349
try {
352350
$label = self::punycodeDecode(substr($label, 4));
353-
} catch (Exception $e) {
351+
} catch (\Exception $e) {
354352
$info->errors |= self::ERROR_PUNYCODE;
355353

356354
continue;
@@ -496,7 +494,7 @@ private static function validateLabel($label, Info $info, array $options, $canBe
496494
}
497495

498496
// Step 1. The label must be in Unicode Normalization Form C.
499-
if (!Normalizer::isNormalized($label, Normalizer::FORM_C)) {
497+
if (!\Normalizer::isNormalized($label, \Normalizer::FORM_C)) {
500498
$info->errors |= self::ERROR_INVALID_ACE_LABEL;
501499
}
502500

@@ -583,7 +581,7 @@ private static function punycodeDecode($input)
583581

584582
for ($j = 0; $j < $b; ++$j) {
585583
if ($bytes[$j] > 0x7F) {
586-
throw new Exception('Invalid input');
584+
throw new \Exception('Invalid input');
587585
}
588586

589587
$output[$out++] = $input[$j];
@@ -599,17 +597,17 @@ private static function punycodeDecode($input)
599597

600598
for ($k = self::BASE; /* no condition */; $k += self::BASE) {
601599
if ($in >= $inputLength) {
602-
throw new Exception('Invalid input');
600+
throw new \Exception('Invalid input');
603601
}
604602

605603
$digit = self::$basicToDigit[$bytes[$in++] & 0xFF];
606604

607605
if ($digit < 0) {
608-
throw new Exception('Invalid input');
606+
throw new \Exception('Invalid input');
609607
}
610608

611609
if ($digit > intdiv(self::MAX_INT - $i, $w)) {
612-
throw new Exception('Integer overflow');
610+
throw new \Exception('Integer overflow');
613611
}
614612

615613
$i += $digit * $w;
@@ -629,7 +627,7 @@ private static function punycodeDecode($input)
629627
$baseMinusT = self::BASE - $t;
630628

631629
if ($w > intdiv(self::MAX_INT, $baseMinusT)) {
632-
throw new Exception('Integer overflow');
630+
throw new \Exception('Integer overflow');
633631
}
634632

635633
$w *= $baseMinusT;
@@ -639,7 +637,7 @@ private static function punycodeDecode($input)
639637
$bias = self::adaptBias($i - $oldi, $outPlusOne, 0 === $oldi);
640638

641639
if (intdiv($i, $outPlusOne) > self::MAX_INT - $n) {
642-
throw new Exception('Integer overflow');
640+
throw new \Exception('Integer overflow');
643641
}
644642

645643
$n += intdiv($i, $outPlusOne);
@@ -694,15 +692,15 @@ private static function punycodeEncode($input)
694692
}
695693

696694
if ($m - $n > intdiv(self::MAX_INT - $delta, $h + 1)) {
697-
throw new Exception('Integer overflow');
695+
throw new \Exception('Integer overflow');
698696
}
699697

700698
$delta += ($m - $n) * ($h + 1);
701699
$n = $m;
702700

703701
foreach ($iter as $codePoint) {
704702
if ($codePoint < $n && 0 === ++$delta) {
705-
throw new Exception('Integer overflow');
703+
throw new \Exception('Integer overflow');
706704
}
707705

708706
if ($codePoint === $n) {

src/Intl/Idn/Resources/unidata/DisallowedRanges.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Polyfill\Intl\Idn\Resources\unidata;
413

514
/**

src/Intl/Idn/Resources/unidata/Regex.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Polyfill\Intl\Idn\Resources\unidata;
413

514
/**

0 commit comments

Comments
 (0)