Updated Rector to commit a3ed07f8c8c0b2f7cbd78ce7711871d31bad3998

a3ed07f8c8 [TypeDeclaration] Do not remove docblock with description on MergeDateTimePropertyTypeDeclarationRector (#5931)
This commit is contained in:
Tomas Votruba 2024-05-31 12:20:27 +00:00
parent 8384715773
commit 7498eeeea2
7 changed files with 73 additions and 32 deletions

View File

@ -858,17 +858,17 @@
},
{
"name": "phpstan\/phpdoc-parser",
"version": "1.29.0",
"version_normalized": "1.29.0.0",
"version": "1.29.1",
"version_normalized": "1.29.1.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
"reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc"
"reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/536889f2b340489d328f5ffb7b02bb6b183ddedc",
"reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/fcaefacf2d5c417e928405b71b400d4ce10daaf4",
"reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4",
"shasum": ""
},
"require": {
@ -885,7 +885,7 @@
"phpunit\/phpunit": "^9.5",
"symfony\/process": "^5.2"
},
"time": "2024-05-06T12:04:23+00:00",
"time": "2024-05-31T08:52:43+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -902,7 +902,7 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.29.0"
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.29.1"
},
"install-path": "..\/phpstan\/phpdoc-parser"
},
@ -1743,12 +1743,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "2661638dab238d3ef43ab5823ccdf15be5547ac9"
"reference": "efef745bb033afb891455bf13ed2f519fe70ef6e"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/2661638dab238d3ef43ab5823ccdf15be5547ac9",
"reference": "2661638dab238d3ef43ab5823ccdf15be5547ac9",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/efef745bb033afb891455bf13ed2f519fe70ef6e",
"reference": "efef745bb033afb891455bf13ed2f519fe70ef6e",
"shasum": ""
},
"require": {
@ -1770,7 +1770,7 @@
"tomasvotruba\/class-leak": "^0.2.13",
"tracy\/tracy": "^2.10"
},
"time": "2024-05-24T15:07:56+00:00",
"time": "2024-05-30T16:27:36+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -1803,12 +1803,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "d075c4f212255cbdeeb8ff837dd41762fbfce931"
"reference": "afbe88dd542a8b71fb1ac39c2f359763d52653a7"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/d075c4f212255cbdeeb8ff837dd41762fbfce931",
"reference": "d075c4f212255cbdeeb8ff837dd41762fbfce931",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/afbe88dd542a8b71fb1ac39c2f359763d52653a7",
"reference": "afbe88dd542a8b71fb1ac39c2f359763d52653a7",
"shasum": ""
},
"require": {
@ -1831,7 +1831,7 @@
"tomasvotruba\/class-leak": "^0.2.13",
"tracy\/tracy": "^2.10"
},
"time": "2024-05-02T19:17:47+00:00",
"time": "2024-05-30T15:05:14+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -1867,12 +1867,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "ce0b5676b62466d7e82aef5fa9bded5cd54a997b"
"reference": "9596a9185373995023b6dab5b3f95f14a2c6626f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/ce0b5676b62466d7e82aef5fa9bded5cd54a997b",
"reference": "ce0b5676b62466d7e82aef5fa9bded5cd54a997b",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/9596a9185373995023b6dab5b3f95f14a2c6626f",
"reference": "9596a9185373995023b6dab5b3f95f14a2c6626f",
"shasum": ""
},
"require": {
@ -1901,7 +1901,7 @@
"tomasvotruba\/class-leak": "^0.2.13",
"tracy\/tracy": "^2.10"
},
"time": "2024-05-30T07:42:48+00:00",
"time": "2024-05-31T12:15:34+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ use function trim;
class TemplateTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode
{
use NodeAttributes;
/** @var string */
/** @var non-empty-string */
public $name;
/** @var TypeNode|null */
public $bound;
@ -17,6 +17,9 @@ class TemplateTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTag
public $default;
/** @var string (may be empty) */
public $description;
/**
* @param non-empty-string $name
*/
public function __construct(string $name, ?TypeNode $bound, string $description, ?TypeNode $default = null)
{
$this->name = $name;

View File

@ -361,6 +361,9 @@ class TypeParser
} else {
$description = '';
}
if ($name === '') {
throw new LogicException('Template tag name cannot be empty.');
}
return new Ast\PhpDoc\TemplateTagValueNode($name, $bound, $description, $default);
}
/** @phpstan-impure */

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 6eb8de8'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 2661638'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main d075c4f'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main ce0b567'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 6eb8de8'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main efef745'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main afbe88d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 9596a91'));
private function __construct()
{
}

View File

@ -1,4 +1,4 @@
# 84 Rules Overview
# 85 Rules Overview
## ActionSuffixRemoverRector
@ -1699,6 +1699,36 @@ Changes `createMessage()` into a new Symfony\Component\Mime\Email
<br>
## SwiftMessageToEmailRector
Convert `\Swift_Message` into an \Symfony\Component\Mime\Email
- class: [`Rector\Symfony\SwiftMailer\Rector\ClassMethod\SwiftMessageToEmailRector`](../rules/SwiftMailer/Rector/ClassMethod/SwiftMessageToEmailRector.php)
```diff
-$message = (new \Swift_Message('Hello Email'))
- ->setFrom('send@example.com')
- ->setTo(['recipient@example.com' => 'Recipient'])
- ->setBody(
- $this->renderView(
- 'emails/registration.html.twig',
- ['name' => $name]
- ),
- 'text/html'
- )
+$message = (new Email())
+ ->from(new Address('send@example.com'))
+ ->to(new Address('recipient@example.com', 'Recipient'))
+ ->subject('Hello Email')
+ ->html($this->renderView(
+ 'emails/registration.html.twig',
+ ['name' => $name]
+ ))
+;
```
<br>
## SwiftSetBodyToHtmlPlainMethodCallRector
Changes `setBody()` method call on Swift_Message into a `html()` or `plain()` based on second argument

View File

@ -36,7 +36,7 @@ class SwiftMessageToEmailRector extends AbstractRector
private $addressesMapping = ['addBcc' => null, 'addCc' => null, 'addFrom' => null, 'addReplyTo' => null, 'addTo' => null, 'setBcc' => 'bcc', 'setCc' => 'cc', 'setFrom' => 'from', 'setReplyTo' => 'replyTo', 'setTo' => 'to'];
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Convert \\Swift_Message into an Symfony\\Component\\Mime\\Email', [new CodeSample(<<<'CODE_SAMPLE'
return new RuleDefinition('Convert \\Swift_Message into an \\Symfony\\Component\\Mime\\Email', [new CodeSample(<<<'CODE_SAMPLE'
$message = (new \Swift_Message('Hello Email'))
->setFrom('send@example.com')
->setTo(['recipient@example.com' => 'Recipient'])
@ -95,7 +95,7 @@ CODE_SAMPLE
if (!$objectType instanceof ObjectType) {
return null;
}
if (!$objectType->isInstanceOf('Swift_Message')->yes() && !$objectType->isInstanceOf('Symfony\\Component\\Mime\\Email')->yes()) {
if (!$objectType->isInstanceOf(self::SWIFT_MESSAGE_FQN)->yes() && !$objectType->isInstanceOf(self::EMAIL_FQN)->yes()) {
return null;
}
$this->handleBasicMapping($node, $name);
@ -104,6 +104,9 @@ CODE_SAMPLE
if ($name === 'attach') {
$this->handleAttach($node);
}
if ($name === 'getId') {
$node = $this->handleId($node);
}
}
}
return $node;
@ -129,16 +132,13 @@ CODE_SAMPLE
return;
}
if ($firstArg->value instanceof Array_ && $firstArg->value->items !== []) {
$newArgs = [];
foreach ($firstArg->value->items as $item) {
if ($item instanceof ArrayItem) {
if ($item->key === null) {
$item->value = $this->createAddress([new Arg($item->value)]);
} else {
$item->value = $this->createAddress([new Arg($item->key), new Arg($item->value)]);
$item->key = null;
}
$newArgs[] = $this->nodeFactory->createArg($this->createAddress($item->key === null ? [new Arg($item->value)] : [new Arg($item->key), new Arg($item->value)]));
}
}
$methodCall->args = $newArgs;
} else {
$addressArguments = [new Arg($firstArg->value)];
if (isset($methodCall->args[1]) && ($secondArg = $methodCall->args[1]) instanceof Arg) {
@ -150,7 +150,7 @@ CODE_SAMPLE
}
private function handleBody(MethodCall $methodCall, string $name) : void
{
if ($name !== 'setBody') {
if (!\in_array($name, ['setBody', 'addPart'], \true)) {
return;
}
if ($methodCall->args[1] instanceof Arg && $methodCall->args[1]->value instanceof String_ && $methodCall->args[1]->value->value === 'text/html') {
@ -178,6 +178,11 @@ CODE_SAMPLE
});
$methodCall->name = new Identifier('attachFromPath');
}
private function handleId(MethodCall $methodCall) : MethodCall
{
$methodCall->name = new Identifier('getHeaders');
return $this->nodeFactory->createMethodCall($this->nodeFactory->createMethodCall($methodCall, 'get', [$this->nodeFactory->createArg(new String_('Content-ID'))]), 'toString');
}
/**
* @param Arg[] $addressArguments
*/