mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-10 21:22:21 +00:00
Updated Rector to commit 4ea7d0f477ff10755172869818056824b2d42dcd
4ea7d0f477
[DeadCode] Clean up PHPStan notice on ComplexNodeRemover::processRemoveParamWithKeys() (#4018)
This commit is contained in:
parent
694cd80b82
commit
0610c13b0a
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 ComposerAutoloaderInitb18d201f9f06fb1157b62ee1b02f413b::getLoader();
|
||||
return ComposerAutoloaderInit475e6f86177a0b7d985e3562a7f2bea1::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 ComposerAutoloaderInitb18d201f9f06fb1157b62ee1b02f413b
|
||||
class ComposerAutoloaderInit475e6f86177a0b7d985e3562a7f2bea1
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitb18d201f9f06fb1157b62ee1b02f413b
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitb18d201f9f06fb1157b62ee1b02f413b', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit475e6f86177a0b7d985e3562a7f2bea1', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitb18d201f9f06fb1157b62ee1b02f413b', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit475e6f86177a0b7d985e3562a7f2bea1', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitb18d201f9f06fb1157b62ee1b02f413b::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit475e6f86177a0b7d985e3562a7f2bea1::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitb18d201f9f06fb1157b62ee1b02f413b::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit475e6f86177a0b7d985e3562a7f2bea1::$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 ComposerStaticInitb18d201f9f06fb1157b62ee1b02f413b
|
||||
class ComposerStaticInit475e6f86177a0b7d985e3562a7f2bea1
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3083,9 +3083,9 @@ class ComposerStaticInitb18d201f9f06fb1157b62ee1b02f413b
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitb18d201f9f06fb1157b62ee1b02f413b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitb18d201f9f06fb1157b62ee1b02f413b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitb18d201f9f06fb1157b62ee1b02f413b::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit475e6f86177a0b7d985e3562a7f2bea1::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit475e6f86177a0b7d985e3562a7f2bea1::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit475e6f86177a0b7d985e3562a7f2bea1::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -1855,12 +1855,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "38d9c1a972d6d15f6ccf6126f983a4ac2ff9aa5b"
|
||||
"reference": "5d3cd437260f2c49f012503ea5cc4bb666ffaa5b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/38d9c1a972d6d15f6ccf6126f983a4ac2ff9aa5b",
|
||||
"reference": "38d9c1a972d6d15f6ccf6126f983a4ac2ff9aa5b",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/5d3cd437260f2c49f012503ea5cc4bb666ffaa5b",
|
||||
"reference": "5d3cd437260f2c49f012503ea5cc4bb666ffaa5b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1885,7 +1885,7 @@
|
|||
"tomasvotruba\/type-coverage": "^0.2.0",
|
||||
"tomasvotruba\/unused-public": "^0.1.10"
|
||||
},
|
||||
"time": "2023-05-29T12:35:39+00:00",
|
||||
"time": "2023-05-29T12:41:20+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -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/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 38d9c1a'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main abf0a7f'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main edbdd0e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3878c88'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5d3cd43'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main abf0a7f'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main edbdd0e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3878c88'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 26 Rules Overview
|
||||
# 25 Rules Overview
|
||||
|
||||
## AddEntityIdByConditionRector
|
||||
|
||||
|
@ -359,43 +359,6 @@ Make nullability in setter class method with respect to property
|
|||
|
||||
<br>
|
||||
|
||||
## ManagerRegistryGetManagerToEntityManagerRector
|
||||
|
||||
Changes ManagerRegistry intermediate calls directly to EntityManager calls
|
||||
|
||||
- class: [`Rector\Doctrine\Rector\Class_\ManagerRegistryGetManagerToEntityManagerRector`](../src/Rector/Class_/ManagerRegistryGetManagerToEntityManagerRector.php)
|
||||
|
||||
```diff
|
||||
-use Doctrine\Common\Persistence\ManagerRegistry;
|
||||
+use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class CustomRepository
|
||||
{
|
||||
/**
|
||||
- * @var ManagerRegistry
|
||||
+ * @var EntityManagerInterface
|
||||
*/
|
||||
- private $managerRegistry;
|
||||
+ private $entityManager;
|
||||
|
||||
- public function __construct(ManagerRegistry $managerRegistry)
|
||||
+ public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
- $this->managerRegistry = $managerRegistry;
|
||||
+ $this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
- $entityManager = $this->managerRegistry->getManager();
|
||||
- $someRepository = $entityManager->getRepository('Some');
|
||||
+ $someRepository = $this->entityManager->getRepository('Some');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## MoveCurrentDateTimeDefaultInEntityToConstructorRector
|
||||
|
||||
Move default value for entity property to constructor, the safest place
|
||||
|
@ -465,6 +428,8 @@ Remove empty Table attribute on entities because it's useless
|
|||
- class: [`Rector\Doctrine\Rector\Class_\RemoveEmptyTableAttributeRector`](../src/Rector/Class_/RemoveEmptyTableAttributeRector.php)
|
||||
|
||||
```diff
|
||||
<?php
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
-#[ORM\Table]
|
||||
|
@ -597,15 +562,12 @@ Change ServiceEntityRepository to dependency injection, with repository property
|
|||
final class ProjectRepository extends ServiceEntityRepository
|
||||
{
|
||||
- public function __construct(ManagerRegistry $registry)
|
||||
+ /**
|
||||
+ * @var \Doctrine\ORM\EntityManagerInterface
|
||||
+ */
|
||||
+ private $entityManager;
|
||||
+ private \Doctrine\ORM\EntityManagerInterface $entityManager;
|
||||
+
|
||||
+ /**
|
||||
+ * @var \Doctrine\ORM\EntityRepository<Project>
|
||||
+ */
|
||||
+ private $repository;
|
||||
+ private \Doctrine\ORM\EntityRepository $repository;
|
||||
+
|
||||
+ public function __construct(\Doctrine\ORM\EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
|
|
@ -16,18 +16,24 @@ final class RemoveEmptyTableAttributeRector extends AbstractRector
|
|||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition("Remove empty Table attribute on entities because it's useless", [new CodeSample(<<<'CODE_SAMPLE'
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
<?php
|
||||
|
||||
#[ORM\Table]
|
||||
#[ORM\Entity]
|
||||
namespace RectorPrefix202305;
|
||||
|
||||
use RectorPrefix202305\Doctrine\ORM\Mapping as ORM;
|
||||
#[\Doctrine\ORM\Mapping\Table]
|
||||
#[\Doctrine\ORM\Mapping\Entity]
|
||||
class Product
|
||||
{
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
<?php
|
||||
|
||||
#[ORM\Entity]
|
||||
namespace RectorPrefix202305;
|
||||
|
||||
use RectorPrefix202305\Doctrine\ORM\Mapping as ORM;
|
||||
#[\Doctrine\ORM\Mapping\Entity]
|
||||
class Product
|
||||
{
|
||||
}
|
||||
|
@ -46,23 +52,23 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$removed = \false;
|
||||
foreach ($node->attrGroups as $attrGroup) {
|
||||
foreach ($attrGroup->attrs as $attribute) {
|
||||
$hasChanged = \false;
|
||||
foreach ($node->attrGroups as $attrGroupKey => $attrGroup) {
|
||||
foreach ($attrGroup->attrs as $key => $attribute) {
|
||||
if (!$this->nodeNameResolver->isName($attribute, 'Doctrine\\ORM\\Mapping\\Table')) {
|
||||
continue;
|
||||
}
|
||||
if ($attribute->args !== []) {
|
||||
continue;
|
||||
}
|
||||
$this->removeNode($attribute);
|
||||
unset($attrGroup->attrs[$key]);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
if ($attrGroup->attrs === []) {
|
||||
$this->removeNode($attrGroup);
|
||||
$removed = \true;
|
||||
unset($node->attrGroups[$attrGroupKey]);
|
||||
}
|
||||
}
|
||||
if ($removed) {
|
||||
if ($hasChanged) {
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user