Completed
Push — develop ( 316159...00443b )
by Zack
20:22
created
vendor/symfony/console/Tester/ApplicationTester.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     private $input;
33 33
     private $statusCode;
34 34
 
35
-    public function __construct(Application $application)
35
+    public function __construct( Application $application )
36 36
     {
37 37
         $this->application = $application;
38 38
     }
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return int The command exit code
51 51
      */
52
-    public function run(array $input, array $options = [])
52
+    public function run( array $input, array $options = [ ] )
53 53
     {
54
-        $this->input = new ArrayInput($input);
55
-        if (isset($options['interactive'])) {
56
-            $this->input->setInteractive($options['interactive']);
54
+        $this->input = new ArrayInput( $input );
55
+        if ( isset( $options[ 'interactive' ] ) ) {
56
+            $this->input->setInteractive( $options[ 'interactive' ] );
57 57
         }
58 58
 
59
-        if ($this->inputs) {
60
-            $this->input->setStream(self::createStream($this->inputs));
59
+        if ( $this->inputs ) {
60
+            $this->input->setStream( self::createStream( $this->inputs ) );
61 61
         }
62 62
 
63
-        $this->initOutput($options);
63
+        $this->initOutput( $options );
64 64
 
65
-        return $this->statusCode = $this->application->run($this->input, $this->output);
65
+        return $this->statusCode = $this->application->run( $this->input, $this->output );
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
vendor/symfony/console/Tester/CommandTester.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     private $input;
29 29
     private $statusCode;
30 30
 
31
-    public function __construct(Command $command)
31
+    public function __construct( Command $command )
32 32
     {
33 33
         $this->command = $command;
34 34
     }
@@ -48,31 +48,31 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return int The command exit code
50 50
      */
51
-    public function execute(array $input, array $options = [])
51
+    public function execute( array $input, array $options = [ ] )
52 52
     {
53 53
         // set the command name automatically if the application requires
54 54
         // this argument and no command name was passed
55
-        if (!isset($input['command'])
56
-            && (null !== $application = $this->command->getApplication())
57
-            && $application->getDefinition()->hasArgument('command')
55
+        if ( ! isset( $input[ 'command' ] )
56
+            && ( null !== $application = $this->command->getApplication() )
57
+            && $application->getDefinition()->hasArgument( 'command' )
58 58
         ) {
59
-            $input = array_merge(['command' => $this->command->getName()], $input);
59
+            $input = array_merge( [ 'command' => $this->command->getName() ], $input );
60 60
         }
61 61
 
62
-        $this->input = new ArrayInput($input);
62
+        $this->input = new ArrayInput( $input );
63 63
         // Use an in-memory input stream even if no inputs are set so that QuestionHelper::ask() does not rely on the blocking STDIN.
64
-        $this->input->setStream(self::createStream($this->inputs));
64
+        $this->input->setStream( self::createStream( $this->inputs ) );
65 65
 
66
-        if (isset($options['interactive'])) {
67
-            $this->input->setInteractive($options['interactive']);
66
+        if ( isset( $options[ 'interactive' ] ) ) {
67
+            $this->input->setInteractive( $options[ 'interactive' ] );
68 68
         }
69 69
 
70
-        if (!isset($options['decorated'])) {
71
-            $options['decorated'] = false;
70
+        if ( ! isset( $options[ 'decorated' ] ) ) {
71
+            $options[ 'decorated' ] = false;
72 72
         }
73 73
 
74
-        $this->initOutput($options);
74
+        $this->initOutput( $options );
75 75
 
76
-        return $this->statusCode = $this->command->run($this->input, $this->output);
76
+        return $this->statusCode = $this->command->run( $this->input, $this->output );
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
vendor/symfony/console/Tester/TesterTrait.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 {
24 24
     /** @var StreamOutput */
25 25
     private $output;
26
-    private $inputs = [];
26
+    private $inputs = [ ];
27 27
     private $captureStreamsIndependently = false;
28 28
 
29 29
     /**
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
      *
34 34
      * @return string The display
35 35
      */
36
-    public function getDisplay(bool $normalize = false)
36
+    public function getDisplay( bool $normalize = false )
37 37
     {
38
-        if (null === $this->output) {
39
-            throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
38
+        if ( null === $this->output ) {
39
+            throw new \RuntimeException( 'Output not initialized, did you execute the command before requesting the display?' );
40 40
         }
41 41
 
42
-        rewind($this->output->getStream());
42
+        rewind( $this->output->getStream() );
43 43
 
44
-        $display = stream_get_contents($this->output->getStream());
44
+        $display = stream_get_contents( $this->output->getStream() );
45 45
 
46
-        if ($normalize) {
47
-            $display = str_replace(\PHP_EOL, "\n", $display);
46
+        if ( $normalize ) {
47
+            $display = str_replace( \PHP_EOL, "\n", $display );
48 48
         }
49 49
 
50 50
         return $display;
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return string
59 59
      */
60
-    public function getErrorOutput(bool $normalize = false)
60
+    public function getErrorOutput( bool $normalize = false )
61 61
     {
62
-        if (!$this->captureStreamsIndependently) {
63
-            throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.');
62
+        if ( ! $this->captureStreamsIndependently ) {
63
+            throw new \LogicException( 'The error output is not available when the tester is run without "capture_stderr_separately" option set.' );
64 64
         }
65 65
 
66
-        rewind($this->output->getErrorOutput()->getStream());
66
+        rewind( $this->output->getErrorOutput()->getStream() );
67 67
 
68
-        $display = stream_get_contents($this->output->getErrorOutput()->getStream());
68
+        $display = stream_get_contents( $this->output->getErrorOutput()->getStream() );
69 69
 
70
-        if ($normalize) {
71
-            $display = str_replace(\PHP_EOL, "\n", $display);
70
+        if ( $normalize ) {
71
+            $display = str_replace( \PHP_EOL, "\n", $display );
72 72
         }
73 73
 
74 74
         return $display;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function getStatusCode()
105 105
     {
106
-        if (null === $this->statusCode) {
107
-            throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?');
106
+        if ( null === $this->statusCode ) {
107
+            throw new \RuntimeException( 'Status code not initialized, did you execute the command before requesting the status code?' );
108 108
         }
109 109
 
110 110
         return $this->statusCode;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      *
119 119
      * @return $this
120 120
      */
121
-    public function setInputs(array $inputs)
121
+    public function setInputs( array $inputs )
122 122
     {
123 123
         $this->inputs = $inputs;
124 124
 
@@ -134,52 +134,52 @@  discard block
 block discarded – undo
134 134
      *  * verbosity:                 Sets the output verbosity flag
135 135
      *  * capture_stderr_separately: Make output of stdOut and stdErr separately available
136 136
      */
137
-    private function initOutput(array $options)
137
+    private function initOutput( array $options )
138 138
     {
139
-        $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
140
-        if (!$this->captureStreamsIndependently) {
141
-            $this->output = new StreamOutput(fopen('php://memory', 'w', false));
142
-            if (isset($options['decorated'])) {
143
-                $this->output->setDecorated($options['decorated']);
139
+        $this->captureStreamsIndependently = \array_key_exists( 'capture_stderr_separately', $options ) && $options[ 'capture_stderr_separately' ];
140
+        if ( ! $this->captureStreamsIndependently ) {
141
+            $this->output = new StreamOutput( fopen( 'php://memory', 'w', false ) );
142
+            if ( isset( $options[ 'decorated' ] ) ) {
143
+                $this->output->setDecorated( $options[ 'decorated' ] );
144 144
             }
145
-            if (isset($options['verbosity'])) {
146
-                $this->output->setVerbosity($options['verbosity']);
145
+            if ( isset( $options[ 'verbosity' ] ) ) {
146
+                $this->output->setVerbosity( $options[ 'verbosity' ] );
147 147
             }
148 148
         } else {
149 149
             $this->output = new ConsoleOutput(
150
-                $options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
151
-                $options['decorated'] ?? null
150
+                $options[ 'verbosity' ] ?? ConsoleOutput::VERBOSITY_NORMAL,
151
+                $options[ 'decorated' ] ?? null
152 152
             );
153 153
 
154
-            $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
155
-            $errorOutput->setFormatter($this->output->getFormatter());
156
-            $errorOutput->setVerbosity($this->output->getVerbosity());
157
-            $errorOutput->setDecorated($this->output->isDecorated());
154
+            $errorOutput = new StreamOutput( fopen( 'php://memory', 'w', false ) );
155
+            $errorOutput->setFormatter( $this->output->getFormatter() );
156
+            $errorOutput->setVerbosity( $this->output->getVerbosity() );
157
+            $errorOutput->setDecorated( $this->output->isDecorated() );
158 158
 
159
-            $reflectedOutput = new \ReflectionObject($this->output);
160
-            $strErrProperty = $reflectedOutput->getProperty('stderr');
161
-            $strErrProperty->setAccessible(true);
162
-            $strErrProperty->setValue($this->output, $errorOutput);
159
+            $reflectedOutput = new \ReflectionObject( $this->output );
160
+            $strErrProperty = $reflectedOutput->getProperty( 'stderr' );
161
+            $strErrProperty->setAccessible( true );
162
+            $strErrProperty->setValue( $this->output, $errorOutput );
163 163
 
164 164
             $reflectedParent = $reflectedOutput->getParentClass();
165
-            $streamProperty = $reflectedParent->getProperty('stream');
166
-            $streamProperty->setAccessible(true);
167
-            $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
165
+            $streamProperty = $reflectedParent->getProperty( 'stream' );
166
+            $streamProperty->setAccessible( true );
167
+            $streamProperty->setValue( $this->output, fopen( 'php://memory', 'w', false ) );
168 168
         }
169 169
     }
170 170
 
171 171
     /**
172 172
      * @return resource
173 173
      */
174
-    private static function createStream(array $inputs)
174
+    private static function createStream( array $inputs )
175 175
     {
176
-        $stream = fopen('php://memory', 'r+', false);
176
+        $stream = fopen( 'php://memory', 'r+', false );
177 177
 
178
-        foreach ($inputs as $input) {
179
-            fwrite($stream, $input.\PHP_EOL);
178
+        foreach ( $inputs as $input ) {
179
+            fwrite( $stream, $input . \PHP_EOL );
180 180
         }
181 181
 
182
-        rewind($stream);
182
+        rewind( $stream );
183 183
 
184 184
         return $stream;
185 185
     }
Please login to merge, or discard this patch.
vendor/symfony/console/SingleCommandApplication.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     private $autoExit = true;
25 25
     private $running = false;
26 26
 
27
-    public function setVersion(string $version): self
27
+    public function setVersion( string $version ): self
28 28
     {
29 29
         $this->version = $version;
30 30
 
@@ -34,30 +34,30 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * @final
36 36
      */
37
-    public function setAutoExit(bool $autoExit): self
37
+    public function setAutoExit( bool $autoExit ): self
38 38
     {
39 39
         $this->autoExit = $autoExit;
40 40
 
41 41
         return $this;
42 42
     }
43 43
 
44
-    public function run(InputInterface $input = null, OutputInterface $output = null): int
44
+    public function run( InputInterface $input = null, OutputInterface $output = null ): int
45 45
     {
46
-        if ($this->running) {
47
-            return parent::run($input, $output);
46
+        if ( $this->running ) {
47
+            return parent::run( $input, $output );
48 48
         }
49 49
 
50 50
         // We use the command name as the application name
51
-        $application = new Application($this->getName() ?: 'UNKNOWN', $this->version);
52
-        $application->setAutoExit($this->autoExit);
51
+        $application = new Application( $this->getName() ?: 'UNKNOWN', $this->version );
52
+        $application->setAutoExit( $this->autoExit );
53 53
         // Fix the usage of the command displayed with "--help"
54
-        $this->setName($_SERVER['argv'][0]);
55
-        $application->add($this);
56
-        $application->setDefaultCommand($this->getName(), true);
54
+        $this->setName( $_SERVER[ 'argv' ][ 0 ] );
55
+        $application->add( $this );
56
+        $application->setDefaultCommand( $this->getName(), true );
57 57
 
58 58
         $this->running = true;
59 59
         try {
60
-            $ret = $application->run($input, $output);
60
+            $ret = $application->run( $input, $output );
61 61
         } finally {
62 62
             $this->running = false;
63 63
         }
Please login to merge, or discard this patch.
vendor/symfony/string/AbstractUnicodeString.php 1 patch
Spacing   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -37,39 +37,39 @@  discard block
 block discarded – undo
37 37
     private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
38 38
 
39 39
     // the subset of folded case mappings that is not in lower case mappings
40
-    private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'İ', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
41
-    private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ'];
40
+    private const FOLD_FROM = [ 'İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'İ', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ' ];
41
+    private const FOLD_TO = [ 'i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ' ];
42 42
 
43 43
     // the subset of upper case mappings that map one code point to many code points
44
-    private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ'];
45
-    private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ́', 'Ϋ́', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓́', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ́', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ́', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂'];
44
+    private const UPPER_FROM = [ 'ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ' ];
45
+    private const UPPER_TO = [ 'SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ́', 'Ϋ́', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓́', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ́', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ́', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂' ];
46 46
 
47 47
     // the subset of https://github.com/unicode-org/cldr/blob/master/common/transforms/Latin-ASCII.xml that is not in NFKD
48
-    private const TRANSLIT_FROM = ['Æ', 'Ð', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', 'Đ', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', 'Ɓ', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', 'Ɛ', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', 'Ɲ', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', 'ɍ', 'Ɏ', 'ɏ', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', 'ʏ', 'ʐ', 'ʑ', 'ʙ', 'ʛ', 'ʜ', 'ʝ', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', 'ᴁ', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', 'ᴍ', 'ᴏ', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', 'ᶁ', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', 'ᶍ', 'ᶎ', 'ᶏ', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', 'ẝ', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '㏆', '㏗', '㏞', '㏟', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '⅝', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '′', '″', '〝', '〞', '«', '»', '‹', '›', '‐', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '⁄', '⁅', '⁆', '⁎', '、', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '﹝', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆'];
49
-    private const TRANSLIT_TO = ['AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))'];
48
+    private const TRANSLIT_FROM = [ 'Æ', 'Ð', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', 'Đ', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', 'Ɓ', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', 'Ɛ', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', 'Ɲ', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', 'ɍ', 'Ɏ', 'ɏ', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', 'ʏ', 'ʐ', 'ʑ', 'ʙ', 'ʛ', 'ʜ', 'ʝ', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', 'ᴁ', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', 'ᴍ', 'ᴏ', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', 'ᶁ', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', 'ᶍ', 'ᶎ', 'ᶏ', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', 'ẝ', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '㏆', '㏗', '㏞', '㏟', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '⅝', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '′', '″', '〝', '〞', '«', '»', '‹', '›', '‐', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '⁄', '⁅', '⁆', '⁎', '、', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '﹝', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆' ];
49
+    private const TRANSLIT_TO = [ 'AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))' ];
50 50
 
51
-    private static $transliterators = [];
51
+    private static $transliterators = [ ];
52 52
 
53 53
     /**
54 54
      * @return static
55 55
      */
56
-    public static function fromCodePoints(int ...$codes): self
56
+    public static function fromCodePoints( int ...$codes ): self
57 57
     {
58 58
         $string = '';
59 59
 
60
-        foreach ($codes as $code) {
61
-            if (0x80 > $code %= 0x200000) {
62
-                $string .= \chr($code);
63
-            } elseif (0x800 > $code) {
64
-                $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
65
-            } elseif (0x10000 > $code) {
66
-                $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
60
+        foreach ( $codes as $code ) {
61
+            if ( 0x80 > $code %= 0x200000 ) {
62
+                $string .= \chr( $code );
63
+            } elseif ( 0x800 > $code ) {
64
+                $string .= \chr( 0xC0 | $code >> 6 ) . \chr( 0x80 | $code & 0x3F );
65
+            } elseif ( 0x10000 > $code ) {
66
+                $string .= \chr( 0xE0 | $code >> 12 ) . \chr( 0x80 | $code >> 6 & 0x3F ) . \chr( 0x80 | $code & 0x3F );
67 67
             } else {
68
-                $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
68
+                $string .= \chr( 0xF0 | $code >> 18 ) . \chr( 0x80 | $code >> 12 & 0x3F ) . \chr( 0x80 | $code >> 6 & 0x3F ) . \chr( 0x80 | $code & 0x3F );
69 69
             }
70 70
         }
71 71
 
72
-        return new static($string);
72
+        return new static( $string );
73 73
     }
74 74
 
75 75
     /**
@@ -79,76 +79,76 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @param string[]|\Transliterator[]|\Closure[] $rules See "*-Latin" rules from Transliterator::listIDs()
81 81
      */
82
-    public function ascii(array $rules = []): self
82
+    public function ascii( array $rules = [ ] ): self
83 83
     {
84 84
         $str = clone $this;
85 85
         $s = $str->string;
86 86
         $str->string = '';
87 87
 
88
-        array_unshift($rules, 'nfd');
89
-        $rules[] = 'latin-ascii';
88
+        array_unshift( $rules, 'nfd' );
89
+        $rules[ ] = 'latin-ascii';
90 90
 
91
-        if (\function_exists('transliterator_transliterate')) {
92
-            $rules[] = 'any-latin/bgn';
91
+        if ( \function_exists( 'transliterator_transliterate' ) ) {
92
+            $rules[ ] = 'any-latin/bgn';
93 93
         }
94 94
 
95
-        $rules[] = 'nfkd';
96
-        $rules[] = '[:nonspacing mark:] remove';
95
+        $rules[ ] = 'nfkd';
96
+        $rules[ ] = '[:nonspacing mark:] remove';
97 97
 
98
-        while (\strlen($s) - 1 > $i = strspn($s, self::ASCII)) {
99
-            if (0 < --$i) {
100
-                $str->string .= substr($s, 0, $i);
101
-                $s = substr($s, $i);
98
+        while ( \strlen( $s ) - 1 > $i = strspn( $s, self::ASCII ) ) {
99
+            if ( 0 < --$i ) {
100
+                $str->string .= substr( $s, 0, $i );
101
+                $s = substr( $s, $i );
102 102
             }
103 103
 
104
-            if (!$rule = array_shift($rules)) {
105
-                $rules = []; // An empty rule interrupts the next ones
104
+            if ( ! $rule = array_shift( $rules ) ) {
105
+                $rules = [ ]; // An empty rule interrupts the next ones
106 106
             }
107 107
 
108
-            if ($rule instanceof \Transliterator) {
109
-                $s = $rule->transliterate($s);
110
-            } elseif ($rule instanceof \Closure) {
111
-                $s = $rule($s);
112
-            } elseif ($rule) {
113
-                if ('nfd' === $rule = strtolower($rule)) {
114
-                    normalizer_is_normalized($s, self::NFD) ?: $s = normalizer_normalize($s, self::NFD);
115
-                } elseif ('nfkd' === $rule) {
116
-                    normalizer_is_normalized($s, self::NFKD) ?: $s = normalizer_normalize($s, self::NFKD);
117
-                } elseif ('[:nonspacing mark:] remove' === $rule) {
118
-                    $s = preg_replace('/\p{Mn}++/u', '', $s);
119
-                } elseif ('latin-ascii' === $rule) {
120
-                    $s = str_replace(self::TRANSLIT_FROM, self::TRANSLIT_TO, $s);
121
-                } elseif ('de-ascii' === $rule) {
122
-                    $s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s);
123
-                    $s = str_replace(["a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}"], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], $s);
124
-                } elseif (\function_exists('transliterator_transliterate')) {
125
-                    if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) {
126
-                        if ('any-latin/bgn' === $rule) {
108
+            if ( $rule instanceof \Transliterator ) {
109
+                $s = $rule->transliterate( $s );
110
+            } elseif ( $rule instanceof \Closure ) {
111
+                $s = $rule( $s );
112
+            } elseif ( $rule ) {
113
+                if ( 'nfd' === $rule = strtolower( $rule ) ) {
114
+                    normalizer_is_normalized( $s, self::NFD ) ?: $s = normalizer_normalize( $s, self::NFD );
115
+                } elseif ( 'nfkd' === $rule ) {
116
+                    normalizer_is_normalized( $s, self::NFKD ) ?: $s = normalizer_normalize( $s, self::NFKD );
117
+                } elseif ( '[:nonspacing mark:] remove' === $rule ) {
118
+                    $s = preg_replace( '/\p{Mn}++/u', '', $s );
119
+                } elseif ( 'latin-ascii' === $rule ) {
120
+                    $s = str_replace( self::TRANSLIT_FROM, self::TRANSLIT_TO, $s );
121
+                } elseif ( 'de-ascii' === $rule ) {
122
+                    $s = preg_replace( "/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s );
123
+                    $s = str_replace( [ "a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}" ], [ 'ae', 'oe', 'ue', 'AE', 'OE', 'UE' ], $s );
124
+                } elseif ( \function_exists( 'transliterator_transliterate' ) ) {
125
+                    if ( null === $transliterator = self::$transliterators[ $rule ] ?? self::$transliterators[ $rule ] = \Transliterator::create( $rule ) ) {
126
+                        if ( 'any-latin/bgn' === $rule ) {
127 127
                             $rule = 'any-latin';
128
-                            $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule);
128
+                            $transliterator = self::$transliterators[ $rule ] ?? self::$transliterators[ $rule ] = \Transliterator::create( $rule );
129 129
                         }
130 130
 
131
-                        if (null === $transliterator) {
132
-                            throw new InvalidArgumentException(sprintf('Unknown transliteration rule "%s".', $rule));
131
+                        if ( null === $transliterator ) {
132
+                            throw new InvalidArgumentException( sprintf( 'Unknown transliteration rule "%s".', $rule ) );
133 133
                         }
134 134
 
135
-                        self::$transliterators['any-latin/bgn'] = $transliterator;
135
+                        self::$transliterators[ 'any-latin/bgn' ] = $transliterator;
136 136
                     }
137 137
 
138
-                    $s = $transliterator->transliterate($s);
138
+                    $s = $transliterator->transliterate( $s );
139 139
                 }
140
-            } elseif (!\function_exists('iconv')) {
141
-                $s = preg_replace('/[^\x00-\x7F]/u', '?', $s);
140
+            } elseif ( ! \function_exists( 'iconv' ) ) {
141
+                $s = preg_replace( '/[^\x00-\x7F]/u', '?', $s );
142 142
             } else {
143
-                $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
144
-                    $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]);
143
+                $s = @preg_replace_callback( '/[^\x00-\x7F]/u', static function( $c ) {
144
+                    $c = (string)iconv( 'UTF-8', 'ASCII//TRANSLIT', $c[ 0 ] );
145 145
 
146
-                    if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) {
147
-                        throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class));
146
+                    if ( '' === $c && '' === iconv( 'UTF-8', 'ASCII//TRANSLIT', '²' ) ) {
147
+                        throw new \LogicException( sprintf( '"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class ) );
148 148
                     }
149 149
 
150
-                    return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : ('' !== $c ? $c : '?');
151
-                }, $s);
150
+                    return 1 < \strlen( $c ) ? ltrim( $c, '\'`"^~' ) : ( '' !== $c ? $c : '?' );
151
+                }, $s );
152 152
             }
153 153
         }
154 154
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
     public function camel(): parent
161 161
     {
162 162
         $str = clone $this;
163
-        $str->string = str_replace(' ', '', preg_replace_callback('/\b./u', static function ($m) use (&$i) {
164
-            return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
165
-        }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string)));
163
+        $str->string = str_replace( ' ', '', preg_replace_callback( '/\b./u', static function( $m ) use ( &$i ) {
164
+            return 1 === ++$i ? ( 'İ' === $m[ 0 ] ? 'i̇' : mb_strtolower( $m[ 0 ], 'UTF-8' ) ) : mb_convert_case( $m[ 0 ], \MB_CASE_TITLE, 'UTF-8' );
165
+        }, preg_replace( '/[^\pL0-9]++/u', ' ', $this->string ) ) );
166 166
 
167 167
         return $str;
168 168
     }
@@ -170,46 +170,46 @@  discard block
 block discarded – undo
170 170
     /**
171 171
      * @return int[]
172 172
      */
173
-    public function codePointsAt(int $offset): array
173
+    public function codePointsAt( int $offset ): array
174 174
     {
175
-        $str = $this->slice($offset, 1);
175
+        $str = $this->slice( $offset, 1 );
176 176
 
177
-        if ('' === $str->string) {
178
-            return [];
177
+        if ( '' === $str->string ) {
178
+            return [ ];
179 179
         }
180 180
 
181
-        $codePoints = [];
181
+        $codePoints = [ ];
182 182
 
183
-        foreach (preg_split('//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
184
-            $codePoints[] = mb_ord($c, 'UTF-8');
183
+        foreach ( preg_split( '//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY ) as $c ) {
184
+            $codePoints[ ] = mb_ord( $c, 'UTF-8' );
185 185
         }
186 186
 
187 187
         return $codePoints;
188 188
     }
189 189
 
190
-    public function folded(bool $compat = true): parent
190
+    public function folded( bool $compat = true ): parent
191 191
     {
192 192
         $str = clone $this;
193 193
 
194
-        if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) {
195
-            $str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC);
196
-            $str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $this->string), 'UTF-8');
194
+        if ( ! $compat || \PHP_VERSION_ID < 70300 || ! \defined( 'Normalizer::NFKC_CF' ) ) {
195
+            $str->string = normalizer_normalize( $str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC );
196
+            $str->string = mb_strtolower( str_replace( self::FOLD_FROM, self::FOLD_TO, $this->string ), 'UTF-8' );
197 197
         } else {
198
-            $str->string = normalizer_normalize($str->string, \Normalizer::NFKC_CF);
198
+            $str->string = normalizer_normalize( $str->string, \Normalizer::NFKC_CF );
199 199
         }
200 200
 
201 201
         return $str;
202 202
     }
203 203
 
204
-    public function join(array $strings, string $lastGlue = null): parent
204
+    public function join( array $strings, string $lastGlue = null ): parent
205 205
     {
206 206
         $str = clone $this;
207 207
 
208
-        $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
209
-        $str->string = implode($this->string, $strings).$tail;
208
+        $tail = null !== $lastGlue && 1 < \count( $strings ) ? $lastGlue . array_pop( $strings ) : '';
209
+        $str->string = implode( $this->string, $strings ) . $tail;
210 210
 
211
-        if (!preg_match('//u', $str->string)) {
212
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
211
+        if ( ! preg_match( '//u', $str->string ) ) {
212
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
213 213
         }
214 214
 
215 215
         return $str;
@@ -218,32 +218,32 @@  discard block
 block discarded – undo
218 218
     public function lower(): parent
219 219
     {
220 220
         $str = clone $this;
221
-        $str->string = mb_strtolower(str_replace('İ', 'i̇', $str->string), 'UTF-8');
221
+        $str->string = mb_strtolower( str_replace( 'İ', 'i̇', $str->string ), 'UTF-8' );
222 222
 
223 223
         return $str;
224 224
     }
225 225
 
226
-    public function match(string $regexp, int $flags = 0, int $offset = 0): array
226
+    public function match( string $regexp, int $flags = 0, int $offset = 0 ): array
227 227
     {
228
-        $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
228
+        $match = ( ( \PREG_PATTERN_ORDER | \PREG_SET_ORDER ) & $flags ) ? 'preg_match_all' : 'preg_match';
229 229
 
230
-        if ($this->ignoreCase) {
230
+        if ( $this->ignoreCase ) {
231 231
             $regexp .= 'i';
232 232
         }
233 233
 
234
-        set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
234
+        set_error_handler( static function( $t, $m ) { throw new InvalidArgumentException( $m ); });
235 235
 
236 236
         try {
237
-            if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
237
+            if ( false === $match( $regexp . 'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset ) ) {
238 238
                 $lastError = preg_last_error();
239 239
 
240
-                foreach (get_defined_constants(true)['pcre'] as $k => $v) {
241
-                    if ($lastError === $v && '_ERROR' === substr($k, -6)) {
242
-                        throw new RuntimeException('Matching failed with '.$k.'.');
240
+                foreach ( get_defined_constants( true )[ 'pcre' ] as $k => $v ) {
241
+                    if ( $lastError === $v && '_ERROR' === substr( $k, -6 ) ) {
242
+                        throw new RuntimeException( 'Matching failed with ' . $k . '.' );
243 243
                     }
244 244
                 }
245 245
 
246
-                throw new RuntimeException('Matching failed with unknown error code.');
246
+                throw new RuntimeException( 'Matching failed with unknown error code.' );
247 247
             }
248 248
         } finally {
249 249
             restore_error_handler();
@@ -255,94 +255,94 @@  discard block
 block discarded – undo
255 255
     /**
256 256
      * @return static
257 257
      */
258
-    public function normalize(int $form = self::NFC): self
258
+    public function normalize( int $form = self::NFC ): self
259 259
     {
260
-        if (!\in_array($form, [self::NFC, self::NFD, self::NFKC, self::NFKD])) {
261
-            throw new InvalidArgumentException('Unsupported normalization form.');
260
+        if ( ! \in_array( $form, [ self::NFC, self::NFD, self::NFKC, self::NFKD ] ) ) {
261
+            throw new InvalidArgumentException( 'Unsupported normalization form.' );
262 262
         }
263 263
 
264 264
         $str = clone $this;
265
-        normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
265
+        normalizer_is_normalized( $str->string, $form ) ?: $str->string = normalizer_normalize( $str->string, $form );
266 266
 
267 267
         return $str;
268 268
     }
269 269
 
270
-    public function padBoth(int $length, string $padStr = ' '): parent
270
+    public function padBoth( int $length, string $padStr = ' ' ): parent
271 271
     {
272
-        if ('' === $padStr || !preg_match('//u', $padStr)) {
273
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
272
+        if ( '' === $padStr || ! preg_match( '//u', $padStr ) ) {
273
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
274 274
         }
275 275
 
276 276
         $pad = clone $this;
277 277
         $pad->string = $padStr;
278 278
 
279
-        return $this->pad($length, $pad, \STR_PAD_BOTH);
279
+        return $this->pad( $length, $pad, \STR_PAD_BOTH );
280 280
     }
281 281
 
282
-    public function padEnd(int $length, string $padStr = ' '): parent
282
+    public function padEnd( int $length, string $padStr = ' ' ): parent
283 283
     {
284
-        if ('' === $padStr || !preg_match('//u', $padStr)) {
285
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
284
+        if ( '' === $padStr || ! preg_match( '//u', $padStr ) ) {
285
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
286 286
         }
287 287
 
288 288
         $pad = clone $this;
289 289
         $pad->string = $padStr;
290 290
 
291
-        return $this->pad($length, $pad, \STR_PAD_RIGHT);
291
+        return $this->pad( $length, $pad, \STR_PAD_RIGHT );
292 292
     }
293 293
 
294
-    public function padStart(int $length, string $padStr = ' '): parent
294
+    public function padStart( int $length, string $padStr = ' ' ): parent
295 295
     {
296
-        if ('' === $padStr || !preg_match('//u', $padStr)) {
297
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
296
+        if ( '' === $padStr || ! preg_match( '//u', $padStr ) ) {
297
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
298 298
         }
299 299
 
300 300
         $pad = clone $this;
301 301
         $pad->string = $padStr;
302 302
 
303
-        return $this->pad($length, $pad, \STR_PAD_LEFT);
303
+        return $this->pad( $length, $pad, \STR_PAD_LEFT );
304 304
     }
305 305
 
306
-    public function replaceMatches(string $fromRegexp, $to): parent
306
+    public function replaceMatches( string $fromRegexp, $to ): parent
307 307
     {
308
-        if ($this->ignoreCase) {
308
+        if ( $this->ignoreCase ) {
309 309
             $fromRegexp .= 'i';
310 310
         }
311 311
 
312
-        if (\is_array($to) || $to instanceof \Closure) {
313
-            if (!\is_callable($to)) {
314
-                throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
312
+        if ( \is_array( $to ) || $to instanceof \Closure ) {
313
+            if ( ! \is_callable( $to ) ) {
314
+                throw new \TypeError( sprintf( 'Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class ) );
315 315
             }
316 316
 
317 317
             $replace = 'preg_replace_callback';
318
-            $to = static function (array $m) use ($to): string {
319
-                $to = $to($m);
318
+            $to = static function( array $m ) use ( $to ): string {
319
+                $to = $to( $m );
320 320
 
321
-                if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) {
322
-                    throw new InvalidArgumentException('Replace callback must return a valid UTF-8 string.');
321
+                if ( '' !== $to && ( ! \is_string( $to ) || ! preg_match( '//u', $to ) ) ) {
322
+                    throw new InvalidArgumentException( 'Replace callback must return a valid UTF-8 string.' );
323 323
                 }
324 324
 
325 325
                 return $to;
326 326
             };
327
-        } elseif ('' !== $to && !preg_match('//u', $to)) {
328
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
327
+        } elseif ( '' !== $to && ! preg_match( '//u', $to ) ) {
328
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
329 329
         } else {
330 330
             $replace = 'preg_replace';
331 331
         }
332 332
 
333
-        set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
333
+        set_error_handler( static function( $t, $m ) { throw new InvalidArgumentException( $m ); });
334 334
 
335 335
         try {
336
-            if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) {
336
+            if ( null === $string = $replace( $fromRegexp . 'u', $to, $this->string ) ) {
337 337
                 $lastError = preg_last_error();
338 338
 
339
-                foreach (get_defined_constants(true)['pcre'] as $k => $v) {
340
-                    if ($lastError === $v && '_ERROR' === substr($k, -6)) {
341
-                        throw new RuntimeException('Matching failed with '.$k.'.');
339
+                foreach ( get_defined_constants( true )[ 'pcre' ] as $k => $v ) {
340
+                    if ( $lastError === $v && '_ERROR' === substr( $k, -6 ) ) {
341
+                        throw new RuntimeException( 'Matching failed with ' . $k . '.' );
342 342
                     }
343 343
                 }
344 344
 
345
-                throw new RuntimeException('Matching failed with unknown error code.');
345
+                throw new RuntimeException( 'Matching failed with unknown error code.' );
346 346
             }
347 347
         } finally {
348 348
             restore_error_handler();
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     public function reverse(): parent
358 358
     {
359 359
         $str = clone $this;
360
-        $str->string = implode('', array_reverse(preg_split('/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY)));
360
+        $str->string = implode( '', array_reverse( preg_split( '/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY ) ) );
361 361
 
362 362
         return $str;
363 363
     }
@@ -365,59 +365,59 @@  discard block
 block discarded – undo
365 365
     public function snake(): parent
366 366
     {
367 367
         $str = $this->camel()->title();
368
-        $str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8');
368
+        $str->string = mb_strtolower( preg_replace( [ '/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u' ], '\1_\2', $str->string ), 'UTF-8' );
369 369
 
370 370
         return $str;
371 371
     }
372 372
 
373
-    public function title(bool $allWords = false): parent
373
+    public function title( bool $allWords = false ): parent
374 374
     {
375 375
         $str = clone $this;
376 376
 
377 377
         $limit = $allWords ? -1 : 1;
378 378
 
379
-        $str->string = preg_replace_callback('/\b./u', static function (array $m): string {
380
-            return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
381
-        }, $str->string, $limit);
379
+        $str->string = preg_replace_callback( '/\b./u', static function( array $m ): string {
380
+            return mb_convert_case( $m[ 0 ], \MB_CASE_TITLE, 'UTF-8' );
381
+        }, $str->string, $limit );
382 382
 
383 383
         return $str;
384 384
     }
385 385
 
386
-    public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
386
+    public function trim( string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" ): parent
387 387
     {
388
-        if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
389
-            throw new InvalidArgumentException('Invalid UTF-8 chars.');
388
+        if ( " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && ! preg_match( '//u', $chars ) ) {
389
+            throw new InvalidArgumentException( 'Invalid UTF-8 chars.' );
390 390
         }
391
-        $chars = preg_quote($chars);
391
+        $chars = preg_quote( $chars );
392 392
 
393 393
         $str = clone $this;
394
-        $str->string = preg_replace("{^[$chars]++|[$chars]++$}uD", '', $str->string);
394
+        $str->string = preg_replace( "{^[$chars]++|[$chars]++$}uD", '', $str->string );
395 395
 
396 396
         return $str;
397 397
     }
398 398
 
399
-    public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
399
+    public function trimEnd( string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" ): parent
400 400
     {
401
-        if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
402
-            throw new InvalidArgumentException('Invalid UTF-8 chars.');
401
+        if ( " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && ! preg_match( '//u', $chars ) ) {
402
+            throw new InvalidArgumentException( 'Invalid UTF-8 chars.' );
403 403
         }
404
-        $chars = preg_quote($chars);
404
+        $chars = preg_quote( $chars );
405 405
 
406 406
         $str = clone $this;
407
-        $str->string = preg_replace("{[$chars]++$}uD", '', $str->string);
407
+        $str->string = preg_replace( "{[$chars]++$}uD", '', $str->string );
408 408
 
409 409
         return $str;
410 410
     }
411 411
 
412
-    public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
412
+    public function trimStart( string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" ): parent
413 413
     {
414
-        if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
415
-            throw new InvalidArgumentException('Invalid UTF-8 chars.');
414
+        if ( " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && ! preg_match( '//u', $chars ) ) {
415
+            throw new InvalidArgumentException( 'Invalid UTF-8 chars.' );
416 416
         }
417
-        $chars = preg_quote($chars);
417
+        $chars = preg_quote( $chars );
418 418
 
419 419
         $str = clone $this;
420
-        $str->string = preg_replace("{^[$chars]++}uD", '', $str->string);
420
+        $str->string = preg_replace( "{^[$chars]++}uD", '', $str->string );
421 421
 
422 422
         return $str;
423 423
     }
@@ -425,39 +425,39 @@  discard block
 block discarded – undo
425 425
     public function upper(): parent
426 426
     {
427 427
         $str = clone $this;
428
-        $str->string = mb_strtoupper($str->string, 'UTF-8');
428
+        $str->string = mb_strtoupper( $str->string, 'UTF-8' );
429 429
 
430
-        if (\PHP_VERSION_ID < 70300) {
431
-            $str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string);
430
+        if ( \PHP_VERSION_ID < 70300 ) {
431
+            $str->string = str_replace( self::UPPER_FROM, self::UPPER_TO, $str->string );
432 432
         }
433 433
 
434 434
         return $str;
435 435
     }
436 436
 
437
-    public function width(bool $ignoreAnsiDecoration = true): int
437
+    public function width( bool $ignoreAnsiDecoration = true ): int
438 438
     {
439 439
         $width = 0;
440
-        $s = str_replace(["\x00", "\x05", "\x07"], '', $this->string);
440
+        $s = str_replace( [ "\x00", "\x05", "\x07" ], '', $this->string );
441 441
 
442
-        if (false !== strpos($s, "\r")) {
443
-            $s = str_replace(["\r\n", "\r"], "\n", $s);
442
+        if ( false !== strpos( $s, "\r" ) ) {
443
+            $s = str_replace( [ "\r\n", "\r" ], "\n", $s );
444 444
         }
445 445
 
446
-        if (!$ignoreAnsiDecoration) {
447
-            $s = preg_replace('/[\p{Cc}\x7F]++/u', '', $s);
446
+        if ( ! $ignoreAnsiDecoration ) {
447
+            $s = preg_replace( '/[\p{Cc}\x7F]++/u', '', $s );
448 448
         }
449 449
 
450
-        foreach (explode("\n", $s) as $s) {
451
-            if ($ignoreAnsiDecoration) {
452
-                $s = preg_replace('/(?:\x1B(?:
450
+        foreach ( explode( "\n", $s ) as $s ) {
451
+            if ( $ignoreAnsiDecoration ) {
452
+                $s = preg_replace( '/(?:\x1B(?:
453 453
                     \[ [\x30-\x3F]*+ [\x20-\x2F]*+ [0x40-\x7E]
454 454
                     | [P\]X^_] .*? \x1B\\\\
455 455
                     | [\x41-\x7E]
456
-                )|[\p{Cc}\x7F]++)/xu', '', $s);
456
+                )|[\p{Cc}\x7F]++)/xu', '', $s );
457 457
             }
458 458
 
459 459
             // Non printable characters have been dropped, so wcswidth cannot logically return -1.
460
-            $width += $this->wcswidth($s);
460
+            $width += $this->wcswidth( $s );
461 461
         }
462 462
 
463 463
         return $width;
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
     /**
467 467
      * @return static
468 468
      */
469
-    private function pad(int $len, self $pad, int $type): parent
469
+    private function pad( int $len, self $pad, int $type ): parent
470 470
     {
471 471
         $sLen = $this->length();
472 472
 
473
-        if ($len <= $sLen) {
473
+        if ( $len <= $sLen ) {
474 474
             return clone $this;
475 475
         }
476 476
 
@@ -478,71 +478,71 @@  discard block
 block discarded – undo
478 478
         $freeLen = $len - $sLen;
479 479
         $len = $freeLen % $padLen;
480 480
 
481
-        switch ($type) {
481
+        switch ( $type ) {
482 482
             case \STR_PAD_RIGHT:
483
-                return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
483
+                return $this->append( str_repeat( $pad->string, intdiv( $freeLen, $padLen ) ) . ( $len ? $pad->slice( 0, $len ) : '' ) );
484 484
 
485 485
             case \STR_PAD_LEFT:
486
-                return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
486
+                return $this->prepend( str_repeat( $pad->string, intdiv( $freeLen, $padLen ) ) . ( $len ? $pad->slice( 0, $len ) : '' ) );
487 487
 
488 488
             case \STR_PAD_BOTH:
489 489
                 $freeLen /= 2;
490 490
 
491
-                $rightLen = ceil($freeLen);
491
+                $rightLen = ceil( $freeLen );
492 492
                 $len = $rightLen % $padLen;
493
-                $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
493
+                $str = $this->append( str_repeat( $pad->string, intdiv( $rightLen, $padLen ) ) . ( $len ? $pad->slice( 0, $len ) : '' ) );
494 494
 
495
-                $leftLen = floor($freeLen);
495
+                $leftLen = floor( $freeLen );
496 496
                 $len = $leftLen % $padLen;
497 497
 
498
-                return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
498
+                return $str->prepend( str_repeat( $pad->string, intdiv( $leftLen, $padLen ) ) . ( $len ? $pad->slice( 0, $len ) : '' ) );
499 499
 
500 500
             default:
501
-                throw new InvalidArgumentException('Invalid padding type.');
501
+                throw new InvalidArgumentException( 'Invalid padding type.' );
502 502
         }
503 503
     }
504 504
 
505 505
     /**
506 506
      * Based on https://github.com/jquast/wcwidth, a Python implementation of https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c.
507 507
      */
508
-    private function wcswidth(string $string): int
508
+    private function wcswidth( string $string ): int
509 509
     {
510 510
         $width = 0;
511 511
 
512
-        foreach (preg_split('//u', $string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
513
-            $codePoint = mb_ord($c, 'UTF-8');
512
+        foreach ( preg_split( '//u', $string, -1, \PREG_SPLIT_NO_EMPTY ) as $c ) {
513
+            $codePoint = mb_ord( $c, 'UTF-8' );
514 514
 
515
-            if (0 === $codePoint // NULL
515
+            if ( 0 === $codePoint // NULL
516 516
                 || 0x034F === $codePoint // COMBINING GRAPHEME JOINER
517
-                || (0x200B <= $codePoint && 0x200F >= $codePoint) // ZERO WIDTH SPACE to RIGHT-TO-LEFT MARK
517
+                || ( 0x200B <= $codePoint && 0x200F >= $codePoint ) // ZERO WIDTH SPACE to RIGHT-TO-LEFT MARK
518 518
                 || 0x2028 === $codePoint // LINE SEPARATOR
519 519
                 || 0x2029 === $codePoint // PARAGRAPH SEPARATOR
520
-                || (0x202A <= $codePoint && 0x202E >= $codePoint) // LEFT-TO-RIGHT EMBEDDING to RIGHT-TO-LEFT OVERRIDE
521
-                || (0x2060 <= $codePoint && 0x2063 >= $codePoint) // WORD JOINER to INVISIBLE SEPARATOR
520
+                || ( 0x202A <= $codePoint && 0x202E >= $codePoint ) // LEFT-TO-RIGHT EMBEDDING to RIGHT-TO-LEFT OVERRIDE
521
+                || ( 0x2060 <= $codePoint && 0x2063 >= $codePoint ) // WORD JOINER to INVISIBLE SEPARATOR
522 522
             ) {
523 523
                 continue;
524 524
             }
525 525
 
526 526
             // Non printable characters
527
-            if (32 > $codePoint // C0 control characters
528
-                || (0x07F <= $codePoint && 0x0A0 > $codePoint) // C1 control characters and DEL
527
+            if ( 32 > $codePoint // C0 control characters
528
+                || ( 0x07F <= $codePoint && 0x0A0 > $codePoint ) // C1 control characters and DEL
529 529
             ) {
530 530
                 return -1;
531 531
             }
532 532
 
533 533
             static $tableZero;
534
-            if (null === $tableZero) {
535
-                $tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php';
534
+            if ( null === $tableZero ) {
535
+                $tableZero = require __DIR__ . '/Resources/data/wcswidth_table_zero.php';
536 536
             }
537 537
 
538
-            if ($codePoint >= $tableZero[0][0] && $codePoint <= $tableZero[$ubound = \count($tableZero) - 1][1]) {
538
+            if ( $codePoint >= $tableZero[ 0 ][ 0 ] && $codePoint <= $tableZero[ $ubound = \count( $tableZero ) - 1 ][ 1 ] ) {
539 539
                 $lbound = 0;
540
-                while ($ubound >= $lbound) {
541
-                    $mid = floor(($lbound + $ubound) / 2);
540
+                while ( $ubound >= $lbound ) {
541
+                    $mid = floor( ( $lbound + $ubound ) / 2 );
542 542
 
543
-                    if ($codePoint > $tableZero[$mid][1]) {
543
+                    if ( $codePoint > $tableZero[ $mid ][ 1 ] ) {
544 544
                         $lbound = $mid + 1;
545
-                    } elseif ($codePoint < $tableZero[$mid][0]) {
545
+                    } elseif ( $codePoint < $tableZero[ $mid ][ 0 ] ) {
546 546
                         $ubound = $mid - 1;
547 547
                     } else {
548 548
                         continue 2;
@@ -551,18 +551,18 @@  discard block
 block discarded – undo
551 551
             }
552 552
 
553 553
             static $tableWide;
554
-            if (null === $tableWide) {
555
-                $tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php';
554
+            if ( null === $tableWide ) {
555
+                $tableWide = require __DIR__ . '/Resources/data/wcswidth_table_wide.php';
556 556
             }
557 557
 
558
-            if ($codePoint >= $tableWide[0][0] && $codePoint <= $tableWide[$ubound = \count($tableWide) - 1][1]) {
558
+            if ( $codePoint >= $tableWide[ 0 ][ 0 ] && $codePoint <= $tableWide[ $ubound = \count( $tableWide ) - 1 ][ 1 ] ) {
559 559
                 $lbound = 0;
560
-                while ($ubound >= $lbound) {
561
-                    $mid = floor(($lbound + $ubound) / 2);
560
+                while ( $ubound >= $lbound ) {
561
+                    $mid = floor( ( $lbound + $ubound ) / 2 );
562 562
 
563
-                    if ($codePoint > $tableWide[$mid][1]) {
563
+                    if ( $codePoint > $tableWide[ $mid ][ 1 ] ) {
564 564
                         $lbound = $mid + 1;
565
-                    } elseif ($codePoint < $tableWide[$mid][0]) {
565
+                    } elseif ( $codePoint < $tableWide[ $mid ][ 0 ] ) {
566 566
                         $ubound = $mid - 1;
567 567
                     } else {
568 568
                         $width += 2;
Please login to merge, or discard this patch.
vendor/symfony/string/UnicodeString.php 1 patch
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -32,344 +32,344 @@
 block discarded – undo
32 32
  */
33 33
 class UnicodeString extends AbstractUnicodeString
34 34
 {
35
-    public function __construct(string $string = '')
35
+    public function __construct( string $string = '' )
36 36
     {
37
-        $this->string = normalizer_is_normalized($string) ? $string : normalizer_normalize($string);
37
+        $this->string = normalizer_is_normalized( $string ) ? $string : normalizer_normalize( $string );
38 38
 
39
-        if (false === $this->string) {
40
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
39
+        if ( false === $this->string ) {
40
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
41 41
         }
42 42
     }
43 43
 
44
-    public function append(string ...$suffix): AbstractString
44
+    public function append( string ...$suffix ): AbstractString
45 45
     {
46 46
         $str = clone $this;
47
-        $str->string = $this->string.(1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix));
48
-        normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
47
+        $str->string = $this->string . ( 1 >= \count( $suffix ) ? ( $suffix[ 0 ] ?? '' ) : implode( '', $suffix ) );
48
+        normalizer_is_normalized( $str->string ) ?: $str->string = normalizer_normalize( $str->string );
49 49
 
50
-        if (false === $str->string) {
51
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
50
+        if ( false === $str->string ) {
51
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
52 52
         }
53 53
 
54 54
         return $str;
55 55
     }
56 56
 
57
-    public function chunk(int $length = 1): array
57
+    public function chunk( int $length = 1 ): array
58 58
     {
59
-        if (1 > $length) {
60
-            throw new InvalidArgumentException('The chunk length must be greater than zero.');
59
+        if ( 1 > $length ) {
60
+            throw new InvalidArgumentException( 'The chunk length must be greater than zero.' );
61 61
         }
62 62
 
63
-        if ('' === $this->string) {
64
-            return [];
63
+        if ( '' === $this->string ) {
64
+            return [ ];
65 65
         }
66 66
 
67 67
         $rx = '/(';
68
-        while (65535 < $length) {
68
+        while ( 65535 < $length ) {
69 69
             $rx .= '\X{65535}';
70 70
             $length -= 65535;
71 71
         }
72
-        $rx .= '\X{'.$length.'})/u';
72
+        $rx .= '\X{' . $length . '})/u';
73 73
 
74 74
         $str = clone $this;
75
-        $chunks = [];
75
+        $chunks = [ ];
76 76
 
77
-        foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
77
+        foreach ( preg_split( $rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY ) as $chunk ) {
78 78
             $str->string = $chunk;
79
-            $chunks[] = clone $str;
79
+            $chunks[ ] = clone $str;
80 80
         }
81 81
 
82 82
         return $chunks;
83 83
     }
84 84
 
85
-    public function endsWith($suffix): bool
85
+    public function endsWith( $suffix ): bool
86 86
     {
87
-        if ($suffix instanceof AbstractString) {
87
+        if ( $suffix instanceof AbstractString ) {
88 88
             $suffix = $suffix->string;
89
-        } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
90
-            return parent::endsWith($suffix);
89
+        } elseif ( \is_array( $suffix ) || $suffix instanceof \Traversable ) {
90
+            return parent::endsWith( $suffix );
91 91
         } else {
92
-            $suffix = (string) $suffix;
92
+            $suffix = (string)$suffix;
93 93
         }
94 94
 
95 95
         $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
96
-        normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form);
96
+        normalizer_is_normalized( $suffix, $form ) ?: $suffix = normalizer_normalize( $suffix, $form );
97 97
 
98
-        if ('' === $suffix || false === $suffix) {
98
+        if ( '' === $suffix || false === $suffix ) {
99 99
             return false;
100 100
         }
101 101
 
102
-        if ($this->ignoreCase) {
103
-            return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8');
102
+        if ( $this->ignoreCase ) {
103
+            return 0 === mb_stripos( grapheme_extract( $this->string, \strlen( $suffix ), \GRAPHEME_EXTR_MAXBYTES, \strlen( $this->string ) - \strlen( $suffix ) ), $suffix, 0, 'UTF-8' );
104 104
         }
105 105
 
106
-        return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
106
+        return $suffix === grapheme_extract( $this->string, \strlen( $suffix ), \GRAPHEME_EXTR_MAXBYTES, \strlen( $this->string ) - \strlen( $suffix ) );
107 107
     }
108 108
 
109
-    public function equalsTo($string): bool
109
+    public function equalsTo( $string ): bool
110 110
     {
111
-        if ($string instanceof AbstractString) {
111
+        if ( $string instanceof AbstractString ) {
112 112
             $string = $string->string;
113
-        } elseif (\is_array($string) || $string instanceof \Traversable) {
114
-            return parent::equalsTo($string);
113
+        } elseif ( \is_array( $string ) || $string instanceof \Traversable ) {
114
+            return parent::equalsTo( $string );
115 115
         } else {
116
-            $string = (string) $string;
116
+            $string = (string)$string;
117 117
         }
118 118
 
119 119
         $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
120
-        normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form);
120
+        normalizer_is_normalized( $string, $form ) ?: $string = normalizer_normalize( $string, $form );
121 121
 
122
-        if ('' !== $string && false !== $string && $this->ignoreCase) {
123
-            return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
122
+        if ( '' !== $string && false !== $string && $this->ignoreCase ) {
123
+            return \strlen( $string ) === \strlen( $this->string ) && 0 === mb_stripos( $this->string, $string, 0, 'UTF-8' );
124 124
         }
125 125
 
126 126
         return $string === $this->string;
127 127
     }
128 128
 
129
-    public function indexOf($needle, int $offset = 0): ?int
129
+    public function indexOf( $needle, int $offset = 0 ): ?int
130 130
     {
131
-        if ($needle instanceof AbstractString) {
131
+        if ( $needle instanceof AbstractString ) {
132 132
             $needle = $needle->string;
133
-        } elseif (\is_array($needle) || $needle instanceof \Traversable) {
134
-            return parent::indexOf($needle, $offset);
133
+        } elseif ( \is_array( $needle ) || $needle instanceof \Traversable ) {
134
+            return parent::indexOf( $needle, $offset );
135 135
         } else {
136
-            $needle = (string) $needle;
136
+            $needle = (string)$needle;
137 137
         }
138 138
 
139 139
         $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
140
-        normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
140
+        normalizer_is_normalized( $needle, $form ) ?: $needle = normalizer_normalize( $needle, $form );
141 141
 
142
-        if ('' === $needle || false === $needle) {
142
+        if ( '' === $needle || false === $needle ) {
143 143
             return null;
144 144
         }
145 145
 
146 146
         try {
147
-            $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset);
148
-        } catch (\ValueError $e) {
147
+            $i = $this->ignoreCase ? grapheme_stripos( $this->string, $needle, $offset ) : grapheme_strpos( $this->string, $needle, $offset );
148
+        } catch ( \ValueError $e ) {
149 149
             return null;
150 150
         }
151 151
 
152 152
         return false === $i ? null : $i;
153 153
     }
154 154
 
155
-    public function indexOfLast($needle, int $offset = 0): ?int
155
+    public function indexOfLast( $needle, int $offset = 0 ): ?int
156 156
     {
157
-        if ($needle instanceof AbstractString) {
157
+        if ( $needle instanceof AbstractString ) {
158 158
             $needle = $needle->string;
159
-        } elseif (\is_array($needle) || $needle instanceof \Traversable) {
160
-            return parent::indexOfLast($needle, $offset);
159
+        } elseif ( \is_array( $needle ) || $needle instanceof \Traversable ) {
160
+            return parent::indexOfLast( $needle, $offset );
161 161
         } else {
162
-            $needle = (string) $needle;
162
+            $needle = (string)$needle;
163 163
         }
164 164
 
165 165
         $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
166
-        normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
166
+        normalizer_is_normalized( $needle, $form ) ?: $needle = normalizer_normalize( $needle, $form );
167 167
 
168
-        if ('' === $needle || false === $needle) {
168
+        if ( '' === $needle || false === $needle ) {
169 169
             return null;
170 170
         }
171 171
 
172 172
         $string = $this->string;
173 173
 
174
-        if (0 > $offset) {
174
+        if ( 0 > $offset ) {
175 175
             // workaround https://bugs.php.net/74264
176
-            if (0 > $offset += grapheme_strlen($needle)) {
177
-                $string = grapheme_substr($string, 0, $offset);
176
+            if ( 0 > $offset += grapheme_strlen( $needle ) ) {
177
+                $string = grapheme_substr( $string, 0, $offset );
178 178
             }
179 179
             $offset = 0;
180 180
         }
181 181
 
182
-        $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset);
182
+        $i = $this->ignoreCase ? grapheme_strripos( $string, $needle, $offset ) : grapheme_strrpos( $string, $needle, $offset );
183 183
 
184 184
         return false === $i ? null : $i;
185 185
     }
186 186
 
187
-    public function join(array $strings, string $lastGlue = null): AbstractString
187
+    public function join( array $strings, string $lastGlue = null ): AbstractString
188 188
     {
189
-        $str = parent::join($strings, $lastGlue);
190
-        normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
189
+        $str = parent::join( $strings, $lastGlue );
190
+        normalizer_is_normalized( $str->string ) ?: $str->string = normalizer_normalize( $str->string );
191 191
 
192 192
         return $str;
193 193
     }
194 194
 
195 195
     public function length(): int
196 196
     {
197
-        return grapheme_strlen($this->string);
197
+        return grapheme_strlen( $this->string );
198 198
     }
199 199
 
200 200
     /**
201 201
      * @return static
202 202
      */
203
-    public function normalize(int $form = self::NFC): parent
203
+    public function normalize( int $form = self::NFC ): parent
204 204
     {
205 205
         $str = clone $this;
206 206
 
207
-        if (\in_array($form, [self::NFC, self::NFKC], true)) {
208
-            normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
209
-        } elseif (!\in_array($form, [self::NFD, self::NFKD], true)) {
210
-            throw new InvalidArgumentException('Unsupported normalization form.');
211
-        } elseif (!normalizer_is_normalized($str->string, $form)) {
212
-            $str->string = normalizer_normalize($str->string, $form);
207
+        if ( \in_array( $form, [ self::NFC, self::NFKC ], true ) ) {
208
+            normalizer_is_normalized( $str->string, $form ) ?: $str->string = normalizer_normalize( $str->string, $form );
209
+        } elseif ( ! \in_array( $form, [ self::NFD, self::NFKD ], true ) ) {
210
+            throw new InvalidArgumentException( 'Unsupported normalization form.' );
211
+        } elseif ( ! normalizer_is_normalized( $str->string, $form ) ) {
212
+            $str->string = normalizer_normalize( $str->string, $form );
213 213
             $str->ignoreCase = null;
214 214
         }
215 215
 
216 216
         return $str;
217 217
     }
218 218
 
219
-    public function prepend(string ...$prefix): AbstractString
219
+    public function prepend( string ...$prefix ): AbstractString
220 220
     {
221 221
         $str = clone $this;
222
-        $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
223
-        normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
222
+        $str->string = ( 1 >= \count( $prefix ) ? ( $prefix[ 0 ] ?? '' ) : implode( '', $prefix ) ) . $this->string;
223
+        normalizer_is_normalized( $str->string ) ?: $str->string = normalizer_normalize( $str->string );
224 224
 
225
-        if (false === $str->string) {
226
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
225
+        if ( false === $str->string ) {
226
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
227 227
         }
228 228
 
229 229
         return $str;
230 230
     }
231 231
 
232
-    public function replace(string $from, string $to): AbstractString
232
+    public function replace( string $from, string $to ): AbstractString
233 233
     {
234 234
         $str = clone $this;
235
-        normalizer_is_normalized($from) ?: $from = normalizer_normalize($from);
235
+        normalizer_is_normalized( $from ) ?: $from = normalizer_normalize( $from );
236 236
 
237
-        if ('' !== $from && false !== $from) {
237
+        if ( '' !== $from && false !== $from ) {
238 238
             $tail = $str->string;
239 239
             $result = '';
240 240
             $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
241 241
 
242
-            while ('' !== $tail && false !== $i = $indexOf($tail, $from)) {
243
-                $slice = grapheme_substr($tail, 0, $i);
244
-                $result .= $slice.$to;
245
-                $tail = substr($tail, \strlen($slice) + \strlen($from));
242
+            while ( '' !== $tail && false !== $i = $indexOf( $tail, $from ) ) {
243
+                $slice = grapheme_substr( $tail, 0, $i );
244
+                $result .= $slice . $to;
245
+                $tail = substr( $tail, \strlen( $slice ) + \strlen( $from ) );
246 246
             }
247 247
 
248
-            $str->string = $result.$tail;
249
-            normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
248
+            $str->string = $result . $tail;
249
+            normalizer_is_normalized( $str->string ) ?: $str->string = normalizer_normalize( $str->string );
250 250
 
251
-            if (false === $str->string) {
252
-                throw new InvalidArgumentException('Invalid UTF-8 string.');
251
+            if ( false === $str->string ) {
252
+                throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
253 253
             }
254 254
         }
255 255
 
256 256
         return $str;
257 257
     }
258 258
 
259
-    public function replaceMatches(string $fromRegexp, $to): AbstractString
259
+    public function replaceMatches( string $fromRegexp, $to ): AbstractString
260 260
     {
261
-        $str = parent::replaceMatches($fromRegexp, $to);
262
-        normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
261
+        $str = parent::replaceMatches( $fromRegexp, $to );
262
+        normalizer_is_normalized( $str->string ) ?: $str->string = normalizer_normalize( $str->string );
263 263
 
264 264
         return $str;
265 265
     }
266 266
 
267
-    public function slice(int $start = 0, int $length = null): AbstractString
267
+    public function slice( int $start = 0, int $length = null ): AbstractString
268 268
     {
269 269
         $str = clone $this;
270 270
 
271
-        if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
271
+        if ( \PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen( $this->string ) < -$start ) {
272 272
             $start = 0;
273 273
         }
274
-        $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647);
274
+        $str->string = (string)grapheme_substr( $this->string, $start, $length ?? 2147483647 );
275 275
 
276 276
         return $str;
277 277
     }
278 278
 
279
-    public function splice(string $replacement, int $start = 0, int $length = null): AbstractString
279
+    public function splice( string $replacement, int $start = 0, int $length = null ): AbstractString
280 280
     {
281 281
         $str = clone $this;
282 282
 
283
-        if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
283
+        if ( \PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen( $this->string ) < -$start ) {
284 284
             $start = 0;
285 285
         }
286
-        $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
287
-        $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
288
-        $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);
289
-        normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
286
+        $start = $start ? \strlen( grapheme_substr( $this->string, 0, $start ) ) : 0;
287
+        $length = $length ? \strlen( grapheme_substr( $this->string, $start, $length ?? 2147483647 ) ) : $length;
288
+        $str->string = substr_replace( $this->string, $replacement, $start, $length ?? 2147483647 );
289
+        normalizer_is_normalized( $str->string ) ?: $str->string = normalizer_normalize( $str->string );
290 290
 
291
-        if (false === $str->string) {
292
-            throw new InvalidArgumentException('Invalid UTF-8 string.');
291
+        if ( false === $str->string ) {
292
+            throw new InvalidArgumentException( 'Invalid UTF-8 string.' );
293 293
         }
294 294
 
295 295
         return $str;
296 296
     }
297 297
 
298
-    public function split(string $delimiter, int $limit = null, int $flags = null): array
298
+    public function split( string $delimiter, int $limit = null, int $flags = null ): array
299 299
     {
300
-        if (1 > $limit = $limit ?? 2147483647) {
301
-            throw new InvalidArgumentException('Split limit must be a positive integer.');
300
+        if ( 1 > $limit = $limit ?? 2147483647 ) {
301
+            throw new InvalidArgumentException( 'Split limit must be a positive integer.' );
302 302
         }
303 303
 
304
-        if ('' === $delimiter) {
305
-            throw new InvalidArgumentException('Split delimiter is empty.');
304
+        if ( '' === $delimiter ) {
305
+            throw new InvalidArgumentException( 'Split delimiter is empty.' );
306 306
         }
307 307
 
308
-        if (null !== $flags) {
309
-            return parent::split($delimiter.'u', $limit, $flags);
308
+        if ( null !== $flags ) {
309
+            return parent::split( $delimiter . 'u', $limit, $flags );
310 310
         }
311 311
 
312
-        normalizer_is_normalized($delimiter) ?: $delimiter = normalizer_normalize($delimiter);
312
+        normalizer_is_normalized( $delimiter ) ?: $delimiter = normalizer_normalize( $delimiter );
313 313
 
314
-        if (false === $delimiter) {
315
-            throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
314
+        if ( false === $delimiter ) {
315
+            throw new InvalidArgumentException( 'Split delimiter is not a valid UTF-8 string.' );
316 316
         }
317 317
 
318 318
         $str = clone $this;
319 319
         $tail = $this->string;
320
-        $chunks = [];
320
+        $chunks = [ ];
321 321
         $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
322 322
 
323
-        while (1 < $limit && false !== $i = $indexOf($tail, $delimiter)) {
324
-            $str->string = grapheme_substr($tail, 0, $i);
325
-            $chunks[] = clone $str;
326
-            $tail = substr($tail, \strlen($str->string) + \strlen($delimiter));
323
+        while ( 1 < $limit && false !== $i = $indexOf( $tail, $delimiter ) ) {
324
+            $str->string = grapheme_substr( $tail, 0, $i );
325
+            $chunks[ ] = clone $str;
326
+            $tail = substr( $tail, \strlen( $str->string ) + \strlen( $delimiter ) );
327 327
             --$limit;
328 328
         }
329 329
 
330 330
         $str->string = $tail;
331
-        $chunks[] = clone $str;
331
+        $chunks[ ] = clone $str;
332 332
 
333 333
         return $chunks;
334 334
     }
335 335
 
336
-    public function startsWith($prefix): bool
336
+    public function startsWith( $prefix ): bool
337 337
     {
338
-        if ($prefix instanceof AbstractString) {
338
+        if ( $prefix instanceof AbstractString ) {
339 339
             $prefix = $prefix->string;
340
-        } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
341
-            return parent::startsWith($prefix);
340
+        } elseif ( \is_array( $prefix ) || $prefix instanceof \Traversable ) {
341
+            return parent::startsWith( $prefix );
342 342
         } else {
343
-            $prefix = (string) $prefix;
343
+            $prefix = (string)$prefix;
344 344
         }
345 345
 
346 346
         $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
347
-        normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form);
347
+        normalizer_is_normalized( $prefix, $form ) ?: $prefix = normalizer_normalize( $prefix, $form );
348 348
 
349
-        if ('' === $prefix || false === $prefix) {
349
+        if ( '' === $prefix || false === $prefix ) {
350 350
             return false;
351 351
         }
352 352
 
353
-        if ($this->ignoreCase) {
354
-            return 0 === mb_stripos(grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES), $prefix, 0, 'UTF-8');
353
+        if ( $this->ignoreCase ) {
354
+            return 0 === mb_stripos( grapheme_extract( $this->string, \strlen( $prefix ), \GRAPHEME_EXTR_MAXBYTES ), $prefix, 0, 'UTF-8' );
355 355
         }
356 356
 
357
-        return $prefix === grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES);
357
+        return $prefix === grapheme_extract( $this->string, \strlen( $prefix ), \GRAPHEME_EXTR_MAXBYTES );
358 358
     }
359 359
 
360 360
     public function __wakeup()
361 361
     {
362
-        if (!\is_string($this->string)) {
363
-            throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
362
+        if ( ! \is_string( $this->string ) ) {
363
+            throw new \BadMethodCallException( 'Cannot unserialize ' . __CLASS__ );
364 364
         }
365 365
 
366
-        normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
366
+        normalizer_is_normalized( $this->string ) ?: $this->string = normalizer_normalize( $this->string );
367 367
     }
368 368
 
369 369
     public function __clone()
370 370
     {
371
-        if (null === $this->ignoreCase) {
372
-            normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
371
+        if ( null === $this->ignoreCase ) {
372
+            normalizer_is_normalized( $this->string ) ?: $this->string = normalizer_normalize( $this->string );
373 373
         }
374 374
 
375 375
         $this->ignoreCase = false;
Please login to merge, or discard this patch.
vendor/symfony/string/LazyString.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @return static
27 27
      */
28
-    public static function fromCallable($callback, ...$arguments): self
28
+    public static function fromCallable( $callback, ...$arguments ): self
29 29
     {
30
-        if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) {
31
-            throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, get_debug_type($callback)));
30
+        if ( ! \is_callable( $callback ) && ! ( \is_array( $callback ) && isset( $callback[ 0 ] ) && $callback[ 0 ] instanceof \Closure && 2 >= \count( $callback ) ) ) {
31
+            throw new \TypeError( sprintf( 'Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, get_debug_type( $callback ) ) );
32 32
         }
33 33
 
34 34
         $lazyString = new static();
35
-        $lazyString->value = static function () use (&$callback, &$arguments, &$value): string {
36
-            if (null !== $arguments) {
37
-                if (!\is_callable($callback)) {
38
-                    $callback[0] = $callback[0]();
39
-                    $callback[1] = $callback[1] ?? '__invoke';
35
+        $lazyString->value = static function() use ( &$callback, &$arguments, &$value ): string {
36
+            if ( null !== $arguments ) {
37
+                if ( ! \is_callable( $callback ) ) {
38
+                    $callback[ 0 ] = $callback[ 0 ]();
39
+                    $callback[ 1 ] = $callback[ 1 ] ?? '__invoke';
40 40
                 }
41
-                $value = $callback(...$arguments);
42
-                $callback = self::getPrettyName($callback);
41
+                $value = $callback( ...$arguments );
42
+                $callback = self::getPrettyName( $callback );
43 43
                 $arguments = null;
44 44
             }
45 45
 
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return static
56 56
      */
57
-    public static function fromStringable($value): self
57
+    public static function fromStringable( $value ): self
58 58
     {
59
-        if (!self::isStringable($value)) {
60
-            throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type($value)));
59
+        if ( ! self::isStringable( $value ) ) {
60
+            throw new \TypeError( sprintf( 'Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type( $value ) ) );
61 61
         }
62 62
 
63
-        if (\is_object($value)) {
64
-            return static::fromCallable([$value, '__toString']);
63
+        if ( \is_object( $value ) ) {
64
+            return static::fromCallable( [ $value, '__toString' ] );
65 65
         }
66 66
 
67 67
         $lazyString = new static();
68
-        $lazyString->value = (string) $value;
68
+        $lazyString->value = (string)$value;
69 69
 
70 70
         return $lazyString;
71 71
     }
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * Tells whether the provided value can be cast to string.
75 75
      */
76
-    final public static function isStringable($value): bool
76
+    final public static function isStringable( $value ): bool
77 77
     {
78
-        return \is_string($value) || $value instanceof self || (\is_object($value) ? method_exists($value, '__toString') : is_scalar($value));
78
+        return \is_string( $value ) || $value instanceof self || ( \is_object( $value ) ? method_exists( $value, '__toString' ) : is_scalar( $value ) );
79 79
     }
80 80
 
81 81
     /**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @throws \TypeError When the provided value is not stringable
87 87
      */
88
-    final public static function resolve($value): string
88
+    final public static function resolve( $value ): string
89 89
     {
90 90
         return $value;
91 91
     }
@@ -95,25 +95,25 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function __toString()
97 97
     {
98
-        if (\is_string($this->value)) {
98
+        if ( \is_string( $this->value ) ) {
99 99
             return $this->value;
100 100
         }
101 101
 
102 102
         try {
103
-            return $this->value = ($this->value)();
104
-        } catch (\Throwable $e) {
105
-            if (\TypeError::class === \get_class($e) && __FILE__ === $e->getFile()) {
106
-                $type = explode(', ', $e->getMessage());
107
-                $type = substr(array_pop($type), 0, -\strlen(' returned'));
108
-                $r = new \ReflectionFunction($this->value);
109
-                $callback = $r->getStaticVariables()['callback'];
110
-
111
-                $e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type));
103
+            return $this->value = ( $this->value )();
104
+        } catch ( \Throwable $e ) {
105
+            if ( \TypeError::class === \get_class( $e ) && __FILE__ === $e->getFile() ) {
106
+                $type = explode( ', ', $e->getMessage() );
107
+                $type = substr( array_pop( $type ), 0, -\strlen( ' returned' ) );
108
+                $r = new \ReflectionFunction( $this->value );
109
+                $callback = $r->getStaticVariables()[ 'callback' ];
110
+
111
+                $e = new \TypeError( sprintf( 'Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type ) );
112 112
             }
113 113
 
114
-            if (\PHP_VERSION_ID < 70400) {
114
+            if ( \PHP_VERSION_ID < 70400 ) {
115 115
                 // leverage the ErrorHandler component with graceful fallback when it's not available
116
-                return trigger_error($e, \E_USER_ERROR);
116
+                return trigger_error( $e, \E_USER_ERROR );
117 117
             }
118 118
 
119 119
             throw $e;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $this->__toString();
126 126
 
127
-        return ['value'];
127
+        return [ 'value' ];
128 128
     }
129 129
 
130 130
     public function jsonSerialize(): string
@@ -136,29 +136,29 @@  discard block
 block discarded – undo
136 136
     {
137 137
     }
138 138
 
139
-    private static function getPrettyName(callable $callback): string
139
+    private static function getPrettyName( callable $callback ): string
140 140
     {
141
-        if (\is_string($callback)) {
141
+        if ( \is_string( $callback ) ) {
142 142
             return $callback;
143 143
         }
144 144
 
145
-        if (\is_array($callback)) {
146
-            $class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0];
147
-            $method = $callback[1];
148
-        } elseif ($callback instanceof \Closure) {
149
-            $r = new \ReflectionFunction($callback);
145
+        if ( \is_array( $callback ) ) {
146
+            $class = \is_object( $callback[ 0 ] ) ? get_debug_type( $callback[ 0 ] ) : $callback[ 0 ];
147
+            $method = $callback[ 1 ];
148
+        } elseif ( $callback instanceof \Closure ) {
149
+            $r = new \ReflectionFunction( $callback );
150 150
 
151
-            if (false !== strpos($r->name, '{closure}') || !$class = $r->getClosureScopeClass()) {
151
+            if ( false !== strpos( $r->name, '{closure}' ) || ! $class = $r->getClosureScopeClass() ) {
152 152
                 return $r->name;
153 153
             }
154 154
 
155 155
             $class = $class->name;
156 156
             $method = $r->name;
157 157
         } else {
158
-            $class = get_debug_type($callback);
158
+            $class = get_debug_type( $callback );
159 159
             $method = '__invoke';
160 160
         }
161 161
 
162
-        return $class.'::'.$method;
162
+        return $class . '::' . $method;
163 163
     }
164 164
 }
Please login to merge, or discard this patch.
vendor/symfony/string/AbstractString.php 1 patch
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
     protected $string = '';
43 43
     protected $ignoreCase = false;
44 44
 
45
-    abstract public function __construct(string $string = '');
45
+    abstract public function __construct( string $string = '' );
46 46
 
47 47
     /**
48 48
      * Unwraps instances of AbstractString back to strings.
49 49
      *
50 50
      * @return string[]|array
51 51
      */
52
-    public static function unwrap(array $values): array
52
+    public static function unwrap( array $values ): array
53 53
     {
54
-        foreach ($values as $k => $v) {
55
-            if ($v instanceof self) {
56
-                $values[$k] = $v->__toString();
57
-            } elseif (\is_array($v) && $values[$k] !== $v = static::unwrap($v)) {
58
-                $values[$k] = $v;
54
+        foreach ( $values as $k => $v ) {
55
+            if ( $v instanceof self ) {
56
+                $values[ $k ] = $v->__toString();
57
+            } elseif ( \is_array( $v ) && $values[ $k ] !== $v = static::unwrap( $v ) ) {
58
+                $values[ $k ] = $v;
59 59
             }
60 60
         }
61 61
 
@@ -67,27 +67,27 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return static[]|array
69 69
      */
70
-    public static function wrap(array $values): array
70
+    public static function wrap( array $values ): array
71 71
     {
72 72
         $i = 0;
73 73
         $keys = null;
74 74
 
75
-        foreach ($values as $k => $v) {
76
-            if (\is_string($k) && '' !== $k && $k !== $j = (string) new static($k)) {
77
-                $keys = $keys ?? array_keys($values);
78
-                $keys[$i] = $j;
75
+        foreach ( $values as $k => $v ) {
76
+            if ( \is_string( $k ) && '' !== $k && $k !== $j = (string)new static( $k ) ) {
77
+                $keys = $keys ?? array_keys( $values );
78
+                $keys[ $i ] = $j;
79 79
             }
80 80
 
81
-            if (\is_string($v)) {
82
-                $values[$k] = new static($v);
83
-            } elseif (\is_array($v) && $values[$k] !== $v = static::wrap($v)) {
84
-                $values[$k] = $v;
81
+            if ( \is_string( $v ) ) {
82
+                $values[ $k ] = new static( $v );
83
+            } elseif ( \is_array( $v ) && $values[ $k ] !== $v = static::wrap( $v ) ) {
84
+                $values[ $k ] = $v;
85 85
             }
86 86
 
87 87
             ++$i;
88 88
         }
89 89
 
90
-        return null !== $keys ? array_combine($keys, $values) : $values;
90
+        return null !== $keys ? array_combine( $keys, $values ) : $values;
91 91
     }
92 92
 
93 93
     /**
@@ -95,30 +95,30 @@  discard block
 block discarded – undo
95 95
      *
96 96
      * @return static
97 97
      */
98
-    public function after($needle, bool $includeNeedle = false, int $offset = 0): self
98
+    public function after( $needle, bool $includeNeedle = false, int $offset = 0 ): self
99 99
     {
100 100
         $str = clone $this;
101 101
         $i = \PHP_INT_MAX;
102 102
 
103
-        foreach ((array) $needle as $n) {
104
-            $n = (string) $n;
105
-            $j = $this->indexOf($n, $offset);
103
+        foreach ( (array)$needle as $n ) {
104
+            $n = (string)$n;
105
+            $j = $this->indexOf( $n, $offset );
106 106
 
107
-            if (null !== $j && $j < $i) {
107
+            if ( null !== $j && $j < $i ) {
108 108
                 $i = $j;
109 109
                 $str->string = $n;
110 110
             }
111 111
         }
112 112
 
113
-        if (\PHP_INT_MAX === $i) {
113
+        if ( \PHP_INT_MAX === $i ) {
114 114
             return $str;
115 115
         }
116 116
 
117
-        if (!$includeNeedle) {
117
+        if ( ! $includeNeedle ) {
118 118
             $i += $str->length();
119 119
         }
120 120
 
121
-        return $this->slice($i);
121
+        return $this->slice( $i );
122 122
     }
123 123
 
124 124
     /**
@@ -126,66 +126,66 @@  discard block
 block discarded – undo
126 126
      *
127 127
      * @return static
128 128
      */
129
-    public function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self
129
+    public function afterLast( $needle, bool $includeNeedle = false, int $offset = 0 ): self
130 130
     {
131 131
         $str = clone $this;
132 132
         $i = null;
133 133
 
134
-        foreach ((array) $needle as $n) {
135
-            $n = (string) $n;
136
-            $j = $this->indexOfLast($n, $offset);
134
+        foreach ( (array)$needle as $n ) {
135
+            $n = (string)$n;
136
+            $j = $this->indexOfLast( $n, $offset );
137 137
 
138
-            if (null !== $j && $j >= $i) {
138
+            if ( null !== $j && $j >= $i ) {
139 139
                 $i = $offset = $j;
140 140
                 $str->string = $n;
141 141
             }
142 142
         }
143 143
 
144
-        if (null === $i) {
144
+        if ( null === $i ) {
145 145
             return $str;
146 146
         }
147 147
 
148
-        if (!$includeNeedle) {
148
+        if ( ! $includeNeedle ) {
149 149
             $i += $str->length();
150 150
         }
151 151
 
152
-        return $this->slice($i);
152
+        return $this->slice( $i );
153 153
     }
154 154
 
155 155
     /**
156 156
      * @return static
157 157
      */
158
-    abstract public function append(string ...$suffix): self;
158
+    abstract public function append( string ...$suffix ): self;
159 159
 
160 160
     /**
161 161
      * @param string|string[] $needle
162 162
      *
163 163
      * @return static
164 164
      */
165
-    public function before($needle, bool $includeNeedle = false, int $offset = 0): self
165
+    public function before( $needle, bool $includeNeedle = false, int $offset = 0 ): self
166 166
     {
167 167
         $str = clone $this;
168 168
         $i = \PHP_INT_MAX;
169 169
 
170
-        foreach ((array) $needle as $n) {
171
-            $n = (string) $n;
172
-            $j = $this->indexOf($n, $offset);
170
+        foreach ( (array)$needle as $n ) {
171
+            $n = (string)$n;
172
+            $j = $this->indexOf( $n, $offset );
173 173
 
174
-            if (null !== $j && $j < $i) {
174
+            if ( null !== $j && $j < $i ) {
175 175
                 $i = $j;
176 176
                 $str->string = $n;
177 177
             }
178 178
         }
179 179
 
180
-        if (\PHP_INT_MAX === $i) {
180
+        if ( \PHP_INT_MAX === $i ) {
181 181
             return $str;
182 182
         }
183 183
 
184
-        if ($includeNeedle) {
184
+        if ( $includeNeedle ) {
185 185
             $i += $str->length();
186 186
         }
187 187
 
188
-        return $this->slice(0, $i);
188
+        return $this->slice( 0, $i );
189 189
     }
190 190
 
191 191
     /**
@@ -193,40 +193,40 @@  discard block
 block discarded – undo
193 193
      *
194 194
      * @return static
195 195
      */
196
-    public function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self
196
+    public function beforeLast( $needle, bool $includeNeedle = false, int $offset = 0 ): self
197 197
     {
198 198
         $str = clone $this;
199 199
         $i = null;
200 200
 
201
-        foreach ((array) $needle as $n) {
202
-            $n = (string) $n;
203
-            $j = $this->indexOfLast($n, $offset);
201
+        foreach ( (array)$needle as $n ) {
202
+            $n = (string)$n;
203
+            $j = $this->indexOfLast( $n, $offset );
204 204
 
205
-            if (null !== $j && $j >= $i) {
205
+            if ( null !== $j && $j >= $i ) {
206 206
                 $i = $offset = $j;
207 207
                 $str->string = $n;
208 208
             }
209 209
         }
210 210
 
211
-        if (null === $i) {
211
+        if ( null === $i ) {
212 212
             return $str;
213 213
         }
214 214
 
215
-        if ($includeNeedle) {
215
+        if ( $includeNeedle ) {
216 216
             $i += $str->length();
217 217
         }
218 218
 
219
-        return $this->slice(0, $i);
219
+        return $this->slice( 0, $i );
220 220
     }
221 221
 
222 222
     /**
223 223
      * @return int[]
224 224
      */
225
-    public function bytesAt(int $offset): array
225
+    public function bytesAt( int $offset ): array
226 226
     {
227
-        $str = $this->slice($offset, 1);
227
+        $str = $this->slice( $offset, 1 );
228 228
 
229
-        return '' === $str->string ? [] : array_values(unpack('C*', $str->string));
229
+        return '' === $str->string ? [ ] : array_values( unpack( 'C*', $str->string ) );
230 230
     }
231 231
 
232 232
     /**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     /**
238 238
      * @return static[]
239 239
      */
240
-    abstract public function chunk(int $length = 1): array;
240
+    abstract public function chunk( int $length = 1 ): array;
241 241
 
242 242
     /**
243 243
      * @return static
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     public function collapseWhitespace(): self
246 246
     {
247 247
         $str = clone $this;
248
-        $str->string = trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $str->string));
248
+        $str->string = trim( preg_replace( '/(?:\s{2,}+|[^\S ])/', ' ', $str->string ) );
249 249
 
250 250
         return $str;
251 251
     }
@@ -253,22 +253,22 @@  discard block
 block discarded – undo
253 253
     /**
254 254
      * @param string|string[] $needle
255 255
      */
256
-    public function containsAny($needle): bool
256
+    public function containsAny( $needle ): bool
257 257
     {
258
-        return null !== $this->indexOf($needle);
258
+        return null !== $this->indexOf( $needle );
259 259
     }
260 260
 
261 261
     /**
262 262
      * @param string|string[] $suffix
263 263
      */
264
-    public function endsWith($suffix): bool
264
+    public function endsWith( $suffix ): bool
265 265
     {
266
-        if (!\is_array($suffix) && !$suffix instanceof \Traversable) {
267
-            throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
266
+        if ( ! \is_array( $suffix ) && ! $suffix instanceof \Traversable ) {
267
+            throw new \TypeError( sprintf( 'Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class ) );
268 268
         }
269 269
 
270
-        foreach ($suffix as $s) {
271
-            if ($this->endsWith((string) $s)) {
270
+        foreach ( $suffix as $s ) {
271
+            if ( $this->endsWith( (string)$s ) ) {
272 272
                 return true;
273 273
             }
274 274
         }
@@ -279,34 +279,34 @@  discard block
 block discarded – undo
279 279
     /**
280 280
      * @return static
281 281
      */
282
-    public function ensureEnd(string $suffix): self
282
+    public function ensureEnd( string $suffix ): self
283 283
     {
284
-        if (!$this->endsWith($suffix)) {
285
-            return $this->append($suffix);
284
+        if ( ! $this->endsWith( $suffix ) ) {
285
+            return $this->append( $suffix );
286 286
         }
287 287
 
288
-        $suffix = preg_quote($suffix);
289
-        $regex = '{('.$suffix.')(?:'.$suffix.')++$}D';
288
+        $suffix = preg_quote( $suffix );
289
+        $regex = '{(' . $suffix . ')(?:' . $suffix . ')++$}D';
290 290
 
291
-        return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1');
291
+        return $this->replaceMatches( $regex . ( $this->ignoreCase ? 'i' : '' ), '$1' );
292 292
     }
293 293
 
294 294
     /**
295 295
      * @return static
296 296
      */
297
-    public function ensureStart(string $prefix): self
297
+    public function ensureStart( string $prefix ): self
298 298
     {
299
-        $prefix = new static($prefix);
299
+        $prefix = new static( $prefix );
300 300
 
301
-        if (!$this->startsWith($prefix)) {
302
-            return $this->prepend($prefix);
301
+        if ( ! $this->startsWith( $prefix ) ) {
302
+            return $this->prepend( $prefix );
303 303
         }
304 304
 
305 305
         $str = clone $this;
306 306
         $i = $prefixLen = $prefix->length();
307 307
 
308
-        while ($this->indexOf($prefix, $i) === $i) {
309
-            $str = $str->slice($prefixLen);
308
+        while ( $this->indexOf( $prefix, $i ) === $i ) {
309
+            $str = $str->slice( $prefixLen );
310 310
             $i += $prefixLen;
311 311
         }
312 312
 
@@ -316,14 +316,14 @@  discard block
 block discarded – undo
316 316
     /**
317 317
      * @param string|string[] $string
318 318
      */
319
-    public function equalsTo($string): bool
319
+    public function equalsTo( $string ): bool
320 320
     {
321
-        if (!\is_array($string) && !$string instanceof \Traversable) {
322
-            throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
321
+        if ( ! \is_array( $string ) && ! $string instanceof \Traversable ) {
322
+            throw new \TypeError( sprintf( 'Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class ) );
323 323
         }
324 324
 
325
-        foreach ($string as $s) {
326
-            if ($this->equalsTo((string) $s)) {
325
+        foreach ( $string as $s ) {
326
+            if ( $this->equalsTo( (string)$s ) ) {
327 327
                 return true;
328 328
             }
329 329
         }
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
     /**
351 351
      * @param string|string[] $needle
352 352
      */
353
-    public function indexOf($needle, int $offset = 0): ?int
353
+    public function indexOf( $needle, int $offset = 0 ): ?int
354 354
     {
355
-        if (!\is_array($needle) && !$needle instanceof \Traversable) {
356
-            throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
355
+        if ( ! \is_array( $needle ) && ! $needle instanceof \Traversable ) {
356
+            throw new \TypeError( sprintf( 'Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class ) );
357 357
         }
358 358
 
359 359
         $i = \PHP_INT_MAX;
360 360
 
361
-        foreach ($needle as $n) {
362
-            $j = $this->indexOf((string) $n, $offset);
361
+        foreach ( $needle as $n ) {
362
+            $j = $this->indexOf( (string)$n, $offset );
363 363
 
364
-            if (null !== $j && $j < $i) {
364
+            if ( null !== $j && $j < $i ) {
365 365
                 $i = $j;
366 366
             }
367 367
         }
@@ -372,18 +372,18 @@  discard block
 block discarded – undo
372 372
     /**
373 373
      * @param string|string[] $needle
374 374
      */
375
-    public function indexOfLast($needle, int $offset = 0): ?int
375
+    public function indexOfLast( $needle, int $offset = 0 ): ?int
376 376
     {
377
-        if (!\is_array($needle) && !$needle instanceof \Traversable) {
378
-            throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
377
+        if ( ! \is_array( $needle ) && ! $needle instanceof \Traversable ) {
378
+            throw new \TypeError( sprintf( 'Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class ) );
379 379
         }
380 380
 
381 381
         $i = null;
382 382
 
383
-        foreach ($needle as $n) {
384
-            $j = $this->indexOfLast((string) $n, $offset);
383
+        foreach ( $needle as $n ) {
384
+            $j = $this->indexOfLast( (string)$n, $offset );
385 385
 
386
-            if (null !== $j && $j >= $i) {
386
+            if ( null !== $j && $j >= $i ) {
387 387
                 $i = $offset = $j;
388 388
             }
389 389
         }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     /**
400 400
      * @return static
401 401
      */
402
-    abstract public function join(array $strings, string $lastGlue = null): self;
402
+    abstract public function join( array $strings, string $lastGlue = null ): self;
403 403
 
404 404
     public function jsonSerialize(): string
405 405
     {
@@ -420,39 +420,39 @@  discard block
 block discarded – undo
420 420
      *
421 421
      * @return array All matches in a multi-dimensional array ordered according to flags
422 422
      */
423
-    abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array;
423
+    abstract public function match( string $regexp, int $flags = 0, int $offset = 0 ): array;
424 424
 
425 425
     /**
426 426
      * @return static
427 427
      */
428
-    abstract public function padBoth(int $length, string $padStr = ' '): self;
428
+    abstract public function padBoth( int $length, string $padStr = ' ' ): self;
429 429
 
430 430
     /**
431 431
      * @return static
432 432
      */
433
-    abstract public function padEnd(int $length, string $padStr = ' '): self;
433
+    abstract public function padEnd( int $length, string $padStr = ' ' ): self;
434 434
 
435 435
     /**
436 436
      * @return static
437 437
      */
438
-    abstract public function padStart(int $length, string $padStr = ' '): self;
438
+    abstract public function padStart( int $length, string $padStr = ' ' ): self;
439 439
 
440 440
     /**
441 441
      * @return static
442 442
      */
443
-    abstract public function prepend(string ...$prefix): self;
443
+    abstract public function prepend( string ...$prefix ): self;
444 444
 
445 445
     /**
446 446
      * @return static
447 447
      */
448
-    public function repeat(int $multiplier): self
448
+    public function repeat( int $multiplier ): self
449 449
     {
450
-        if (0 > $multiplier) {
451
-            throw new InvalidArgumentException(sprintf('Multiplier must be positive, %d given.', $multiplier));
450
+        if ( 0 > $multiplier ) {
451
+            throw new InvalidArgumentException( sprintf( 'Multiplier must be positive, %d given.', $multiplier ) );
452 452
         }
453 453
 
454 454
         $str = clone $this;
455
-        $str->string = str_repeat($str->string, $multiplier);
455
+        $str->string = str_repeat( $str->string, $multiplier );
456 456
 
457 457
         return $str;
458 458
     }
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
     /**
461 461
      * @return static
462 462
      */
463
-    abstract public function replace(string $from, string $to): self;
463
+    abstract public function replace( string $from, string $to ): self;
464 464
 
465 465
     /**
466 466
      * @param string|callable $to
467 467
      *
468 468
      * @return static
469 469
      */
470
-    abstract public function replaceMatches(string $fromRegexp, $to): self;
470
+    abstract public function replaceMatches( string $fromRegexp, $to ): self;
471 471
 
472 472
     /**
473 473
      * @return static
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     /**
478 478
      * @return static
479 479
      */
480
-    abstract public function slice(int $start = 0, int $length = null): self;
480
+    abstract public function slice( int $start = 0, int $length = null ): self;
481 481
 
482 482
     /**
483 483
      * @return static
@@ -487,34 +487,34 @@  discard block
 block discarded – undo
487 487
     /**
488 488
      * @return static
489 489
      */
490
-    abstract public function splice(string $replacement, int $start = 0, int $length = null): self;
490
+    abstract public function splice( string $replacement, int $start = 0, int $length = null ): self;
491 491
 
492 492
     /**
493 493
      * @return static[]
494 494
      */
495
-    public function split(string $delimiter, int $limit = null, int $flags = null): array
495
+    public function split( string $delimiter, int $limit = null, int $flags = null ): array
496 496
     {
497
-        if (null === $flags) {
498
-            throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.');
497
+        if ( null === $flags ) {
498
+            throw new \TypeError( 'Split behavior when $flags is null must be implemented by child classes.' );
499 499
         }
500 500
 
501
-        if ($this->ignoreCase) {
501
+        if ( $this->ignoreCase ) {
502 502
             $delimiter .= 'i';
503 503
         }
504 504
 
505
-        set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
505
+        set_error_handler( static function( $t, $m ) { throw new InvalidArgumentException( $m ); });
506 506
 
507 507
         try {
508
-            if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) {
508
+            if ( false === $chunks = preg_split( $delimiter, $this->string, $limit, $flags ) ) {
509 509
                 $lastError = preg_last_error();
510 510
 
511
-                foreach (get_defined_constants(true)['pcre'] as $k => $v) {
512
-                    if ($lastError === $v && '_ERROR' === substr($k, -6)) {
513
-                        throw new RuntimeException('Splitting failed with '.$k.'.');
511
+                foreach ( get_defined_constants( true )[ 'pcre' ] as $k => $v ) {
512
+                    if ( $lastError === $v && '_ERROR' === substr( $k, -6 ) ) {
513
+                        throw new RuntimeException( 'Splitting failed with ' . $k . '.' );
514 514
                     }
515 515
                 }
516 516
 
517
-                throw new RuntimeException('Splitting failed with unknown error code.');
517
+                throw new RuntimeException( 'Splitting failed with unknown error code.' );
518 518
             }
519 519
         } finally {
520 520
             restore_error_handler();
@@ -522,13 +522,13 @@  discard block
 block discarded – undo
522 522
 
523 523
         $str = clone $this;
524 524
 
525
-        if (self::PREG_SPLIT_OFFSET_CAPTURE & $flags) {
526
-            foreach ($chunks as &$chunk) {
527
-                $str->string = $chunk[0];
528
-                $chunk[0] = clone $str;
525
+        if ( self::PREG_SPLIT_OFFSET_CAPTURE & $flags ) {
526
+            foreach ( $chunks as &$chunk ) {
527
+                $str->string = $chunk[ 0 ];
528
+                $chunk[ 0 ] = clone $str;
529 529
             }
530 530
         } else {
531
-            foreach ($chunks as &$chunk) {
531
+            foreach ( $chunks as &$chunk ) {
532 532
                 $str->string = $chunk;
533 533
                 $chunk = clone $str;
534 534
             }
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
     /**
541 541
      * @param string|string[] $prefix
542 542
      */
543
-    public function startsWith($prefix): bool
543
+    public function startsWith( $prefix ): bool
544 544
     {
545
-        if (!\is_array($prefix) && !$prefix instanceof \Traversable) {
546
-            throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
545
+        if ( ! \is_array( $prefix ) && ! $prefix instanceof \Traversable ) {
546
+            throw new \TypeError( sprintf( 'Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class ) );
547 547
         }
548 548
 
549
-        foreach ($prefix as $prefix) {
550
-            if ($this->startsWith((string) $prefix)) {
549
+        foreach ( $prefix as $prefix ) {
550
+            if ( $this->startsWith( (string)$prefix ) ) {
551 551
                 return true;
552 552
             }
553 553
         }
@@ -558,31 +558,31 @@  discard block
 block discarded – undo
558 558
     /**
559 559
      * @return static
560 560
      */
561
-    abstract public function title(bool $allWords = false): self;
561
+    abstract public function title( bool $allWords = false ): self;
562 562
 
563
-    public function toByteString(string $toEncoding = null): ByteString
563
+    public function toByteString( string $toEncoding = null ): ByteString
564 564
     {
565 565
         $b = new ByteString();
566 566
 
567
-        $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], true) ? 'UTF-8' : $toEncoding;
567
+        $toEncoding = \in_array( $toEncoding, [ 'utf8', 'utf-8', 'UTF8' ], true ) ? 'UTF-8' : $toEncoding;
568 568
 
569
-        if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') {
569
+        if ( null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match( '//u', $b->string ) ? 'UTF-8' : 'Windows-1252' ) {
570 570
             $b->string = $this->string;
571 571
 
572 572
             return $b;
573 573
         }
574 574
 
575
-        set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
575
+        set_error_handler( static function( $t, $m ) { throw new InvalidArgumentException( $m ); });
576 576
 
577 577
         try {
578 578
             try {
579
-                $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8');
580
-            } catch (InvalidArgumentException $e) {
581
-                if (!\function_exists('iconv')) {
579
+                $b->string = mb_convert_encoding( $this->string, $toEncoding, 'UTF-8' );
580
+            } catch ( InvalidArgumentException $e ) {
581
+                if ( ! \function_exists( 'iconv' ) ) {
582 582
                     throw $e;
583 583
                 }
584 584
 
585
-                $b->string = iconv('UTF-8', $toEncoding, $this->string);
585
+                $b->string = iconv( 'UTF-8', $toEncoding, $this->string );
586 586
             }
587 587
         } finally {
588 588
             restore_error_handler();
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 
594 594
     public function toCodePointString(): CodePointString
595 595
     {
596
-        return new CodePointString($this->string);
596
+        return new CodePointString( $this->string );
597 597
     }
598 598
 
599 599
     public function toString(): string
@@ -603,52 +603,52 @@  discard block
 block discarded – undo
603 603
 
604 604
     public function toUnicodeString(): UnicodeString
605 605
     {
606
-        return new UnicodeString($this->string);
606
+        return new UnicodeString( $this->string );
607 607
     }
608 608
 
609 609
     /**
610 610
      * @return static
611 611
      */
612
-    abstract public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
612
+    abstract public function trim( string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" ): self;
613 613
 
614 614
     /**
615 615
      * @return static
616 616
      */
617
-    abstract public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
617
+    abstract public function trimEnd( string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" ): self;
618 618
 
619 619
     /**
620 620
      * @return static
621 621
      */
622
-    abstract public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
622
+    abstract public function trimStart( string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" ): self;
623 623
 
624 624
     /**
625 625
      * @return static
626 626
      */
627
-    public function truncate(int $length, string $ellipsis = '', bool $cut = true): self
627
+    public function truncate( int $length, string $ellipsis = '', bool $cut = true ): self
628 628
     {
629 629
         $stringLength = $this->length();
630 630
 
631
-        if ($stringLength <= $length) {
631
+        if ( $stringLength <= $length ) {
632 632
             return clone $this;
633 633
         }
634 634
 
635
-        $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0;
635
+        $ellipsisLength = '' !== $ellipsis ? ( new static( $ellipsis ) )->length() : 0;
636 636
 
637
-        if ($length < $ellipsisLength) {
637
+        if ( $length < $ellipsisLength ) {
638 638
             $ellipsisLength = 0;
639 639
         }
640 640
 
641
-        if (!$cut) {
642
-            if (null === $length = $this->indexOf([' ', "\r", "\n", "\t"], ($length ?: 1) - 1)) {
641
+        if ( ! $cut ) {
642
+            if ( null === $length = $this->indexOf( [ ' ', "\r", "\n", "\t" ], ( $length ?: 1 ) - 1 ) ) {
643 643
                 return clone $this;
644 644
             }
645 645
 
646 646
             $length += $ellipsisLength;
647 647
         }
648 648
 
649
-        $str = $this->slice(0, $length - $ellipsisLength);
649
+        $str = $this->slice( 0, $length - $ellipsisLength );
650 650
 
651
-        return $ellipsisLength ? $str->trimEnd()->append($ellipsis) : $str;
651
+        return $ellipsisLength ? $str->trimEnd()->append( $ellipsis ) : $str;
652 652
     }
653 653
 
654 654
     /**
@@ -659,29 +659,29 @@  discard block
 block discarded – undo
659 659
     /**
660 660
      * Returns the printable length on a terminal.
661 661
      */
662
-    abstract public function width(bool $ignoreAnsiDecoration = true): int;
662
+    abstract public function width( bool $ignoreAnsiDecoration = true ): int;
663 663
 
664 664
     /**
665 665
      * @return static
666 666
      */
667
-    public function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self
667
+    public function wordwrap( int $width = 75, string $break = "\n", bool $cut = false ): self
668 668
     {
669
-        $lines = '' !== $break ? $this->split($break) : [clone $this];
670
-        $chars = [];
669
+        $lines = '' !== $break ? $this->split( $break ) : [ clone $this ];
670
+        $chars = [ ];
671 671
         $mask = '';
672 672
 
673
-        if (1 === \count($lines) && '' === $lines[0]->string) {
674
-            return $lines[0];
673
+        if ( 1 === \count( $lines ) && '' === $lines[ 0 ]->string ) {
674
+            return $lines[ 0 ];
675 675
         }
676 676
 
677
-        foreach ($lines as $i => $line) {
678
-            if ($i) {
679
-                $chars[] = $break;
677
+        foreach ( $lines as $i => $line ) {
678
+            if ( $i ) {
679
+                $chars[ ] = $break;
680 680
                 $mask .= '#';
681 681
             }
682 682
 
683
-            foreach ($line->chunk() as $char) {
684
-                $chars[] = $char->string;
683
+            foreach ( $line->chunk() as $char ) {
684
+                $chars[ ] = $char->string;
685 685
                 $mask .= ' ' === $char->string ? ' ' : '?';
686 686
             }
687 687
         }
@@ -689,30 +689,30 @@  discard block
 block discarded – undo
689 689
         $string = '';
690 690
         $j = 0;
691 691
         $b = $i = -1;
692
-        $mask = wordwrap($mask, $width, '#', $cut);
692
+        $mask = wordwrap( $mask, $width, '#', $cut );
693 693
 
694
-        while (false !== $b = strpos($mask, '#', $b + 1)) {
694
+        while ( false !== $b = strpos( $mask, '#', $b + 1 ) ) {
695 695
             for (++$i; $i < $b; ++$i) {
696
-                $string .= $chars[$j];
697
-                unset($chars[$j++]);
696
+                $string .= $chars[ $j ];
697
+                unset( $chars[ $j++ ] );
698 698
             }
699 699
 
700
-            if ($break === $chars[$j] || ' ' === $chars[$j]) {
701
-                unset($chars[$j++]);
700
+            if ( $break === $chars[ $j ] || ' ' === $chars[ $j ] ) {
701
+                unset( $chars[ $j++ ] );
702 702
             }
703 703
 
704 704
             $string .= $break;
705 705
         }
706 706
 
707 707
         $str = clone $this;
708
-        $str->string = $string.implode('', $chars);
708
+        $str->string = $string . implode( '', $chars );
709 709
 
710 710
         return $str;
711 711
     }
712 712
 
713 713
     public function __sleep(): array
714 714
     {
715
-        return ['string'];
715
+        return [ 'string' ];
716 716
     }
717 717
 
718 718
     public function __clone()
Please login to merge, or discard this patch.
vendor/symfony/string/Resources/functions.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
 
12 12
 namespace Symfony\Component\String;
13 13
 
14
-if (!\function_exists(u::class)) {
15
-    function u(?string $string = ''): UnicodeString
14
+if ( ! \function_exists( u::class ) ) {
15
+    function u( ?string $string = '' ): UnicodeString
16 16
     {
17
-        return new UnicodeString($string ?? '');
17
+        return new UnicodeString( $string ?? '' );
18 18
     }
19 19
 }
20 20
 
21
-if (!\function_exists(b::class)) {
22
-    function b(?string $string = ''): ByteString
21
+if ( ! \function_exists( b::class ) ) {
22
+    function b( ?string $string = '' ): ByteString
23 23
     {
24
-        return new ByteString($string ?? '');
24
+        return new ByteString( $string ?? '' );
25 25
     }
26 26
 }
27 27
 
28
-if (!\function_exists(s::class)) {
28
+if ( ! \function_exists( s::class ) ) {
29 29
     /**
30 30
      * @return UnicodeString|ByteString
31 31
      */
32
-    function s(?string $string = ''): AbstractString
32
+    function s( ?string $string = '' ): AbstractString
33 33
     {
34 34
         $string = $string ?? '';
35 35
 
36
-        return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string);
36
+        return preg_match( '//u', $string ) ? new UnicodeString( $string ) : new ByteString( $string );
37 37
     }
38 38
 }
Please login to merge, or discard this patch.