Skip to content

Commit

Permalink
Updated Rector to commit 9d781bb
Browse files Browse the repository at this point in the history
rectorphp/rector-src@9d781bb Do not run  on properties with attributes (#1694)
  • Loading branch information
TomasVotruba committed Jan 18, 2022
1 parent c00c31f commit 7a85fbd
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Rector\Core\Rector\AbstractRector;
use Rector\Privatization\NodeFactory\ClassConstantFactory;
use Rector\Privatization\NodeReplacer\PropertyFetchWithConstFetchReplacer;
use RectorPrefix20220118\Symplify\PHPStanRules\Reflection\PropertyAnalyzer;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
Expand Down Expand Up @@ -124,6 +125,12 @@ private function shouldSkip(\PhpParser\Node\Stmt\Property $property) : bool
if (!$classLike instanceof \PhpParser\Node\Stmt\Class_) {
return \true;
}
return $this->isObjectType($classLike, new \PHPStan\Type\ObjectType('PHP_CodeSniffer\\Sniffs\\Sniff'));
if ($property->attrGroups !== []) {
return \true;
}
if ($this->isObjectType($classLike, new \PHPStan\Type\ObjectType('PHP_CodeSniffer\\Sniffs\\Sniff'))) {
return \true;
}
return \false;
}
}
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '1c7460bcfc2201edd90ab0e7bae066ed53980b2f';
public const PACKAGE_VERSION = '9d781bb466dae354125382ff73302c094acf0bf1';
/**
* @var string
*/
public const RELEASE_DATE = '2022-01-18 08:47:31';
public const RELEASE_DATE = '2022-01-18 11:23:54';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20220118\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c::getLoader();
return ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee::getLoader();
14 changes: 7 additions & 7 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c
class ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee
{
private static $loader;

Expand All @@ -22,15 +22,15 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee', '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\ComposerStaticInit88019c3ee5c40b6181ed2f3b73650f4c::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit1a7fdf2dc5a09523f3e07d3a96ae45ee::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
Expand All @@ -42,12 +42,12 @@ public static function getLoader()
$loader->register(true);

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit88019c3ee5c40b6181ed2f3b73650f4c::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit1a7fdf2dc5a09523f3e07d3a96ae45ee::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire88019c3ee5c40b6181ed2f3b73650f4c($fileIdentifier, $file);
composerRequire1a7fdf2dc5a09523f3e07d3a96ae45ee($fileIdentifier, $file);
}

return $loader;
Expand All @@ -59,7 +59,7 @@ public static function getLoader()
* @param string $file
* @return void
*/
function composerRequire88019c3ee5c40b6181ed2f3b73650f4c($fileIdentifier, $file)
function composerRequire1a7fdf2dc5a09523f3e07d3a96ae45ee($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit88019c3ee5c40b6181ed2f3b73650f4c
class ComposerStaticInit1a7fdf2dc5a09523f3e07d3a96ae45ee
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
Expand Down Expand Up @@ -3870,9 +3870,9 @@ class ComposerStaticInit88019c3ee5c40b6181ed2f3b73650f4c
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit88019c3ee5c40b6181ed2f3b73650f4c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit88019c3ee5c40b6181ed2f3b73650f4c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit88019c3ee5c40b6181ed2f3b73650f4c::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit1a7fdf2dc5a09523f3e07d3a96ae45ee::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1a7fdf2dc5a09523f3e07d3a96ae45ee::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1a7fdf2dc5a09523f3e07d3a96ae45ee::$classMap;

}, null, ClassLoader::class);
}
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2165,12 +2165,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
"reference": "2b82f7eba4ec9c9a3059076a2dc176310aa5a274"
"reference": "22517c3f026c0e938fe0132c2d50af7c10168bac"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/2b82f7eba4ec9c9a3059076a2dc176310aa5a274",
"reference": "2b82f7eba4ec9c9a3059076a2dc176310aa5a274",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/22517c3f026c0e938fe0132c2d50af7c10168bac",
"reference": "22517c3f026c0e938fe0132c2d50af7c10168bac",
"shasum": ""
},
"require": {
Expand All @@ -2195,7 +2195,7 @@
"symplify\/rule-doc-generator": "^10.0",
"symplify\/vendor-patches": "^10.0"
},
"time": "2022-01-17T15:16:46+00:00",
"time": "2022-01-18T08:36:41+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d1fa93d'), '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 2b82f7e'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main df58e86'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6bee428'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbfa93c'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f23c4bf'), '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 5a8c2a8'), '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 57743a8'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d4a362b'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d1fa93d'), '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 22517c3'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main df58e86'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6bee428'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbfa93c'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f23c4bf'), '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 5a8c2a8'), '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 57743a8'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d4a362b'));
private function __construct()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Doctrine\NodeAnalyzer\AttributeFinder;
use Rector\Doctrine\PhpDoc\ShortClassExpander;
Expand Down Expand Up @@ -59,18 +58,24 @@ public function resolve(\PhpParser\Node\Stmt\Property $property) : ?\PHPStan\Typ
return $this->processToManyRelation($property, $toManyRelationTagValueNode);
}
$targetEntity = $this->attributeFinder->findAttributeByClassesArgByName($property, self::TO_MANY_ANNOTATION_CLASSES, 'targetEntity');
if (!$targetEntity instanceof \PhpParser\Node\Expr) {
return null;
}
return $this->resolveTypeFromTargetEntity($targetEntity, $property);
}
private function processToManyRelation(\PhpParser\Node\Stmt\Property $property, \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode) : \PHPStan\Type\Type
/**
* @return \PHPStan\Type\Type|null
*/
private function processToManyRelation(\PhpParser\Node\Stmt\Property $property, \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode)
{
$targetEntity = $doctrineAnnotationTagValueNode->getValueWithoutQuotes('targetEntity');
if (!\is_string($targetEntity) && $targetEntity !== null) {
throw new \Rector\Core\Exception\ShouldNotHappenException();
if (!\is_string($targetEntity)) {
return null;
}
return $this->resolveTypeFromTargetEntity($targetEntity, $property);
}
/**
* @param \PhpParser\Node\Expr|string|null $targetEntity
* @param \PhpParser\Node\Expr|string $targetEntity
*/
private function resolveTypeFromTargetEntity($targetEntity, \PhpParser\Node\Stmt\Property $property) : \PHPStan\Type\Type
{
Expand Down
10 changes: 5 additions & 5 deletions vendor/scoper-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220118\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c', false) && !interface_exists('ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c', false) && !trait_exists('ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c', false)) {
spl_autoload_call('RectorPrefix20220118\ComposerAutoloaderInit88019c3ee5c40b6181ed2f3b73650f4c');
if (!class_exists('ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee', false) && !interface_exists('ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee', false) && !trait_exists('ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee', false)) {
spl_autoload_call('RectorPrefix20220118\ComposerAutoloaderInit1a7fdf2dc5a09523f3e07d3a96ae45ee');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20220118\Helmich\TypoScriptParser\Parser\AST\Statement');
Expand Down Expand Up @@ -71,9 +71,9 @@ function print_node() {
return \RectorPrefix20220118\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire88019c3ee5c40b6181ed2f3b73650f4c')) {
function composerRequire88019c3ee5c40b6181ed2f3b73650f4c() {
return \RectorPrefix20220118\composerRequire88019c3ee5c40b6181ed2f3b73650f4c(...func_get_args());
if (!function_exists('composerRequire1a7fdf2dc5a09523f3e07d3a96ae45ee')) {
function composerRequire1a7fdf2dc5a09523f3e07d3a96ae45ee() {
return \RectorPrefix20220118\composerRequire1a7fdf2dc5a09523f3e07d3a96ae45ee(...func_get_args());
}
}
if (!function_exists('scanPath')) {
Expand Down

0 comments on commit 7a85fbd

Please sign in to comment.