mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-08 20:22:24 +00:00
Updated Rector to commit 828ec4e66ed7118e0cc6315df0190941d7db1c72
828ec4e66e
[Printer] Handle return array of nodes with InlineHTML (#3304)
This commit is contained in:
parent
be2e22ede3
commit
bbb27b399f
|
@ -5,6 +5,7 @@ namespace Rector\PostRector\Rector;
|
|||
|
||||
use PhpParser\Node;
|
||||
use Rector\Core\NodeDecorator\MixPhpHtmlDecorator;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PostRector\Collector\NodesToAddCollector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -56,7 +57,8 @@ final class NodeAddingPostRector extends \Rector\PostRector\Rector\AbstractPostR
|
|||
if ($nodesToAddBefore !== []) {
|
||||
$this->nodesToAddCollector->clearNodesToAddBefore($node);
|
||||
$newNodes = \array_merge($nodesToAddBefore, $newNodes);
|
||||
$this->mixPhpHtmlDecorator->decorateBefore($node);
|
||||
$previousNode = $node->getAttribute(AttributeKey::PREVIOUS_NODE);
|
||||
$this->mixPhpHtmlDecorator->decorateBefore($node, $previousNode);
|
||||
}
|
||||
if ($newNodes === [$node]) {
|
||||
return $node;
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '2c353227e499072689cbb22d83b3483b3015025f';
|
||||
public const PACKAGE_VERSION = '828ec4e66ed7118e0cc6315df0190941d7db1c72';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-01-24 22:26:30';
|
||||
public const RELEASE_DATE = '2023-01-26 02:17:15';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -9,8 +9,13 @@ use PhpParser\Node;
|
|||
use PhpParser\Node\Stmt\InlineHTML;
|
||||
use PhpParser\Node\Stmt\Nop;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
use Rector\NodeRemoval\NodeRemover;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
/**
|
||||
* Mix PHP+HTML decorator, which require reprint the InlineHTML
|
||||
* which is the safe way to make next/prev Node has open and close php tag
|
||||
*/
|
||||
final class MixPhpHtmlDecorator
|
||||
{
|
||||
/**
|
||||
|
@ -28,12 +33,38 @@ final class MixPhpHtmlDecorator
|
|||
$this->nodeRemover = $nodeRemover;
|
||||
$this->nodeComparator = $nodeComparator;
|
||||
}
|
||||
public function decorateBefore(Node $node) : void
|
||||
/**
|
||||
* @param Node[] $nodes
|
||||
*/
|
||||
public function decorateNextNodesInlineHTML(File $file, array $nodes) : void
|
||||
{
|
||||
$firstNodePreviousNode = $node->getAttribute(AttributeKey::PREVIOUS_NODE);
|
||||
if ($firstNodePreviousNode instanceof InlineHTML && !$node instanceof InlineHTML) {
|
||||
// re-print InlineHTML is safe
|
||||
$firstNodePreviousNode->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
$oldTokens = $file->getOldTokens();
|
||||
foreach ($nodes as $key => $subNode) {
|
||||
if ($subNode instanceof InlineHTML) {
|
||||
continue;
|
||||
}
|
||||
$endTokenPost = $subNode->getEndTokenPos();
|
||||
if (isset($oldTokens[$endTokenPost])) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($nodes[$key + 1])) {
|
||||
// already last one, nothing to do
|
||||
return;
|
||||
}
|
||||
if ($nodes[$key + 1] instanceof InlineHTML) {
|
||||
// No token end? Just added
|
||||
$nodes[$key + 1]->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
public function decorateBefore(Node $node, Node $previousNode = null) : void
|
||||
{
|
||||
if ($previousNode instanceof InlineHTML && !$node instanceof InlineHTML) {
|
||||
$previousNode->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
return;
|
||||
}
|
||||
if ($node instanceof InlineHTML && !$previousNode instanceof Node) {
|
||||
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -67,7 +98,6 @@ final class MixPhpHtmlDecorator
|
|||
$nodeComments[] = $comment;
|
||||
}
|
||||
$stmt->setAttribute(AttributeKey::COMMENTS, $nodeComments);
|
||||
// re-print InlineHTML is safe
|
||||
$firstNodeAfterNode->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
// remove Nop is marked as comment of Next Node
|
||||
$this->nodeRemover->removeNode($node);
|
||||
|
@ -78,7 +108,7 @@ final class MixPhpHtmlDecorator
|
|||
private function resolveAppendAfterNode(Nop $nop, array $nodes) : ?Node
|
||||
{
|
||||
foreach ($nodes as $key => $subNode) {
|
||||
if (!$this->nodeComparator->areNodesEqual($subNode, $nop)) {
|
||||
if (!$this->nodeComparator->areSameNode($subNode, $nop)) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($nodes[$key + 1])) {
|
||||
|
|
|
@ -30,6 +30,7 @@ use Rector\Core\NodeDecorator\CreatedByRuleDecorator;
|
|||
use Rector\Core\NodeDecorator\MixPhpHtmlDecorator;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
|
||||
use Rector\Core\PhpParser\Node\NodeFactory;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\Core\ProcessAnalyzer\RectifiedAnalyzer;
|
||||
|
@ -391,7 +392,7 @@ CODE_SAMPLE;
|
|||
if (!$firstNodePreviousNode instanceof Node && $node->hasAttribute(AttributeKey::PREVIOUS_NODE)) {
|
||||
/** @var Node $previousNode */
|
||||
$previousNode = $node->getAttribute(AttributeKey::PREVIOUS_NODE);
|
||||
$this->mixPhpHtmlDecorator->decorateBefore($node);
|
||||
$this->mixPhpHtmlDecorator->decorateBefore($node, $previousNode);
|
||||
$nodes = \array_merge([$previousNode], \is_array($nodes) ? $nodes : \iterator_to_array($nodes));
|
||||
}
|
||||
$lastNode = \end($nodes);
|
||||
|
@ -402,6 +403,11 @@ CODE_SAMPLE;
|
|||
$this->mixPhpHtmlDecorator->decorateAfter($node, $nodes);
|
||||
$nodes = \array_merge(\is_array($nodes) ? $nodes : \iterator_to_array($nodes), [$nextNode]);
|
||||
}
|
||||
if (\count($nodes) > 1) {
|
||||
$this->mixPhpHtmlDecorator->decorateNextNodesInlineHTML($this->file, $nodes);
|
||||
} elseif ($firstNode instanceof FileWithoutNamespace) {
|
||||
$this->mixPhpHtmlDecorator->decorateNextNodesInlineHTML($this->file, $firstNode->stmts);
|
||||
}
|
||||
$nodeTraverser = new NodeTraverser();
|
||||
$nodeTraverser->addVisitor(new NodeConnectingVisitor());
|
||||
$nodeTraverser->traverse($nodes);
|
||||
|
|
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 ComposerAutoloaderInit50791387877e964e5b382c4efcb0c02f::getLoader();
|
||||
return ComposerAutoloaderInit904051509bbe45cd3eb398d611a557f3::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 ComposerAutoloaderInit50791387877e964e5b382c4efcb0c02f
|
||||
class ComposerAutoloaderInit904051509bbe45cd3eb398d611a557f3
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit50791387877e964e5b382c4efcb0c02f
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit50791387877e964e5b382c4efcb0c02f', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit904051509bbe45cd3eb398d611a557f3', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit50791387877e964e5b382c4efcb0c02f', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit904051509bbe45cd3eb398d611a557f3', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit50791387877e964e5b382c4efcb0c02f::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit904051509bbe45cd3eb398d611a557f3::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit50791387877e964e5b382c4efcb0c02f::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit904051509bbe45cd3eb398d611a557f3::$files;
|
||||
$requireFile = 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 ComposerStaticInit50791387877e964e5b382c4efcb0c02f
|
||||
class ComposerStaticInit904051509bbe45cd3eb398d611a557f3
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3075,9 +3075,9 @@ class ComposerStaticInit50791387877e964e5b382c4efcb0c02f
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit50791387877e964e5b382c4efcb0c02f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit50791387877e964e5b382c4efcb0c02f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit50791387877e964e5b382c4efcb0c02f::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit904051509bbe45cd3eb398d611a557f3::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit904051509bbe45cd3eb398d611a557f3::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit904051509bbe45cd3eb398d611a557f3::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
84
vendor/composer/installed.json
vendored
84
vendor/composer/installed.json
vendored
|
@ -2267,17 +2267,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/config",
|
||||
"version": "v6.2.0",
|
||||
"version_normalized": "6.2.0.0",
|
||||
"version": "v6.2.5",
|
||||
"version_normalized": "6.2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/config.git",
|
||||
"reference": "ebf27792246165a2a0b6b69ec9c620cac8c5a2f0"
|
||||
"reference": "f31b3c78a3650157188a240695e688d6a182aa91"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/ebf27792246165a2a0b6b69ec9c620cac8c5a2f0",
|
||||
"reference": "ebf27792246165a2a0b6b69ec9c620cac8c5a2f0",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/f31b3c78a3650157188a240695e688d6a182aa91",
|
||||
"reference": "f31b3c78a3650157188a240695e688d6a182aa91",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2299,7 +2299,7 @@
|
|||
"suggest": {
|
||||
"symfony\/yaml": "To use the yaml reference dumper"
|
||||
},
|
||||
"time": "2022-11-02T09:08:04+00:00",
|
||||
"time": "2023-01-09T04:38:22+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2327,7 +2327,7 @@
|
|||
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.2.0"
|
||||
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.2.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2347,17 +2347,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/console",
|
||||
"version": "v6.2.3",
|
||||
"version_normalized": "6.2.3.0",
|
||||
"version": "v6.2.5",
|
||||
"version_normalized": "6.2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/console.git",
|
||||
"reference": "0f579613e771dba2dbb8211c382342a641f5da06"
|
||||
"reference": "3e294254f2191762c1d137aed4b94e966965e985"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/0f579613e771dba2dbb8211c382342a641f5da06",
|
||||
"reference": "0f579613e771dba2dbb8211c382342a641f5da06",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/3e294254f2191762c1d137aed4b94e966965e985",
|
||||
"reference": "3e294254f2191762c1d137aed4b94e966965e985",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2392,7 +2392,7 @@
|
|||
"symfony\/lock": "",
|
||||
"symfony\/process": ""
|
||||
},
|
||||
"time": "2022-12-28T14:26:22+00:00",
|
||||
"time": "2023-01-01T08:38:09+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2426,7 +2426,7 @@
|
|||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.3"
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2550,17 +2550,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/dependency-injection",
|
||||
"version": "v6.1.9",
|
||||
"version_normalized": "6.1.9.0",
|
||||
"version": "v6.1.11",
|
||||
"version_normalized": "6.1.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/dependency-injection.git",
|
||||
"reference": "89db508de3ff096b2a980c7d0a5f0a2091de797b"
|
||||
"reference": "6ff7b7d4ae33764c3fa100463e431465a0a1551c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/89db508de3ff096b2a980c7d0a5f0a2091de797b",
|
||||
"reference": "89db508de3ff096b2a980c7d0a5f0a2091de797b",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/6ff7b7d4ae33764c3fa100463e431465a0a1551c",
|
||||
"reference": "6ff7b7d4ae33764c3fa100463e431465a0a1551c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2592,7 +2592,7 @@
|
|||
"symfony\/proxy-manager-bridge": "Generate service proxies to lazy load them",
|
||||
"symfony\/yaml": ""
|
||||
},
|
||||
"time": "2022-12-28T14:22:24+00:00",
|
||||
"time": "2023-01-23T15:49:58+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"patches_applied": [
|
||||
|
@ -2626,7 +2626,7 @@
|
|||
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v6.1.9"
|
||||
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v6.1.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2646,17 +2646,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/filesystem",
|
||||
"version": "v6.2.0",
|
||||
"version_normalized": "6.2.0.0",
|
||||
"version": "v6.2.5",
|
||||
"version_normalized": "6.2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/filesystem.git",
|
||||
"reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016"
|
||||
"reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/50b2523c874605cf3d4acf7a9e2b30b6a440a016",
|
||||
"reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/e59e8a4006afd7f5654786a83b4fcb8da98f4593",
|
||||
"reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2664,7 +2664,7 @@
|
|||
"symfony\/polyfill-ctype": "~1.8",
|
||||
"symfony\/polyfill-mbstring": "~1.8"
|
||||
},
|
||||
"time": "2022-11-20T13:01:27+00:00",
|
||||
"time": "2023-01-20T17:45:48+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2692,7 +2692,7 @@
|
|||
"description": "Provides basic utilities for the filesystem",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.2.0"
|
||||
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.2.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2712,17 +2712,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/finder",
|
||||
"version": "v6.2.3",
|
||||
"version_normalized": "6.2.3.0",
|
||||
"version": "v6.2.5",
|
||||
"version_normalized": "6.2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/finder.git",
|
||||
"reference": "81eefbddfde282ee33b437ba5e13d7753211ae8e"
|
||||
"reference": "c90dc446976a612e3312a97a6ec0069ab0c2099c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/81eefbddfde282ee33b437ba5e13d7753211ae8e",
|
||||
"reference": "81eefbddfde282ee33b437ba5e13d7753211ae8e",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/c90dc446976a612e3312a97a6ec0069ab0c2099c",
|
||||
"reference": "c90dc446976a612e3312a97a6ec0069ab0c2099c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2731,7 +2731,7 @@
|
|||
"require-dev": {
|
||||
"symfony\/filesystem": "^6.0"
|
||||
},
|
||||
"time": "2022-12-22T17:55:15+00:00",
|
||||
"time": "2023-01-20T17:45:48+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2759,7 +2759,7 @@
|
|||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.2.3"
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.2.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2952,17 +2952,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/string",
|
||||
"version": "v6.2.2",
|
||||
"version_normalized": "6.2.2.0",
|
||||
"version": "v6.2.5",
|
||||
"version_normalized": "6.2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/string.git",
|
||||
"reference": "863219fd713fa41cbcd285a79723f94672faff4d"
|
||||
"reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/863219fd713fa41cbcd285a79723f94672faff4d",
|
||||
"reference": "863219fd713fa41cbcd285a79723f94672faff4d",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0",
|
||||
"reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2982,7 +2982,7 @@
|
|||
"symfony\/translation-contracts": "^2.0|^3.0",
|
||||
"symfony\/var-exporter": "^5.4|^6.0"
|
||||
},
|
||||
"time": "2022-12-14T16:11:27+00:00",
|
||||
"time": "2023-01-01T08:38:09+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -3021,7 +3021,7 @@
|
|||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.2.2"
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.2.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -130,7 +130,7 @@ class XmlReferenceDumper
|
|||
$comments[] = $info;
|
||||
}
|
||||
if ($child instanceof BaseNode && ($example = $child->getExample())) {
|
||||
$comments[] = 'Example: ' . $example;
|
||||
$comments[] = 'Example: ' . (\is_array($example) ? \implode(', ', $example) : $example);
|
||||
}
|
||||
if ($child->isRequired()) {
|
||||
$comments[] = 'Required';
|
||||
|
|
2
vendor/symfony/config/LICENSE
vendored
2
vendor/symfony/config/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
Copyright (c) 2004-2023 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
2
vendor/symfony/console/LICENSE
vendored
2
vendor/symfony/console/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
Copyright (c) 2004-2023 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -40,12 +40,14 @@ class ResolveNamedArgumentsPass extends AbstractRecursivePass
|
|||
foreach ($calls as $i => $call) {
|
||||
[$method, $arguments] = $call;
|
||||
$parameters = null;
|
||||
$resolvedKeys = [];
|
||||
$resolvedArguments = [];
|
||||
foreach ($arguments as $key => $argument) {
|
||||
if ($argument instanceof AbstractArgument && $argument->getText() . '.' === $argument->getTextWithContext()) {
|
||||
$argument->setContext(\sprintf('Argument ' . (\is_int($key) ? 1 + $key : '"%3$s"') . ' of ' . ('__construct' === $method ? 'service "%s"' : 'method call "%s::%s()"'), $this->currentId, $method, $key));
|
||||
}
|
||||
if (\is_int($key)) {
|
||||
$resolvedKeys[$key] = $key;
|
||||
$resolvedArguments[$key] = $argument;
|
||||
continue;
|
||||
}
|
||||
|
@ -63,9 +65,11 @@ class ResolveNamedArgumentsPass extends AbstractRecursivePass
|
|||
if ($key === '$' . $p->name) {
|
||||
if ($p->isVariadic() && \is_array($argument)) {
|
||||
foreach ($argument as $variadicArgument) {
|
||||
$resolvedKeys[$j] = $j;
|
||||
$resolvedArguments[$j++] = $variadicArgument;
|
||||
}
|
||||
} else {
|
||||
$resolvedKeys[$j] = $p->name;
|
||||
$resolvedArguments[$j] = $argument;
|
||||
}
|
||||
continue 2;
|
||||
|
@ -79,6 +83,7 @@ class ResolveNamedArgumentsPass extends AbstractRecursivePass
|
|||
$typeFound = \false;
|
||||
foreach ($parameters as $j => $p) {
|
||||
if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, \true) === $key) {
|
||||
$resolvedKeys[$j] = $p->name;
|
||||
$resolvedArguments[$j] = $argument;
|
||||
$typeFound = \true;
|
||||
}
|
||||
|
@ -89,6 +94,26 @@ class ResolveNamedArgumentsPass extends AbstractRecursivePass
|
|||
}
|
||||
if ($resolvedArguments !== $call[1]) {
|
||||
\ksort($resolvedArguments);
|
||||
$arrayIsList = function (array $array) : bool {
|
||||
if (\function_exists('array_is_list')) {
|
||||
return \array_is_list($array);
|
||||
}
|
||||
if ($array === []) {
|
||||
return \true;
|
||||
}
|
||||
$current_key = 0;
|
||||
foreach ($array as $key => $noop) {
|
||||
if ($key !== $current_key) {
|
||||
return \false;
|
||||
}
|
||||
++$current_key;
|
||||
}
|
||||
return \true;
|
||||
};
|
||||
if (!$value->isAutowired() && !$arrayIsList($resolvedArguments)) {
|
||||
\ksort($resolvedKeys);
|
||||
$resolvedArguments = \array_combine($resolvedKeys, $resolvedArguments);
|
||||
}
|
||||
$calls[$i][1] = $resolvedArguments;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -881,6 +881,27 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
if (null !== $id && $definition->isShared() && (isset($this->services[$id]) || isset($this->privates[$id])) && ($tryProxy || !$definition->isLazy())) {
|
||||
return $this->services[$id] ?? $this->privates[$id];
|
||||
}
|
||||
$arrayIsList = function (array $array) : bool {
|
||||
if (\function_exists('array_is_list')) {
|
||||
return \array_is_list($array);
|
||||
}
|
||||
if ($array === []) {
|
||||
return \true;
|
||||
}
|
||||
$current_key = 0;
|
||||
foreach ($array as $key => $noop) {
|
||||
if ($key !== $current_key) {
|
||||
return \false;
|
||||
}
|
||||
++$current_key;
|
||||
}
|
||||
return \true;
|
||||
};
|
||||
if (!$arrayIsList($arguments)) {
|
||||
$arguments = \array_combine(\array_map(function ($k) {
|
||||
return \preg_replace('/^.*\\$/', '', $k);
|
||||
}, \array_keys($arguments)), $arguments);
|
||||
}
|
||||
if (null !== $factory) {
|
||||
$service = $factory(...$arguments);
|
||||
if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) {
|
||||
|
@ -891,7 +912,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
}
|
||||
} else {
|
||||
$r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass()));
|
||||
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs(\array_values($arguments));
|
||||
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
|
||||
if (!$definition->isDeprecated() && 0 < \strpos($r->getDocComment(), "\n * @deprecated ")) {
|
||||
\RectorPrefix202301\trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name);
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ EOF;
|
|||
$loop = [];
|
||||
}
|
||||
}
|
||||
$this->addCircularReferences($first, $loop, \true);
|
||||
$this->addCircularReferences($first, $loop, $loopByConstructor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ EOF;
|
|||
}
|
||||
$witherAssignation = '';
|
||||
if ($call[2] ?? \false) {
|
||||
if (null !== $sharedNonLazyId && $lastWitherIndex === $k) {
|
||||
if (null !== $sharedNonLazyId && $lastWitherIndex === $k && 'instance' === $variableName) {
|
||||
$witherAssignation = \sprintf('$this->%s[\'%s\'] = ', $definition->isPublic() ? 'services' : 'privates', $sharedNonLazyId);
|
||||
}
|
||||
$witherAssignation .= \sprintf('$%s = ', $variableName);
|
||||
|
|
2
vendor/symfony/dependency-injection/LICENSE
vendored
2
vendor/symfony/dependency-injection/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
Copyright (c) 2004-2023 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
2
vendor/symfony/filesystem/LICENSE
vendored
2
vendor/symfony/filesystem/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
Copyright (c) 2004-2023 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
2
vendor/symfony/finder/LICENSE
vendored
2
vendor/symfony/finder/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
Copyright (c) 2004-2023 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
2
vendor/symfony/string/LICENSE
vendored
2
vendor/symfony/string/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2019-2022 Fabien Potencier
|
||||
Copyright (c) 2019-2023 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
Loading…
Reference in New Issue
Block a user