@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | if ($php = getenv('PHP_BINARY')) { |
| 37 | 37 | if (!is_executable($php)) { |
| 38 | 38 | $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v'; |
| 39 | - if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) { |
|
| 39 | + if ($php = strtok(exec($command . ' ' . escapeshellarg($php)), \PHP_EOL)) { |
|
| 40 | 40 | if (!is_executable($php)) { |
| 41 | 41 | return false; |
| 42 | 42 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $args = $this->findArguments(); |
| 52 | - $args = $includeArgs && $args ? ' '.implode(' ', $args) : ''; |
|
| 52 | + $args = $includeArgs && $args ? ' ' . implode(' ', $args) : ''; |
|
| 53 | 53 | |
| 54 | 54 | // PHP_BINARY return the current sapi executable |
| 55 | 55 | if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cgi-fcgi', 'cli', 'cli-server', 'phpdbg'], true)) { |
| 56 | - return \PHP_BINARY.$args; |
|
| 56 | + return \PHP_BINARY . $args; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | if ($php = getenv('PHP_PATH')) { |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { |
|
| 73 | + if (@is_executable($php = \PHP_BINDIR . ('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { |
|
| 74 | 74 | return $php; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | public const TIMEOUT_PRECISION = 0.2; |
| 48 | 48 | |
| 49 | 49 | public const ITER_NON_BLOCKING = 1; // By default, iterating over outputs is a blocking call, use this flag to make it non-blocking |
| 50 | - public const ITER_KEEP_OUTPUT = 2; // By default, outputs are cleared while iterating, use this flag to keep them in memory |
|
| 51 | - public const ITER_SKIP_OUT = 4; // Use this flag to skip STDOUT while iterating |
|
| 52 | - public const ITER_SKIP_ERR = 8; // Use this flag to skip STDERR while iterating |
|
| 50 | + public const ITER_KEEP_OUTPUT = 2; // By default, outputs are cleared while iterating, use this flag to keep them in memory |
|
| 51 | + public const ITER_SKIP_OUT = 4; // Use this flag to skip STDOUT while iterating |
|
| 52 | + public const ITER_SKIP_ERR = 8; // Use this flag to skip STDERR while iterating |
|
| 53 | 53 | |
| 54 | 54 | private $callback; |
| 55 | 55 | private $hasCallback = false; |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function __sleep() |
| 204 | 204 | { |
| 205 | - throw new \BadMethodCallException('Cannot serialize '.__CLASS__); |
|
| 205 | + throw new \BadMethodCallException('Cannot serialize ' . __CLASS__); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | public function __wakeup() |
| 209 | 209 | { |
| 210 | - throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); |
|
| 210 | + throw new \BadMethodCallException('Cannot unserialize ' . __CLASS__); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | public function __destruct() |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | if ('\\' !== \DIRECTORY_SEPARATOR) { |
| 319 | 319 | // exec is mandatory to deal with sending a signal to the process |
| 320 | - $commandline = 'exec '.$commandline; |
|
| 320 | + $commandline = 'exec ' . $commandline; |
|
| 321 | 321 | } |
| 322 | 322 | } else { |
| 323 | 323 | $commandline = $this->replacePlaceholders($commandline, $env); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $descriptors[3] = ['pipe', 'w']; |
| 331 | 331 | |
| 332 | 332 | // See https://unix.stackexchange.com/questions/71205/background-process-pipe-input |
| 333 | - $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;'; |
|
| 333 | + $commandline = '{ (' . $commandline . ') <&3 3<&- 3>/dev/null & } 3<&0;'; |
|
| 334 | 334 | $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code'; |
| 335 | 335 | |
| 336 | 336 | // Workaround for the bug, when PTS functionality is enabled. |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $envPairs = []; |
| 342 | 342 | foreach ($env as $k => $v) { |
| 343 | 343 | if (false !== $v && false === \in_array($k, ['argc', 'argv', 'ARGC', 'ARGV'], true)) { |
| 344 | - $envPairs[] = $k.'='.$v; |
|
| 344 | + $envPairs[] = $k . '=' . $v; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
@@ -1313,14 +1313,14 @@ discard block |
||
| 1313 | 1313 | protected function buildCallback(callable $callback = null) |
| 1314 | 1314 | { |
| 1315 | 1315 | if ($this->outputDisabled) { |
| 1316 | - return function ($type, $data) use ($callback): bool { |
|
| 1316 | + return function($type, $data) use ($callback): bool { |
|
| 1317 | 1317 | return null !== $callback && $callback($type, $data); |
| 1318 | 1318 | }; |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | $out = self::OUT; |
| 1322 | 1322 | |
| 1323 | - return function ($type, $data) use ($callback, $out): bool { |
|
| 1323 | + return function($type, $data) use ($callback, $out): bool { |
|
| 1324 | 1324 | if ($out == $type) { |
| 1325 | 1325 | $this->addOutput($data); |
| 1326 | 1326 | } else { |
@@ -1476,8 +1476,8 @@ discard block |
||
| 1476 | 1476 | $this->exitcode = null; |
| 1477 | 1477 | $this->fallbackStatus = []; |
| 1478 | 1478 | $this->processInformation = null; |
| 1479 | - $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+'); |
|
| 1480 | - $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+'); |
|
| 1479 | + $this->stdout = fopen('php://temp/maxmemory:' . (1024 * 1024), 'w+'); |
|
| 1480 | + $this->stderr = fopen('php://temp/maxmemory:' . (1024 * 1024), 'w+'); |
|
| 1481 | 1481 | $this->process = null; |
| 1482 | 1482 | $this->latestSignal = null; |
| 1483 | 1483 | $this->status = self::STATUS_READY; |
@@ -1552,7 +1552,7 @@ discard block |
||
| 1552 | 1552 | [^"%!^]*+ |
| 1553 | 1553 | )++ |
| 1554 | 1554 | ) | [^"]*+ )"/x', |
| 1555 | - function ($m) use (&$env, &$varCache, &$varCount, $uid) { |
|
| 1555 | + function($m) use (&$env, &$varCache, &$varCount, $uid) { |
|
| 1556 | 1556 | if (!isset($m[1])) { |
| 1557 | 1557 | return $m[0]; |
| 1558 | 1558 | } |
@@ -1563,23 +1563,23 @@ discard block |
||
| 1563 | 1563 | $value = str_replace("\0", '?', $value); |
| 1564 | 1564 | } |
| 1565 | 1565 | if (false === strpbrk($value, "\"%!\n")) { |
| 1566 | - return '"'.$value.'"'; |
|
| 1566 | + return '"' . $value . '"'; |
|
| 1567 | 1567 | } |
| 1568 | 1568 | |
| 1569 | 1569 | $value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value); |
| 1570 | - $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"'; |
|
| 1571 | - $var = $uid.++$varCount; |
|
| 1570 | + $value = '"' . preg_replace('/(\\\\*)"/', '$1$1\\"', $value) . '"'; |
|
| 1571 | + $var = $uid . ++$varCount; |
|
| 1572 | 1572 | |
| 1573 | 1573 | $env[$var] = $value; |
| 1574 | 1574 | |
| 1575 | - return $varCache[$m[0]] = '!'.$var.'!'; |
|
| 1575 | + return $varCache[$m[0]] = '!' . $var . '!'; |
|
| 1576 | 1576 | }, |
| 1577 | 1577 | $cmd |
| 1578 | 1578 | ); |
| 1579 | 1579 | |
| 1580 | - $cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')'; |
|
| 1580 | + $cmd = 'cmd /V:ON /E:ON /D /C (' . str_replace("\n", ' ', $cmd) . ')'; |
|
| 1581 | 1581 | foreach ($this->processPipes->getFiles() as $offset => $filename) { |
| 1582 | - $cmd .= ' '.$offset.'>"'.$filename.'"'; |
|
| 1582 | + $cmd .= ' ' . $offset . '>"' . $filename . '"'; |
|
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | return $cmd; |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | return '""'; |
| 1619 | 1619 | } |
| 1620 | 1620 | if ('\\' !== \DIRECTORY_SEPARATOR) { |
| 1621 | - return "'".str_replace("'", "'\\''", $argument)."'"; |
|
| 1621 | + return "'" . str_replace("'", "'\\''", $argument) . "'"; |
|
| 1622 | 1622 | } |
| 1623 | 1623 | if (str_contains($argument, "\0")) { |
| 1624 | 1624 | $argument = str_replace("\0", '?', $argument); |
@@ -1628,14 +1628,14 @@ discard block |
||
| 1628 | 1628 | } |
| 1629 | 1629 | $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument); |
| 1630 | 1630 | |
| 1631 | - return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"'; |
|
| 1631 | + return '"' . str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument) . '"'; |
|
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | private function replacePlaceholders(string $commandline, array $env) |
| 1635 | 1635 | { |
| 1636 | - return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) { |
|
| 1636 | + return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function($matches) use ($commandline, $env) { |
|
| 1637 | 1637 | if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) { |
| 1638 | - throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]).$commandline); |
|
| 1638 | + throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]) . $commandline); |
|
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | return $this->escapeArgument($env[$matches[1]]); |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | } |
| 76 | 76 | foreach ($suffixes as $suffix) { |
| 77 | 77 | foreach ($dirs as $dir) { |
| 78 | - if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) { |
|
| 78 | + if (@is_file($file = $dir . \DIRECTORY_SEPARATOR . $name . $suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) { |
|
| 79 | 79 | return $file; |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | $serviceId = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType; |
| 61 | 61 | |
| 62 | 62 | if ($returnType->allowsNull()) { |
| 63 | - $serviceId = '?'.$serviceId; |
|
| 63 | + $serviceId = '?' . $serviceId; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $services[$attribute->newInstance()->key ?? self::class.'::'.$method->name] = $serviceId; |
|
| 66 | + $services[$attribute->newInstance()->key ?? self::class . '::' . $method->name] = $serviceId; |
|
| 67 | 67 | $attributeOptIn = true; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | trigger_deprecation('symfony/service-contracts', '2.5', 'Using "%s" in "%s" without using the "%s" attribute on any method is deprecated.', ServiceSubscriberTrait::class, self::class, SubscribedService::class); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType); |
|
| 93 | + $services[self::class . '::' . $method->name] = '?' . ($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType); |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | public function testHas() |
| 31 | 31 | { |
| 32 | 32 | $locator = $this->getServiceLocator([ |
| 33 | - 'foo' => function () { return 'bar'; }, |
|
| 34 | - 'bar' => function () { return 'baz'; }, |
|
| 35 | - function () { return 'dummy'; }, |
|
| 33 | + 'foo' => function() { return 'bar'; }, |
|
| 34 | + 'bar' => function() { return 'baz'; }, |
|
| 35 | + function() { return 'dummy'; }, |
|
| 36 | 36 | ]); |
| 37 | 37 | |
| 38 | 38 | $this->assertTrue($locator->has('foo')); |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | public function testGet() |
| 44 | 44 | { |
| 45 | 45 | $locator = $this->getServiceLocator([ |
| 46 | - 'foo' => function () { return 'bar'; }, |
|
| 47 | - 'bar' => function () { return 'baz'; }, |
|
| 46 | + 'foo' => function() { return 'bar'; }, |
|
| 47 | + 'bar' => function() { return 'baz'; }, |
|
| 48 | 48 | ]); |
| 49 | 49 | |
| 50 | 50 | $this->assertSame('bar', $locator->get('foo')); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $i = 0; |
| 57 | 57 | $locator = $this->getServiceLocator([ |
| 58 | - 'foo' => function () use (&$i) { |
|
| 58 | + 'foo' => function() use (&$i) { |
|
| 59 | 59 | ++$i; |
| 60 | 60 | |
| 61 | 61 | return 'bar'; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'); |
| 75 | 75 | } |
| 76 | 76 | $locator = $this->getServiceLocator([ |
| 77 | - 'foo' => function () use (&$locator) { return $locator->get('bar'); }, |
|
| 77 | + 'foo' => function() use (&$locator) { return $locator->get('bar'); }, |
|
| 78 | 78 | ]); |
| 79 | 79 | |
| 80 | 80 | $locator->get('foo'); |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | $this->expectException(\Psr\Container\ContainerExceptionInterface::class); |
| 86 | 86 | $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".'); |
| 87 | 87 | $locator = $this->getServiceLocator([ |
| 88 | - 'foo' => function () use (&$locator) { return $locator->get('bar'); }, |
|
| 89 | - 'bar' => function () use (&$locator) { return $locator->get('baz'); }, |
|
| 90 | - 'baz' => function () use (&$locator) { return $locator->get('bar'); }, |
|
| 88 | + 'foo' => function() use (&$locator) { return $locator->get('bar'); }, |
|
| 89 | + 'bar' => function() use (&$locator) { return $locator->get('baz'); }, |
|
| 90 | + 'baz' => function() use (&$locator) { return $locator->get('bar'); }, |
|
| 91 | 91 | ]); |
| 92 | 92 | |
| 93 | 93 | $locator->get('foo'); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | private const CASE_FOLD = [ |
| 41 | 41 | ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], |
| 42 | - ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], |
|
| 42 | + ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], |
|
| 43 | 43 | ]; |
| 44 | 44 | |
| 45 | 45 | public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0) |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | if (!is_scalar($s)) { |
| 52 | 52 | $hasError = false; |
| 53 | - set_error_handler(function () use (&$hasError) { $hasError = true; }); |
|
| 53 | + set_error_handler(function() use (&$hasError) { $hasError = true; }); |
|
| 54 | 54 | $next = substr($s, $start); |
| 55 | 55 | restore_error_handler(); |
| 56 | 56 | if ($hasError) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $next = $start; |
| 85 | 85 | |
| 86 | - $s = preg_split('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', "\r\n".$s, $size + 1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE); |
|
| 86 | + $s = preg_split('/(' . SYMFONY_GRAPHEME_CLUSTER_RX . ')/u', "\r\n" . $s, $size + 1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE); |
|
| 87 | 87 | |
| 88 | 88 | if (!isset($s[1])) { |
| 89 | 89 | return false; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public static function grapheme_strlen($s) |
| 115 | 115 | { |
| 116 | - preg_replace('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', '', $s, -1, $len); |
|
| 116 | + preg_replace('/' . SYMFONY_GRAPHEME_CLUSTER_RX . '/u', '', $s, -1, $len); |
|
| 117 | 117 | |
| 118 | 118 | return 0 === $len && '' !== $s ? null : $len; |
| 119 | 119 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $len = 2147483647; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - preg_match_all('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', $s, $s); |
|
| 127 | + preg_match_all('/' . SYMFONY_GRAPHEME_CLUSTER_RX . '/u', $s, $s); |
|
| 128 | 128 | |
| 129 | 129 | $slen = \count($s[0]); |
| 130 | 130 | $start = (int) $start; |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | if (0x80 > $code %= 0x200000) { |
| 64 | 64 | $string .= \chr($code); |
| 65 | 65 | } elseif (0x800 > $code) { |
| 66 | - $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); |
|
| 66 | + $string .= \chr(0xC0 | $code >> 6) . \chr(0x80 | $code & 0x3F); |
|
| 67 | 67 | } elseif (0x10000 > $code) { |
| 68 | - $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
| 68 | + $string .= \chr(0xE0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F); |
|
| 69 | 69 | } else { |
| 70 | - $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
| 70 | + $string .= \chr(0xF0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3F) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } elseif (!\function_exists('iconv')) { |
| 143 | 143 | $s = preg_replace('/[^\x00-\x7F]/u', '?', $s); |
| 144 | 144 | } else { |
| 145 | - $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) { |
|
| 145 | + $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function($c) { |
|
| 146 | 146 | $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]); |
| 147 | 147 | |
| 148 | 148 | if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | public function camel(): parent |
| 163 | 163 | { |
| 164 | 164 | $str = clone $this; |
| 165 | - $str->string = str_replace(' ', '', preg_replace_callback('/\b./u', static function ($m) use (&$i) { |
|
| 165 | + $str->string = str_replace(' ', '', preg_replace_callback('/\b./u', static function($m) use (&$i) { |
|
| 166 | 166 | return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); |
| 167 | 167 | }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string))); |
| 168 | 168 | |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | { |
| 208 | 208 | $str = clone $this; |
| 209 | 209 | |
| 210 | - $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : ''; |
|
| 211 | - $str->string = implode($this->string, $strings).$tail; |
|
| 210 | + $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue . array_pop($strings) : ''; |
|
| 211 | + $str->string = implode($this->string, $strings) . $tail; |
|
| 212 | 212 | |
| 213 | 213 | if (!preg_match('//u', $str->string)) { |
| 214 | 214 | throw new InvalidArgumentException('Invalid UTF-8 string.'); |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | $regexp .= 'i'; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
| 236 | + set_error_handler(static function($t, $m) { throw new InvalidArgumentException($m); }); |
|
| 237 | 237 | |
| 238 | 238 | try { |
| 239 | - if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) { |
|
| 239 | + if (false === $match($regexp . 'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) { |
|
| 240 | 240 | $lastError = preg_last_error(); |
| 241 | 241 | |
| 242 | 242 | foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
| 243 | 243 | if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
| 244 | - throw new RuntimeException('Matching failed with '.$k.'.'); |
|
| 244 | + throw new RuntimeException('Matching failed with ' . $k . '.'); |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | $replace = 'preg_replace_callback'; |
| 320 | - $to = static function (array $m) use ($to): string { |
|
| 320 | + $to = static function(array $m) use ($to): string { |
|
| 321 | 321 | $to = $to($m); |
| 322 | 322 | |
| 323 | 323 | if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) { |
@@ -332,15 +332,15 @@ discard block |
||
| 332 | 332 | $replace = 'preg_replace'; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
| 335 | + set_error_handler(static function($t, $m) { throw new InvalidArgumentException($m); }); |
|
| 336 | 336 | |
| 337 | 337 | try { |
| 338 | - if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) { |
|
| 338 | + if (null === $string = $replace($fromRegexp . 'u', $to, $this->string)) { |
|
| 339 | 339 | $lastError = preg_last_error(); |
| 340 | 340 | |
| 341 | 341 | foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
| 342 | 342 | if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
| 343 | - throw new RuntimeException('Matching failed with '.$k.'.'); |
|
| 343 | + throw new RuntimeException('Matching failed with ' . $k . '.'); |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | $limit = $allWords ? -1 : 1; |
| 380 | 380 | |
| 381 | - $str->string = preg_replace_callback('/\b./u', static function (array $m): string { |
|
| 381 | + $str->string = preg_replace_callback('/\b./u', static function(array $m): string { |
|
| 382 | 382 | return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); |
| 383 | 383 | }, $str->string, $limit); |
| 384 | 384 | |
@@ -522,22 +522,22 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | switch ($type) { |
| 524 | 524 | case \STR_PAD_RIGHT: |
| 525 | - return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
| 525 | + return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)) . ($len ? $pad->slice(0, $len) : '')); |
|
| 526 | 526 | |
| 527 | 527 | case \STR_PAD_LEFT: |
| 528 | - return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
| 528 | + return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)) . ($len ? $pad->slice(0, $len) : '')); |
|
| 529 | 529 | |
| 530 | 530 | case \STR_PAD_BOTH: |
| 531 | 531 | $freeLen /= 2; |
| 532 | 532 | |
| 533 | 533 | $rightLen = ceil($freeLen); |
| 534 | 534 | $len = $rightLen % $padLen; |
| 535 | - $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
| 535 | + $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)) . ($len ? $pad->slice(0, $len) : '')); |
|
| 536 | 536 | |
| 537 | 537 | $leftLen = floor($freeLen); |
| 538 | 538 | $len = $leftLen % $padLen; |
| 539 | 539 | |
| 540 | - return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
| 540 | + return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)) . ($len ? $pad->slice(0, $len) : '')); |
|
| 541 | 541 | |
| 542 | 542 | default: |
| 543 | 543 | throw new InvalidArgumentException('Invalid padding type.'); |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | if (null === self::$tableZero) { |
| 576 | - self::$tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php'; |
|
| 576 | + self::$tableZero = require __DIR__ . '/Resources/data/wcswidth_table_zero.php'; |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | if ($codePoint >= self::$tableZero[0][0] && $codePoint <= self::$tableZero[$ubound = \count(self::$tableZero) - 1][1]) { |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | if (null === self::$tableWide) { |
| 595 | - self::$tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php'; |
|
| 595 | + self::$tableWide = require __DIR__ . '/Resources/data/wcswidth_table_wide.php'; |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | if ($codePoint >= self::$tableWide[0][0] && $codePoint <= self::$tableWide[$ubound = \count(self::$tableWide) - 1][1]) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | // If the symbols map is passed as a closure, there is no need to fallback to the parent locale |
| 115 | 115 | // as the closure can just provide substitutions for all locales of interest. |
| 116 | 116 | $symbolsMap = $this->symbolsMap; |
| 117 | - array_unshift($transliterator, static function ($s) use ($symbolsMap, $locale) { |
|
| 117 | + array_unshift($transliterator, static function($s) use ($symbolsMap, $locale) { |
|
| 118 | 118 | return $symbolsMap($s, $locale); |
| 119 | 119 | }); |
| 120 | 120 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | if ($map) { |
| 135 | 135 | foreach ($map as $char => $replace) { |
| 136 | - $unicodeString = $unicodeString->replace($char, ' '.$replace.' '); |
|
| 136 | + $unicodeString = $unicodeString->replace($char, ' ' . $replace . ' '); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | // Exact locale supported, cache and return |
| 154 | 154 | if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$locale] ?? null) { |
| 155 | - return $this->transliterators[$locale] = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id); |
|
| 155 | + return $this->transliterators[$locale] = \Transliterator::create($id . '/BGN') ?? \Transliterator::create($id); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Locale not supported and no parent, fallback to any-latin |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | // Try to use the parent locale (ie. try "de" for "de_AT") and cache both locales |
| 164 | 164 | if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$parent] ?? null) { |
| 165 | - $transliterator = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id); |
|
| 165 | + $transliterator = \Transliterator::create($id . '/BGN') ?? \Transliterator::create($id); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | return $this->transliterators[$locale] = $this->transliterators[$parent] = $transliterator ?? null; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $lazyString = new static(); |
| 35 | - $lazyString->value = static function () use (&$callback, &$arguments, &$value): string { |
|
| 35 | + $lazyString->value = static function() use (&$callback, &$arguments, &$value): string { |
|
| 36 | 36 | if (null !== $arguments) { |
| 37 | 37 | if (!\is_callable($callback)) { |
| 38 | 38 | $callback[0] = $callback[0](); |
@@ -159,6 +159,6 @@ discard block |
||
| 159 | 159 | $method = '__invoke'; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - return $class.'::'.$method; |
|
| 162 | + return $class . '::' . $method; |
|
| 163 | 163 | } |
| 164 | 164 | } |