mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit d88e3a3efb
d88e3a3efb
Fix copy-paste errors in rule docs (#143)
This commit is contained in:
parent
09dbb728dd
commit
f04617a297
|
@ -64,7 +64,7 @@ final class ManualJsonStringToJsonEncodeArrayRector extends \Rector\Core\Rector\
|
|||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Add extra space before new assign set', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Convert manual JSON string to JSON::encode array', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function run()
|
||||
|
|
|
@ -21,7 +21,7 @@ final class DowngradeFlexibleHeredocSyntaxRector extends \Rector\Core\Rector\Abs
|
|||
private const HERENOW_DOC_KINDS = [\PhpParser\Node\Scalar\String_::KIND_HEREDOC, \PhpParser\Node\Scalar\String_::KIND_NOWDOC];
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Changes heredoc/nowdoc that contains closing word to safe wrapper name', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Remove indentation from heredoc/nowdoc', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
$query = <<<SQL
|
||||
SELECT *
|
||||
FROM `table`
|
||||
|
|
|
@ -27,7 +27,7 @@ final class ChangeOrIfContinueToMultiContinueRector extends \Rector\Core\Rector\
|
|||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Changes if && to early return', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Changes if || to early return', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function canDrive(Car $newCar)
|
||||
|
|
|
@ -55,7 +55,7 @@ final class RenameParamToMatchTypeRector extends \Rector\Core\Rector\AbstractRec
|
|||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Rename variable to match new ClassType', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Rename param to match ClassType', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function run(Apple $pie)
|
||||
|
|
|
@ -15,7 +15,7 @@ final class VarToPublicPropertyRector extends \Rector\Core\Rector\AbstractRector
|
|||
{
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Remove unused private method', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Change property modifier from `var` to `public`', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeController
|
||||
{
|
||||
var $name = 'Tom';
|
||||
|
|
|
@ -27,7 +27,7 @@ final class ExceptionHandlerTypehintRector extends \Rector\Core\Rector\AbstractR
|
|||
private const HANDLE_INSENSITIVE_REGEX = '#handle#i';
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Changes property `@var` annotations from annotation to type.', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Change typehint from `Exception` to `Throwable`.', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
function handler(Exception $exception) { ... }
|
||||
set_exception_handler('handler');
|
||||
CODE_SAMPLE
|
||||
|
|
|
@ -35,7 +35,7 @@ final class TokenGetAllToObjectRector extends \Rector\Core\Rector\AbstractRector
|
|||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Complete missing constructor dependency instance by type', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Convert `token_get_all` to `PhpToken::getAll`', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function run()
|
||||
|
|
|
@ -29,7 +29,7 @@ final class ReturnTypeFromReturnNewRector extends \Rector\Core\Rector\AbstractRe
|
|||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Add return type void to function like without any return', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Add return type to function like with return new', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function action()
|
||||
|
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'd519a197b47f6b9fb037238213f1ad80914c276c';
|
||||
public const PACKAGE_VERSION = 'd88e3a3efb79409621df12a5877c992a7c0ea73a';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-02 17:56:10';
|
||||
public const RELEASE_DATE = '2021-06-03 00:45:35';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210602\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493::getLoader();
|
||||
return ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994::getLoader();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493
|
||||
class ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994', '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\ComposerStaticInit923d4994c1e97b5d58c932ebc2a8c493::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0abd78ec23fc40566ea0c4eaaab61994::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit923d4994c1e97b5d58c932ebc2a8c493::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit0abd78ec23fc40566ea0c4eaaab61994::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire923d4994c1e97b5d58c932ebc2a8c493($fileIdentifier, $file);
|
||||
composerRequire0abd78ec23fc40566ea0c4eaaab61994($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire923d4994c1e97b5d58c932ebc2a8c493($fileIdentifier, $file)
|
||||
function composerRequire0abd78ec23fc40566ea0c4eaaab61994($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit923d4994c1e97b5d58c932ebc2a8c493
|
||||
class ComposerStaticInit0abd78ec23fc40566ea0c4eaaab61994
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -3869,9 +3869,9 @@ class ComposerStaticInit923d4994c1e97b5d58c932ebc2a8c493
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit923d4994c1e97b5d58c932ebc2a8c493::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit923d4994c1e97b5d58c932ebc2a8c493::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit923d4994c1e97b5d58c932ebc2a8c493::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0abd78ec23fc40566ea0c4eaaab61994::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0abd78ec23fc40566ea0c4eaaab61994::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0abd78ec23fc40566ea0c4eaaab61994::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
|
@ -450,17 +450,17 @@
|
|||
},
|
||||
{
|
||||
"name": "idiosyncratic\/editorconfig",
|
||||
"version": "0.1.2",
|
||||
"version_normalized": "0.1.2.0",
|
||||
"version": "0.1.3",
|
||||
"version_normalized": "0.1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/idiosyncratic-code\/editorconfig-php.git",
|
||||
"reference": "a85e155129e969c931743e6bb00e68822edd88bc"
|
||||
"reference": "3445fa4a1e00f95630d4edc729c2effb116db19b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/idiosyncratic-code\/editorconfig-php\/zipball\/a85e155129e969c931743e6bb00e68822edd88bc",
|
||||
"reference": "a85e155129e969c931743e6bb00e68822edd88bc",
|
||||
"url": "https:\/\/api.github.com\/repos\/idiosyncratic-code\/editorconfig-php\/zipball\/3445fa4a1e00f95630d4edc729c2effb116db19b",
|
||||
"reference": "3445fa4a1e00f95630d4edc729c2effb116db19b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -475,7 +475,7 @@
|
|||
"phpunit\/phpunit": "^9.5",
|
||||
"sebastian\/phpcpd": "^6.0"
|
||||
},
|
||||
"time": "2021-05-31T23:55:39+00:00",
|
||||
"time": "2021-06-02T16:24:34+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -496,7 +496,7 @@
|
|||
"description": "PHP implementation of EditorConfig",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/idiosyncratic-code\/editorconfig-php\/issues",
|
||||
"source": "https:\/\/github.com\/idiosyncratic-code\/editorconfig-php\/tree\/0.1.2"
|
||||
"source": "https:\/\/github.com\/idiosyncratic-code\/editorconfig-php\/tree\/0.1.3"
|
||||
},
|
||||
"install-path": "..\/idiosyncratic\/editorconfig"
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [0.1.3] - 2021-06-02
|
||||
### Fixed
|
||||
- Fixed issues with globbing files on Windows
|
||||
|
||||
## [0.1.2] - 2021-05-31
|
||||
### Fixed
|
||||
- Upated dependencies
|
||||
- Updated dependencies
|
||||
- Dev dependencies now support PHP8
|
||||
|
||||
## [0.1.1] - 2021-05-03
|
||||
|
|
|
@ -13,6 +13,7 @@ use function implode;
|
|||
use function preg_match;
|
||||
use function preg_match_all;
|
||||
use function sprintf;
|
||||
use function str_replace;
|
||||
use const PREG_SET_ORDER;
|
||||
final class Section
|
||||
{
|
||||
|
@ -47,6 +48,9 @@ final class Section
|
|||
}
|
||||
public function matches(string $path) : bool
|
||||
{
|
||||
// normalize path to unix-style directory separator,
|
||||
// because the glob pattern assumes linux-style directory separators
|
||||
$path = \str_replace('\\', '/', $path);
|
||||
if (\preg_match('#{(.*)}#', $this->glob) === 1) {
|
||||
return $this->matchesWithCurlBracesExpansion($path);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,11 @@ class SectionTest extends \RectorPrefix20210602\PHPUnit\Framework\TestCase
|
|||
$this->assertEquals(4, $section->indent_size->getValue());
|
||||
$this->assertFalse(isset($section->tab_width));
|
||||
}
|
||||
public function testMatchingWindowsPath() : void
|
||||
{
|
||||
$section = new \RectorPrefix20210602\Idiosyncratic\EditorConfig\Section('**/', '*.php', ['indent_size' => '4', 'indent_style' => 'space'], new \RectorPrefix20210602\Idiosyncratic\EditorConfig\Declaration\Factory());
|
||||
$this->assertTrue($section->matches('my\\composer.php'));
|
||||
}
|
||||
public function testGetMissingDeclaration() : void
|
||||
{
|
||||
$section = new \RectorPrefix20210602\Idiosyncratic\EditorConfig\Section('**/', '*.php', ['indent_size' => '4', 'indent_style' => 'space'], new \RectorPrefix20210602\Idiosyncratic\EditorConfig\Declaration\Factory());
|
||||
|
|
|
@ -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('RectorPrefix20210602\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493', false) && !interface_exists('ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493', false) && !trait_exists('ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493', false)) {
|
||||
spl_autoload_call('RectorPrefix20210602\ComposerAutoloaderInit923d4994c1e97b5d58c932ebc2a8c493');
|
||||
if (!class_exists('ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994', false) && !interface_exists('ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994', false) && !trait_exists('ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994', false)) {
|
||||
spl_autoload_call('RectorPrefix20210602\ComposerAutoloaderInit0abd78ec23fc40566ea0c4eaaab61994');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210602\Doctrine\Inflector\Inflector');
|
||||
|
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210602\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire923d4994c1e97b5d58c932ebc2a8c493')) {
|
||||
function composerRequire923d4994c1e97b5d58c932ebc2a8c493() {
|
||||
return \RectorPrefix20210602\composerRequire923d4994c1e97b5d58c932ebc2a8c493(...func_get_args());
|
||||
if (!function_exists('composerRequire0abd78ec23fc40566ea0c4eaaab61994')) {
|
||||
function composerRequire0abd78ec23fc40566ea0c4eaaab61994() {
|
||||
return \RectorPrefix20210602\composerRequire0abd78ec23fc40566ea0c4eaaab61994(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue