| @@ -7,12 +7,12 @@ | ||
| 7 | 7 | * |
| 8 | 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | 9 | * file that was distributed with this source code. |
| 10 | 10 | */ |
| 11 | -namespace WindPressPackages\Symfony\Component\String; | |
| 11 | +namespace WindPressDeps\Symfony\Component\String; | |
| 12 | 12 | |
| 13 | -use WindPressPackages\Symfony\Component\String\Exception\ExceptionInterface; | |
| 14 | -use WindPressPackages\Symfony\Component\String\Exception\InvalidArgumentException; | |
| 13 | +use WindPressDeps\Symfony\Component\String\Exception\ExceptionInterface; | |
| 14 | +use WindPressDeps\Symfony\Component\String\Exception\InvalidArgumentException; | |
| 15 | 15 | /** |
| 16 | 16 | * Represents a string of Unicode code points encoded as UTF-8. |
| 17 | 17 | * |
| 18 | 18 | * @author Nicolas Grekas <p@tchwork.com> |
| @@ -31,9 +31,9 @@ | ||
| 31 | 31 | } |
| 32 | 32 | public function append(string ...$suffix): AbstractString |
| 33 | 33 | { |
| 34 | 34 | $str = clone $this; |
| 35 | - $str->string .= (1 >= \count($suffix)) ? $suffix[0] ?? '' : implode('', $suffix); | |
| 35 | + $str->string .= 1 >= \count($suffix) ? $suffix[0] ?? '' : implode('', $suffix); | |
| 36 | 36 | if (!preg_match('//u', $str->string)) { |
| 37 | 37 | throw new InvalidArgumentException('Invalid UTF-8 string.'); |
| 38 | 38 | } |
| 39 | 39 | return $str; |
| @@ -62,9 +62,9 @@ | ||
| 62 | 62 | } |
| 63 | 63 | public function codePointsAt(int $offset): array |
| 64 | 64 | { |
| 65 | 65 | $str = $offset ? $this->slice($offset, 1) : $this; |
| 66 | - return ('' === $str->string) ? [] : [mb_ord($str->string, 'UTF-8')]; | |
| 66 | + return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')]; | |
| 67 | 67 | } |
| 68 | 68 | public function endsWith($suffix): bool |
| 69 | 69 | { |
| 70 | 70 | if ($suffix instanceof AbstractString) { |
| @@ -108,9 +108,9 @@ | ||
| 108 | 108 | if ('' === $needle) { |
| 109 | 109 | return null; |
| 110 | 110 | } |
| 111 | 111 | $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8'); |
| 112 | - return (\false === $i) ? null : $i; | |
| 112 | + return \false === $i ? null : $i; | |
| 113 | 113 | } |
| 114 | 114 | public function indexOfLast($needle, int $offset = 0): ?int |
| 115 | 115 | { |
| 116 | 116 | if ($needle instanceof AbstractString) { |
| @@ -123,9 +123,9 @@ | ||
| 123 | 123 | if ('' === $needle) { |
| 124 | 124 | return null; |
| 125 | 125 | } |
| 126 | 126 | $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8'); |
| 127 | - return (\false === $i) ? null : $i; | |
| 127 | + return \false === $i ? null : $i; | |
| 128 | 128 | } |
| 129 | 129 | public function length(): int |
| 130 | 130 | { |
| 131 | 131 | return mb_strlen($this->string, 'UTF-8'); |
| @@ -132,9 +132,9 @@ | ||
| 132 | 132 | } |
| 133 | 133 | public function prepend(string ...$prefix): AbstractString |
| 134 | 134 | { |
| 135 | 135 | $str = clone $this; |
| 136 | - $str->string = ((1 >= \count($prefix)) ? $prefix[0] ?? '' : implode('', $prefix)) . $this->string; | |
| 136 | + $str->string = (1 >= \count($prefix) ? $prefix[0] ?? '' : implode('', $prefix)) . $this->string; | |
| 137 | 137 | if (!preg_match('//u', $str->string)) { |
| 138 | 138 | throw new InvalidArgumentException('Invalid UTF-8 string.'); |
| 139 | 139 | } |
| 140 | 140 | return $str; |