Skip to content

Commit

Permalink
Update docs and run Rector, Duster, and PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
GeniJaho committed Oct 27, 2024
1 parent 32ac513 commit 28386ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 1 addition & 3 deletions docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 70 Rules Overview
# 71 Rules Overview

## AbortIfRector

Expand Down Expand Up @@ -63,8 +63,6 @@ Adds the `@extends` annotation to Factories.

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

:wrench: **configure it!**

- class: [`RectorLaravel\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector`](../src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php)

```diff
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ parameters:
- '#Parameter \#1 \$node (.*?) of method RectorLaravel\\(.*?)\:\:(refactor|refactorWithScope)\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method Rector\\Contract\\Rector\\RectorInterface\:\:refactor\(\)#'

- '#Parameter \#1 \$className of method Rector\\Reflection\\ReflectionResolver\:\:resolveMethodReflection\(\) expects class\-string, string given#'

# Laravel Container not being recognized properly in some of the tests
- '#Call to method needs\(\) on an unknown class Illuminate\\Contracts\\Container\\ContextualBindingBuilder#'
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,10 @@ private function getGenericTypes(string $relatedClass, ?string $childClass, ?str

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

if (is_string($laravelVersion->getValue())) {
$this->shouldUseNewGenerics = version_compare($laravelVersion->getValue(), '11.15.0', '>=');
if (is_string($reflectionClassConstant->getValue())) {
$this->shouldUseNewGenerics = version_compare($reflectionClassConstant->getValue(), '11.15.0', '>=');
}
}
}

0 comments on commit 28386ca

Please sign in to comment.