bump docs

This commit is contained in:
Tomas Votruba 2021-10-02 15:54:45 +02:00
parent e6894a9d1b
commit 7607da6751
3 changed files with 52 additions and 5 deletions

View File

@ -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

View File

@ -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);

View File

@ -130,9 +130,7 @@ CODE_SAMPLE
private function isInLoopWithoutContinueOrBreak(If_ $if): bool
{
if (!$this->contextAnalyzer->isInLoop(
$if
)) {
if (! $this->contextAnalyzer->isInLoop($if)) {
return false;
}