mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 16:30:51 +00:00
bump docs
This commit is contained in:
parent
e6894a9d1b
commit
7607da6751
|
@ -1,4 +1,4 @@
|
|||
# 476 Rules Overview
|
||||
# 477 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -40,6 +40,8 @@
|
|||
|
||||
- [EarlyReturn](#earlyreturn) (11)
|
||||
|
||||
- [Generics](#generics) (1)
|
||||
|
||||
- [LeagueEvent](#leagueevent) (1)
|
||||
|
||||
- [MockeryToProphecy](#mockerytoprophecy) (2)
|
||||
|
@ -5848,6 +5850,51 @@ Changes Single return of || to early returns
|
|||
|
||||
<br>
|
||||
|
||||
## Generics
|
||||
|
||||
### GenericClassMethodParamRector
|
||||
|
||||
Make class methods generic based on implemented interface
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\Generics\Rector\ClassMethod\GenericClassMethodParamRector`](../rules/Generics/Rector/ClassMethod/GenericClassMethodParamRector.php)
|
||||
|
||||
```php
|
||||
use Rector\Generics\Rector\ClassMethod\GenericClassMethodParamRector;
|
||||
use Rector\Generics\ValueObject\GenericClassMethodParam;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(GenericClassMethodParamRector::class)
|
||||
->call('configure', [[
|
||||
GenericClassMethodParamRector::GENERIC_CLASS_METHOD_PARAMS => ValueObjectInliner::inline([
|
||||
new GenericClassMethodParam('SomeInterface', 'getParams', 0, 'ParamInterface'),
|
||||
]),
|
||||
]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
final class SomeClass implements SomeInterface
|
||||
{
|
||||
- private method getParams(SomeSpecificType $someParam)
|
||||
+ /**
|
||||
+ * @param SomeSpecificType $someParam
|
||||
+ */
|
||||
+ public method getParams(ParamInterface $someParam)
|
||||
{
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## LeagueEvent
|
||||
|
||||
### DispatchStringToObjectRector
|
||||
|
|
|
@ -176,7 +176,9 @@ CODE_SAMPLE
|
|||
|
||||
/** @var String_ $string */
|
||||
$string = $arg->value;
|
||||
$string->value = Strings::replace($string->value, self::INNER_REGEX, function (array $match) use (&$string): string {
|
||||
$string->value = Strings::replace($string->value, self::INNER_REGEX, function (array $match) use (
|
||||
&$string
|
||||
): string {
|
||||
$printedString = $this->betterStandardPrinter->print($string);
|
||||
if (Strings::match($printedString, self::DOUBLE_QUOTED_REGEX)) {
|
||||
$string->setAttribute(AttributeKey::IS_REGULAR_PATTERN, true);
|
||||
|
|
|
@ -130,9 +130,7 @@ CODE_SAMPLE
|
|||
|
||||
private function isInLoopWithoutContinueOrBreak(If_ $if): bool
|
||||
{
|
||||
if (!$this->contextAnalyzer->isInLoop(
|
||||
$if
|
||||
)) {
|
||||
if (! $this->contextAnalyzer->isInLoop($if)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user