1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 19:04:29 +02:00

feat(phpstan): foundation for usage in extensions (#3666)

* feat(phpstan): pick up extended model relations typings
* feat(phpstan): pick up extended model date attributes
* feat(core): introduce `castAttribute` extender
Stops using `dates` as it's deprecated in laravel 8
* feat(phpstan): pick up extended model attributes through casts
* fix: extenders not resolved when declared namespace
* fix(phpstan): new model attributes are always nullable
* chore(phpstan): add helpful cache clearing command
* Apply fixes from StyleCI
* chore: improve extend files provider logic
* chore: rename `castAttribute` to just `cast`
* chore: update phpstan package to detect `cast` method
* Update framework/core/src/Extend/Model.php

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
Sami Mazouz
2023-01-15 15:25:13 +01:00
committed by GitHub
parent 2d2bf5c504
commit 5fe3cfd837
15 changed files with 934 additions and 28 deletions

View File

@@ -15,3 +15,27 @@ parameters:
- stubs/Illuminate/Contracts/Filesystem/Factory.stub
- stubs/Illuminate/Contracts/Filesystem/Cloud.stub
- stubs/Illuminate/Contracts/Filesystem/Filesystem.stub
services:
-
class: Flarum\PHPStan\Relations\ModelRelationsExtension
tags:
- phpstan.broker.methodsClassReflectionExtension
- phpstan.broker.propertiesClassReflectionExtension
-
class: Flarum\PHPStan\Attributes\ModelDateAttributesExtension
tags:
- phpstan.broker.propertiesClassReflectionExtension
-
class: Flarum\PHPStan\Attributes\ModelCastAttributeExtension
tags:
- phpstan.broker.propertiesClassReflectionExtension
-
class: Flarum\PHPStan\Extender\FilesProvider
arguments:
- %paths%
-
class: Flarum\PHPStan\Extender\Resolver
arguments:
- @Flarum\PHPStan\Extender\FilesProvider
- @defaultAnalysisParser