Skip to content

Commit 28386ca

Browse files
committed
Update docs and run Rector, Duster, and PHPStan
1 parent 32ac513 commit 28386ca

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

docs/rector_rules_overview.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 70 Rules Overview
1+
# 71 Rules Overview
22

33
## AbortIfRector
44

@@ -63,8 +63,6 @@ Adds the `@extends` annotation to Factories.
6363

6464
Add generic return type to relations in child of `Illuminate\Database\Eloquent\Model`
6565

66-
:wrench: **configure it!**
67-
6866
- class: [`RectorLaravel\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector`](../src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php)
6967

7068
```diff

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ parameters:
2929
- '#Parameter \#1 \$node (.*?) of method RectorLaravel\\(.*?)\:\:(refactor|refactorWithScope)\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method Rector\\Contract\\Rector\\RectorInterface\:\:refactor\(\)#'
3030

3131
- '#Parameter \#1 \$className of method Rector\\Reflection\\ReflectionResolver\:\:resolveMethodReflection\(\) expects class\-string, string given#'
32+
33+
# Laravel Container not being recognized properly in some of the tests
34+
- '#Call to method needs\(\) on an unknown class Illuminate\\Contracts\\Container\\ContextualBindingBuilder#'

src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ private function getGenericTypes(string $relatedClass, ?string $childClass, ?str
477477

478478
private function setShouldUseNewGenerics(): void
479479
{
480-
$laravelVersion = new ReflectionClassConstant($this->applicationClass, 'VERSION');
480+
$reflectionClassConstant = new ReflectionClassConstant($this->applicationClass, 'VERSION');
481481

482-
if (is_string($laravelVersion->getValue())) {
483-
$this->shouldUseNewGenerics = version_compare($laravelVersion->getValue(), '11.15.0', '>=');
482+
if (is_string($reflectionClassConstant->getValue())) {
483+
$this->shouldUseNewGenerics = version_compare($reflectionClassConstant->getValue(), '11.15.0', '>=');
484484
}
485485
}
486486
}

0 commit comments

Comments
 (0)