mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-30 07:50:53 +00:00
Updated Rector to commit 58a577c5b3d34cc70ba6ea713e7a6c7bbe66354e
58a577c5b3
[automated] Re-Generate Nodes/Rectors Documentation (#2845)
This commit is contained in:
parent
8af39d268b
commit
28e29c8294
|
@ -46,7 +46,7 @@
|
|||
|
||||
- [Php73](#php73) (9)
|
||||
|
||||
- [Php74](#php74) (13)
|
||||
- [Php74](#php74) (14)
|
||||
|
||||
- [Php80](#php80) (19)
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
- [Strict](#strict) (5)
|
||||
|
||||
- [Transform](#transform) (35)
|
||||
- [Transform](#transform) (34)
|
||||
|
||||
- [TypeDeclaration](#typedeclaration) (29)
|
||||
|
||||
|
@ -5698,6 +5698,20 @@ Change `mb_strrpos()` encoding argument position
|
|||
|
||||
<br>
|
||||
|
||||
### MoneyFormatToNumberFormatRector
|
||||
|
||||
Change `money_format()` to equivalent `number_format()`
|
||||
|
||||
- class: [`Rector\Php74\Rector\FuncCall\MoneyFormatToNumberFormatRector`](../rules/Php74/Rector/FuncCall/MoneyFormatToNumberFormatRector.php)
|
||||
|
||||
```diff
|
||||
-$value = money_format('%i', $value);
|
||||
+$roundedValue = round($value, 2, PHP_ROUND_HALF_ODD);
|
||||
+$value = number_format($roundedValue, 2, '.', '');
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### NullCoalescingOperatorRector
|
||||
|
||||
Use null coalescing operator ??=
|
||||
|
@ -8549,75 +8563,6 @@ return static function (RectorConfig $rectorConfig): void {
|
|||
|
||||
<br>
|
||||
|
||||
### ServiceGetterToConstructorInjectionRector
|
||||
|
||||
Get service call to constructor injection
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\Transform\Rector\MethodCall\ServiceGetterToConstructorInjectionRector`](../rules/Transform/Rector/MethodCall/ServiceGetterToConstructorInjectionRector.php)
|
||||
|
||||
```php
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Transform\Rector\MethodCall\ServiceGetterToConstructorInjectionRector;
|
||||
use Rector\Transform\ValueObject\ServiceGetterToConstructorInjection;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->ruleWithConfiguration(
|
||||
ServiceGetterToConstructorInjectionRector::class,
|
||||
[new ServiceGetterToConstructorInjection('FirstService', 'getAnotherService', 'AnotherService')]
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
/**
|
||||
* @var FirstService
|
||||
*/
|
||||
private $firstService;
|
||||
|
||||
- public function __construct(FirstService $firstService)
|
||||
- {
|
||||
- $this->firstService = $firstService;
|
||||
- }
|
||||
-
|
||||
- public function run()
|
||||
- {
|
||||
- $anotherService = $this->firstService->getAnotherService();
|
||||
- $anotherService->run();
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-class FirstService
|
||||
-{
|
||||
/**
|
||||
* @var AnotherService
|
||||
*/
|
||||
private $anotherService;
|
||||
|
||||
- public function __construct(AnotherService $anotherService)
|
||||
+ public function __construct(FirstService $firstService, AnotherService $anotherService)
|
||||
{
|
||||
+ $this->firstService = $firstService;
|
||||
$this->anotherService = $anotherService;
|
||||
}
|
||||
|
||||
- public function getAnotherService(): AnotherService
|
||||
+ public function run()
|
||||
{
|
||||
- return $this->anotherService;
|
||||
+ $anotherService = $this->anotherService;
|
||||
+ $anotherService->run();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### StaticCallToFuncCallRector
|
||||
|
||||
Turns static call to function call.
|
||||
|
|
|
@ -17,12 +17,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '0c0007a75f8e0c873ee51b58a2beef7abe7b28aa';
|
||||
public const PACKAGE_VERSION = '58a577c5b3d34cc70ba6ea713e7a6c7bbe66354e';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-08-26 14:28:43';
|
||||
public const RELEASE_DATE = '2022-08-28 00:33:38';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitf796d547813743463f53e037ab3db009::getLoader();
|
||||
return ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5::getLoader();
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitf796d547813743463f53e037ab3db009
|
||||
class ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInitf796d547813743463f53e037ab3db009
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf796d547813743463f53e037ab3db009', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf796d547813743463f53e037ab3db009', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitf796d547813743463f53e037ab3db009::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInitf796d547813743463f53e037ab3db009::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequiref796d547813743463f53e037ab3db009($fileIdentifier, $file);
|
||||
composerRequire691a01fbc08087d9f951d4371ba1e2b5($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInitf796d547813743463f53e037ab3db009
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequiref796d547813743463f53e037ab3db009($fileIdentifier, $file)
|
||||
function composerRequire691a01fbc08087d9f951d4371ba1e2b5($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitf796d547813743463f53e037ab3db009
|
||||
class ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
|
@ -3256,9 +3256,9 @@ class ComposerStaticInitf796d547813743463f53e037ab3db009
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf796d547813743463f53e037ab3db009::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf796d547813743463f53e037ab3db009::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf796d547813743463f53e037ab3db009::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
42
vendor/composer/installed.json
vendored
42
vendor/composer/installed.json
vendored
|
@ -2484,17 +2484,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/console",
|
||||
"version": "v6.1.3",
|
||||
"version_normalized": "6.1.3.0",
|
||||
"version": "v6.1.4",
|
||||
"version_normalized": "6.1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/console.git",
|
||||
"reference": "43fcb5c5966b43c56bcfa481368d90d748936ab8"
|
||||
"reference": "7fccea8728aa2d431a6725b02b3ce759049fc84d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/43fcb5c5966b43c56bcfa481368d90d748936ab8",
|
||||
"reference": "43fcb5c5966b43c56bcfa481368d90d748936ab8",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/7fccea8728aa2d431a6725b02b3ce759049fc84d",
|
||||
"reference": "7fccea8728aa2d431a6725b02b3ce759049fc84d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2529,7 +2529,7 @@
|
|||
"symfony\/lock": "",
|
||||
"symfony\/process": ""
|
||||
},
|
||||
"time": "2022-07-22T14:17:57+00:00",
|
||||
"time": "2022-08-26T10:32:31+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2563,7 +2563,7 @@
|
|||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.1.3"
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.1.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2783,17 +2783,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/filesystem",
|
||||
"version": "v6.1.3",
|
||||
"version_normalized": "6.1.3.0",
|
||||
"version": "v6.1.4",
|
||||
"version_normalized": "6.1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/filesystem.git",
|
||||
"reference": "c780e677cddda78417fa5187a7c6cd2f21110db9"
|
||||
"reference": "3f39c04d2630c34019907b02f85672dac99f8659"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/c780e677cddda78417fa5187a7c6cd2f21110db9",
|
||||
"reference": "c780e677cddda78417fa5187a7c6cd2f21110db9",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/3f39c04d2630c34019907b02f85672dac99f8659",
|
||||
"reference": "3f39c04d2630c34019907b02f85672dac99f8659",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2801,7 +2801,7 @@
|
|||
"symfony\/polyfill-ctype": "~1.8",
|
||||
"symfony\/polyfill-mbstring": "~1.8"
|
||||
},
|
||||
"time": "2022-07-20T14:45:06+00:00",
|
||||
"time": "2022-08-02T16:17:38+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2829,7 +2829,7 @@
|
|||
"description": "Provides basic utilities for the filesystem",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.1.3"
|
||||
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.1.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -3089,17 +3089,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/string",
|
||||
"version": "v6.1.3",
|
||||
"version_normalized": "6.1.3.0",
|
||||
"version": "v6.1.4",
|
||||
"version_normalized": "6.1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/string.git",
|
||||
"reference": "f35241f45c30bcd9046af2bb200a7086f70e1d6b"
|
||||
"reference": "290972cad7b364e3befaa74ba0ec729800fb161c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/f35241f45c30bcd9046af2bb200a7086f70e1d6b",
|
||||
"reference": "f35241f45c30bcd9046af2bb200a7086f70e1d6b",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/290972cad7b364e3befaa74ba0ec729800fb161c",
|
||||
"reference": "290972cad7b364e3befaa74ba0ec729800fb161c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3118,7 +3118,7 @@
|
|||
"symfony\/translation-contracts": "^2.0|^3.0",
|
||||
"symfony\/var-exporter": "^5.4|^6.0"
|
||||
},
|
||||
"time": "2022-07-27T15:50:51+00:00",
|
||||
"time": "2022-08-12T18:05:43+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -3157,7 +3157,7 @@
|
|||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.1.3"
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.1.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
31
vendor/symfony/console/Application.php
vendored
31
vendor/symfony/console/Application.php
vendored
|
@ -857,19 +857,25 @@ class Application implements ResetInterface
|
|||
$helper->setInput($input);
|
||||
}
|
||||
}
|
||||
if ($command instanceof SignalableCommandInterface && ($this->signalsToDispatchEvent || $command->getSubscribedSignals())) {
|
||||
if (!$this->signalRegistry) {
|
||||
throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
|
||||
}
|
||||
if (Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = \shell_exec('stty -g');
|
||||
foreach ([\SIGINT, \SIGTERM] as $signal) {
|
||||
$this->signalRegistry->register($signal, static function () use($sttyMode) {
|
||||
\shell_exec('stty ' . $sttyMode);
|
||||
});
|
||||
if ($this->signalsToDispatchEvent) {
|
||||
$commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : [];
|
||||
if ($commandSignals || null !== $this->dispatcher) {
|
||||
if (!$this->signalRegistry) {
|
||||
throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
|
||||
}
|
||||
if (Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = \shell_exec('stty -g');
|
||||
foreach ([\SIGINT, \SIGTERM] as $signal) {
|
||||
$this->signalRegistry->register($signal, static function () use($sttyMode) {
|
||||
\shell_exec('stty ' . $sttyMode);
|
||||
});
|
||||
}
|
||||
}
|
||||
foreach ($commandSignals as $signal) {
|
||||
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
|
||||
}
|
||||
}
|
||||
if ($this->dispatcher) {
|
||||
if (null !== $this->dispatcher) {
|
||||
foreach ($this->signalsToDispatchEvent as $signal) {
|
||||
$event = new ConsoleSignalEvent($command, $input, $output, $signal);
|
||||
$this->signalRegistry->register($signal, function ($signal, $hasNext) use($event) {
|
||||
|
@ -883,9 +889,6 @@ class Application implements ResetInterface
|
|||
});
|
||||
}
|
||||
}
|
||||
foreach ($command->getSubscribedSignals() as $signal) {
|
||||
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
|
||||
}
|
||||
}
|
||||
if (null === $this->dispatcher) {
|
||||
return $command->run($input, $output);
|
||||
|
|
|
@ -118,7 +118,7 @@ class ApplicationDescription
|
|||
$sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
|
||||
}
|
||||
if ($namespacedCommands) {
|
||||
\ksort($namespacedCommands);
|
||||
\ksort($namespacedCommands, \SORT_STRING);
|
||||
foreach ($namespacedCommands as $key => $commandsSet) {
|
||||
\ksort($commandsSet);
|
||||
$sortedCommands[$key] = $commandsSet;
|
||||
|
|
|
@ -68,7 +68,7 @@ class OutputFormatterStyleStack implements ResetInterface
|
|||
/**
|
||||
* Computes current style with stacks top codes.
|
||||
*/
|
||||
public function getCurrent() : OutputFormatterStyle
|
||||
public function getCurrent() : OutputFormatterStyleInterface
|
||||
{
|
||||
if (empty($this->styles)) {
|
||||
return $this->emptyStyle;
|
||||
|
|
54
vendor/symfony/filesystem/Path.php
vendored
54
vendor/symfony/filesystem/Path.php
vendored
|
@ -73,7 +73,7 @@ final class Path
|
|||
}
|
||||
// Replace "~" with user's home directory.
|
||||
if ('~' === $path[0]) {
|
||||
$path = self::getHomeDirectory() . \mb_substr($path, 1);
|
||||
$path = self::getHomeDirectory() . \substr($path, 1);
|
||||
}
|
||||
$path = self::normalize($path);
|
||||
[$root, $pathWithoutRoot] = self::split($path);
|
||||
|
@ -133,9 +133,9 @@ final class Path
|
|||
}
|
||||
$path = self::canonicalize($path);
|
||||
// Maintain scheme
|
||||
if (\false !== ($schemeSeparatorPosition = \mb_strpos($path, '://'))) {
|
||||
$scheme = \mb_substr($path, 0, $schemeSeparatorPosition + 3);
|
||||
$path = \mb_substr($path, $schemeSeparatorPosition + 3);
|
||||
if (\false !== ($schemeSeparatorPosition = \strpos($path, '://'))) {
|
||||
$scheme = \substr($path, 0, $schemeSeparatorPosition + 3);
|
||||
$path = \substr($path, $schemeSeparatorPosition + 3);
|
||||
} else {
|
||||
$scheme = '';
|
||||
}
|
||||
|
@ -148,9 +148,9 @@ final class Path
|
|||
}
|
||||
// Directory equals Windows root "C:/"
|
||||
if (2 === $dirSeparatorPosition && \ctype_alpha($path[0]) && ':' === $path[1]) {
|
||||
return $scheme . \mb_substr($path, 0, 3);
|
||||
return $scheme . \substr($path, 0, 3);
|
||||
}
|
||||
return $scheme . \mb_substr($path, 0, $dirSeparatorPosition);
|
||||
return $scheme . \substr($path, 0, $dirSeparatorPosition);
|
||||
}
|
||||
/**
|
||||
* Returns canonical path of the user's home directory.
|
||||
|
@ -203,7 +203,7 @@ final class Path
|
|||
if ('/' === $firstCharacter || '\\' === $firstCharacter) {
|
||||
return $scheme . '/';
|
||||
}
|
||||
$length = \mb_strlen($path);
|
||||
$length = \strlen($path);
|
||||
// Windows root
|
||||
if ($length > 1 && ':' === $path[1] && \ctype_alpha($firstCharacter)) {
|
||||
// Special case: "C:"
|
||||
|
@ -299,14 +299,14 @@ final class Path
|
|||
$actualExtension = self::getExtension($path);
|
||||
$extension = \ltrim($extension, '.');
|
||||
// No extension for paths
|
||||
if ('/' === \mb_substr($path, -1)) {
|
||||
if ('/' === \substr($path, -1)) {
|
||||
return $path;
|
||||
}
|
||||
// No actual extension in path
|
||||
if (empty($actualExtension)) {
|
||||
return $path . ('.' === \mb_substr($path, -1) ? '' : '.') . $extension;
|
||||
return $path . ('.' === \substr($path, -1) ? '' : '.') . $extension;
|
||||
}
|
||||
return \mb_substr($path, 0, -\mb_strlen($actualExtension)) . $extension;
|
||||
return \substr($path, 0, -\strlen($actualExtension)) . $extension;
|
||||
}
|
||||
public static function isAbsolute(string $path) : bool
|
||||
{
|
||||
|
@ -314,8 +314,8 @@ final class Path
|
|||
return \false;
|
||||
}
|
||||
// Strip scheme
|
||||
if (\false !== ($schemeSeparatorPosition = \mb_strpos($path, '://'))) {
|
||||
$path = \mb_substr($path, $schemeSeparatorPosition + 3);
|
||||
if (\false !== ($schemeSeparatorPosition = \strpos($path, '://'))) {
|
||||
$path = \substr($path, $schemeSeparatorPosition + 3);
|
||||
}
|
||||
$firstCharacter = $path[0];
|
||||
// UNIX root "/" or "\" (Windows style)
|
||||
|
@ -323,9 +323,9 @@ final class Path
|
|||
return \true;
|
||||
}
|
||||
// Windows root
|
||||
if (\mb_strlen($path) > 1 && \ctype_alpha($firstCharacter) && ':' === $path[1]) {
|
||||
if (\strlen($path) > 1 && \ctype_alpha($firstCharacter) && ':' === $path[1]) {
|
||||
// Special case: "C:"
|
||||
if (2 === \mb_strlen($path)) {
|
||||
if (2 === \strlen($path)) {
|
||||
return \true;
|
||||
}
|
||||
// Normal case: "C:/ or "C:\"
|
||||
|
@ -387,9 +387,9 @@ final class Path
|
|||
if (self::isAbsolute($path)) {
|
||||
return self::canonicalize($path);
|
||||
}
|
||||
if (\false !== ($schemeSeparatorPosition = \mb_strpos($basePath, '://'))) {
|
||||
$scheme = \mb_substr($basePath, 0, $schemeSeparatorPosition + 3);
|
||||
$basePath = \mb_substr($basePath, $schemeSeparatorPosition + 3);
|
||||
if (\false !== ($schemeSeparatorPosition = \strpos($basePath, '://'))) {
|
||||
$scheme = \substr($basePath, 0, $schemeSeparatorPosition + 3);
|
||||
$basePath = \substr($basePath, $schemeSeparatorPosition + 3);
|
||||
} else {
|
||||
$scheme = '';
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ final class Path
|
|||
continue;
|
||||
}
|
||||
// Only add slash if previous part didn't end with '/' or '\'
|
||||
if (!\in_array(\mb_substr($finalPath, -1), ['/', '\\'])) {
|
||||
if (!\in_array(\substr($finalPath, -1), ['/', '\\'])) {
|
||||
$finalPath .= '/';
|
||||
}
|
||||
// If first part included a scheme like 'phar://' we allow \current part to start with '/', otherwise trim
|
||||
|
@ -671,17 +671,17 @@ final class Path
|
|||
return ['', ''];
|
||||
}
|
||||
// Remember scheme as part of the root, if any
|
||||
if (\false !== ($schemeSeparatorPosition = \mb_strpos($path, '://'))) {
|
||||
$root = \mb_substr($path, 0, $schemeSeparatorPosition + 3);
|
||||
$path = \mb_substr($path, $schemeSeparatorPosition + 3);
|
||||
if (\false !== ($schemeSeparatorPosition = \strpos($path, '://'))) {
|
||||
$root = \substr($path, 0, $schemeSeparatorPosition + 3);
|
||||
$path = \substr($path, $schemeSeparatorPosition + 3);
|
||||
} else {
|
||||
$root = '';
|
||||
}
|
||||
$length = \mb_strlen($path);
|
||||
$length = \strlen($path);
|
||||
// Remove and remember root directory
|
||||
if (\strncmp($path, '/', \strlen('/')) === 0) {
|
||||
$root .= '/';
|
||||
$path = $length > 1 ? \mb_substr($path, 1) : '';
|
||||
$path = $length > 1 ? \substr($path, 1) : '';
|
||||
} elseif ($length > 1 && \ctype_alpha($path[0]) && ':' === $path[1]) {
|
||||
if (2 === $length) {
|
||||
// Windows special case: "C:"
|
||||
|
@ -689,18 +689,18 @@ final class Path
|
|||
$path = '';
|
||||
} elseif ('/' === $path[2]) {
|
||||
// Windows normal case: "C:/"..
|
||||
$root .= \mb_substr($path, 0, 3);
|
||||
$path = $length > 3 ? \mb_substr($path, 3) : '';
|
||||
$root .= \substr($path, 0, 3);
|
||||
$path = $length > 3 ? \substr($path, 3) : '';
|
||||
}
|
||||
}
|
||||
return [$root, $path];
|
||||
}
|
||||
private static function toLower(string $string) : string
|
||||
{
|
||||
if (\false !== ($encoding = \mb_detect_encoding($string))) {
|
||||
if (\false !== ($encoding = \mb_detect_encoding($string, null, \true))) {
|
||||
return \mb_strtolower($string, $encoding);
|
||||
}
|
||||
return \strtolower($string, $encoding);
|
||||
return \strtolower($string);
|
||||
}
|
||||
private function __construct()
|
||||
{
|
||||
|
|
2
vendor/symfony/string/AbstractString.php
vendored
2
vendor/symfony/string/AbstractString.php
vendored
|
@ -211,7 +211,7 @@ abstract class AbstractString implements \JsonSerializable
|
|||
public function collapseWhitespace()
|
||||
{
|
||||
$str = clone $this;
|
||||
$str->string = \trim(\preg_replace('/(?:\\s{2,}+|[^\\S ])/', ' ', $str->string));
|
||||
$str->string = \trim(\preg_replace("/(?:[ \n\r\t\f]{2,}+|[\n\r\t\f])/", ' ', $str->string), " \n\r\t\f");
|
||||
return $str;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -326,7 +326,7 @@ abstract class AbstractUnicodeString extends AbstractString
|
|||
*/
|
||||
public function snake()
|
||||
{
|
||||
$str = $this->camel()->title();
|
||||
$str = $this->camel();
|
||||
$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');
|
||||
return $str;
|
||||
}
|
||||
|
|
2
vendor/symfony/string/ByteString.php
vendored
2
vendor/symfony/string/ByteString.php
vendored
|
@ -333,7 +333,7 @@ class ByteString extends AbstractString
|
|||
*/
|
||||
public function snake()
|
||||
{
|
||||
$str = $this->camel()->title();
|
||||
$str = $this->camel();
|
||||
$str->string = \strtolower(\preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\\d])([A-Z])/'], '\1_\2', $str->string));
|
||||
return $str;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user