mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-07 00:54:29 +02:00
Updated Rector to commit 038f8092eaeeaaf044dbd5685d89bc7636143bbc
038f8092ea
[Performance][BetterPhpDocPaser] Reduce regex usage on start docblock check on PhpDocInfoPrinter (#4966)
This commit is contained in:
parent
c3de7a9b9b
commit
93a246d47b
@ -57,10 +57,9 @@ final class PhpDocInfoPrinter
|
||||
*/
|
||||
private const CALLABLE_REGEX = '#callable(\\s+)\\(#';
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/LLWiPl/1
|
||||
* @var string[]
|
||||
*/
|
||||
private const DOCBLOCK_START_REGEX = '#^(\\/\\/|\\/\\*\\*|\\/\\*|\\#)#';
|
||||
private const DOCBLOCK_STARTS = ['//', '/**', '/*', '#'];
|
||||
/**
|
||||
* @var string Uses a hardcoded unix-newline since most codes use it (even on windows) - otherwise we would need to normalize newlines
|
||||
*/
|
||||
@ -159,7 +158,7 @@ final class PhpDocInfoPrinter
|
||||
}
|
||||
$output = $this->printEnd($output);
|
||||
// fix missing start
|
||||
if (!StringUtils::isMatch($output, self::DOCBLOCK_START_REGEX) && $output !== '') {
|
||||
if (!$this->hasDocblockStart($output) && $output !== '') {
|
||||
$output = '/**' . $output;
|
||||
}
|
||||
// fix missing end
|
||||
@ -168,6 +167,15 @@ final class PhpDocInfoPrinter
|
||||
}
|
||||
return \str_replace(" \n", "\n", $output);
|
||||
}
|
||||
private function hasDocblockStart(string $output) : bool
|
||||
{
|
||||
foreach (self::DOCBLOCK_STARTS as $docblockStart) {
|
||||
if (\strncmp($output, $docblockStart, \strlen($docblockStart)) === 0) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function printDocChildNode(PhpDocChildNode $phpDocChildNode, int $key = 0, int $nodeCount = 0) : string
|
||||
{
|
||||
$output = '';
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '9f29bf8434e78a86efe97a08ef3e84c8db2f4a94';
|
||||
public const PACKAGE_VERSION = '038f8092eaeeaaf044dbd5685d89bc7636143bbc';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-09-10 13:04:42';
|
||||
public const RELEASE_DATE = '2023-09-10 19:08:00';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInite830caaf850d38257673c88c170654df::getLoader();
|
||||
return ComposerAutoloaderInit8e95aa5e7b0ab086df997f016cd618b8::getLoader();
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInite830caaf850d38257673c88c170654df
|
||||
class ComposerAutoloaderInit8e95aa5e7b0ab086df997f016cd618b8
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInite830caaf850d38257673c88c170654df
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInite830caaf850d38257673c88c170654df', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8e95aa5e7b0ab086df997f016cd618b8', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInite830caaf850d38257673c88c170654df', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8e95aa5e7b0ab086df997f016cd618b8', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInite830caaf850d38257673c88c170654df::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8e95aa5e7b0ab086df997f016cd618b8::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInite830caaf850d38257673c88c170654df::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit8e95aa5e7b0ab086df997f016cd618b8::$files;
|
||||
$requireFile = \Closure::bind(static function ($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 ComposerStaticInite830caaf850d38257673c88c170654df
|
||||
class ComposerStaticInit8e95aa5e7b0ab086df997f016cd618b8
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -2599,9 +2599,9 @@ class ComposerStaticInite830caaf850d38257673c88c170654df
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInite830caaf850d38257673c88c170654df::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInite830caaf850d38257673c88c170654df::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInite830caaf850d38257673c88c170654df::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8e95aa5e7b0ab086df997f016cd618b8::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8e95aa5e7b0ab086df997f016cd618b8::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8e95aa5e7b0ab086df997f016cd618b8::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user