diff --git a/packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index bb42fffaf28..5acd422aa64 100644 --- a/packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -418,6 +418,10 @@ final class PhpDocInfo { $this->isSingleLine = \false; } + public function getNode() : \PhpParser\Node + { + return $this->node; + } private function getTypeOrMixed(?\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode) : \PHPStan\Type\Type { if ($phpDocTagValueNode === null) { diff --git a/packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php b/packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php index b9d1f0cade5..dc693780d23 100644 --- a/packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php +++ b/packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php @@ -4,6 +4,7 @@ declare (strict_types=1); namespace Rector\BetterPhpDocParser\Printer; use RectorPrefix20210525\Nette\Utils\Strings; +use PhpParser\Node\Stmt\InlineHTML; use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; @@ -105,6 +106,9 @@ final class PhpDocInfoPrinter if ($phpDocInfo->isSingleLine()) { return $this->docBlockInliner->inline($docContent); } + if ($phpDocInfo->getNode() instanceof \PhpParser\Node\Stmt\InlineHTML) { + return ''; + } return $docContent; } /** @@ -124,6 +128,9 @@ final class PhpDocInfoPrinter if ($phpDocInfo->getPhpDocNode()->children === []) { return ''; } + if ($phpDocInfo->getNode() instanceof \PhpParser\Node\Stmt\InlineHTML) { + return 'getPhpDocNode() . \PHP_EOL . '?>'; + } return (string) $phpDocInfo->getPhpDocNode(); } $phpDocNode = $phpDocInfo->getPhpDocNode(); diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php index db8cf97950e..7b7eb99b022 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php @@ -9,6 +9,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Stmt; +use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; use Rector\Core\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -95,7 +96,9 @@ CODE_SAMPLE if ($this->isNodeTooLong($assign)) { return null; } - return $assign; + $expression = new \PhpParser\Node\Stmt\Expression($assign); + $this->mirrorComments($expression, $node); + return $expression; } /** * @param Stmt[] $stmts diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index c83b35f4e80..ab6d05a4be5 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = '63faa6a33a5efd1371c83d756adfe0353ecddb2f'; + public const PACKAGE_VERSION = '592ca48295d1cf2bf626a19c94de1c39a474c153'; /** * @var string */ - public const RELEASE_DATE = '2021-05-25 15:16:51'; + public const RELEASE_DATE = '2021-05-25 18:28:09'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20210525\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index b1c5e464100..08f50636938 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc::getLoader(); +return ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index b8c7d9cb8d9..8a423f73810 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc +class ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279 { private static $loader; @@ -22,15 +22,15 @@ class ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitf1f7428dabc64f3bc5ce412ff1b4e1fc::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitda82ad30c69eec08aac590b9b6515279::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,19 +42,19 @@ class ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitf1f7428dabc64f3bc5ce412ff1b4e1fc::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitda82ad30c69eec08aac590b9b6515279::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequiref1f7428dabc64f3bc5ce412ff1b4e1fc($fileIdentifier, $file); + composerRequireda82ad30c69eec08aac590b9b6515279($fileIdentifier, $file); } return $loader; } } -function composerRequiref1f7428dabc64f3bc5ce412ff1b4e1fc($fileIdentifier, $file) +function composerRequireda82ad30c69eec08aac590b9b6515279($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index c1733824562..b31f54e75a3 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitf1f7428dabc64f3bc5ce412ff1b4e1fc +class ComposerStaticInitda82ad30c69eec08aac590b9b6515279 { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -3819,9 +3819,9 @@ class ComposerStaticInitf1f7428dabc64f3bc5ce412ff1b4e1fc public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitf1f7428dabc64f3bc5ce412ff1b4e1fc::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitf1f7428dabc64f3bc5ce412ff1b4e1fc::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitf1f7428dabc64f3bc5ce412ff1b4e1fc::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitda82ad30c69eec08aac590b9b6515279::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitda82ad30c69eec08aac590b9b6515279::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitda82ad30c69eec08aac590b9b6515279::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 1786bec3021..a2914c87d2b 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) { spl_autoload_call('RectorPrefix20210525\CheckoutEntityFactory'); } -if (!class_exists('ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc', false) && !interface_exists('ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc', false) && !trait_exists('ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc', false)) { - spl_autoload_call('RectorPrefix20210525\ComposerAutoloaderInitf1f7428dabc64f3bc5ce412ff1b4e1fc'); +if (!class_exists('ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279', false) && !interface_exists('ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279', false) && !trait_exists('ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279', false)) { + spl_autoload_call('RectorPrefix20210525\ComposerAutoloaderInitda82ad30c69eec08aac590b9b6515279'); } if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) { spl_autoload_call('RectorPrefix20210525\Doctrine\Inflector\Inflector'); @@ -92,9 +92,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20210525\print_node(...func_get_args()); } } -if (!function_exists('composerRequiref1f7428dabc64f3bc5ce412ff1b4e1fc')) { - function composerRequiref1f7428dabc64f3bc5ce412ff1b4e1fc() { - return \RectorPrefix20210525\composerRequiref1f7428dabc64f3bc5ce412ff1b4e1fc(...func_get_args()); +if (!function_exists('composerRequireda82ad30c69eec08aac590b9b6515279')) { + function composerRequireda82ad30c69eec08aac590b9b6515279() { + return \RectorPrefix20210525\composerRequireda82ad30c69eec08aac590b9b6515279(...func_get_args()); } } if (!function_exists('parseArgs')) {