fix(phpstab): adapt phpstan package for extension use (#3727)

- fix "Stub file does not exist" error message as reported in
  <https://github.com/flarum/docs/pull/441#issuecomment-1419668760>
- fix "Ignored error pattern was not matched in reported errors" error
  messages as reported in
  <https://github.com/flarum/docs/pull/441#issuecomment-1420903036>
This commit is contained in:
Nicolas Peugnet 2023-02-08 10:43:41 +01:00 committed by GitHub
parent 5717a74fcc
commit f9a5d485c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 37 deletions

View File

@ -1,36 +1,36 @@
parameters:
stubFiles:
- ../../vendor/nunomaduro/larastan/stubs/Enumerable.stub
- ../../vendor/nunomaduro/larastan/stubs/EloquentBuilder.stub
- ../../vendor/nunomaduro/larastan/stubs/Collection.stub
- ../../vendor/nunomaduro/larastan/stubs/EloquentCollection.stub
- ../../vendor/nunomaduro/larastan/stubs/Factory.stub
- ../../vendor/nunomaduro/larastan/stubs/Model.stub
- ../../vendor/nunomaduro/larastan/stubs/Gate.stub
- ../../vendor/nunomaduro/larastan/stubs/Relation.stub
- ../../vendor/nunomaduro/larastan/stubs/BelongsTo.stub
- ../../vendor/nunomaduro/larastan/stubs/BelongsToMany.stub
- ../../vendor/nunomaduro/larastan/stubs/HasOneOrMany.stub
- ../../vendor/nunomaduro/larastan/stubs/HasMany.stub
- ../../vendor/nunomaduro/larastan/stubs/HasOne.stub
- ../../vendor/nunomaduro/larastan/stubs/HasOneThrough.stub
- ../../vendor/nunomaduro/larastan/stubs/HasManyThrough.stub
- ../../vendor/nunomaduro/larastan/stubs/Mailable.stub
- ../../vendor/nunomaduro/larastan/stubs/MorphOne.stub
- ../../vendor/nunomaduro/larastan/stubs/MorphOneOrMany.stub
- ../../vendor/nunomaduro/larastan/stubs/MorphTo.stub
- ../../vendor/nunomaduro/larastan/stubs/MorphToMany.stub
- ../../vendor/nunomaduro/larastan/stubs/MorphMany.stub
- ../../vendor/nunomaduro/larastan/stubs/Helpers.stub
- ../../vendor/nunomaduro/larastan/stubs/HigherOrderProxies.stub
- ../../vendor/nunomaduro/larastan/stubs/QueryBuilder.stub
- ../../vendor/nunomaduro/larastan/stubs/Facades.stub
- ../../vendor/nunomaduro/larastan/stubs/Pagination.stub
- ../../vendor/nunomaduro/larastan/stubs/Contracts/Pagination.stub
- ../../vendor/nunomaduro/larastan/stubs/Contracts/Support.stub
- ../../vendor/nunomaduro/larastan/stubs/Redis/Connection.stub
- ../../vendor/nunomaduro/larastan/stubs/Logger.stub
- ../../vendor/nunomaduro/larastan/stubs/EnumeratesValues.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Enumerable.stub
- %rootDir%/../../nunomaduro/larastan/stubs/EloquentBuilder.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Collection.stub
- %rootDir%/../../nunomaduro/larastan/stubs/EloquentCollection.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Factory.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Model.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Gate.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Relation.stub
- %rootDir%/../../nunomaduro/larastan/stubs/BelongsTo.stub
- %rootDir%/../../nunomaduro/larastan/stubs/BelongsToMany.stub
- %rootDir%/../../nunomaduro/larastan/stubs/HasOneOrMany.stub
- %rootDir%/../../nunomaduro/larastan/stubs/HasMany.stub
- %rootDir%/../../nunomaduro/larastan/stubs/HasOne.stub
- %rootDir%/../../nunomaduro/larastan/stubs/HasOneThrough.stub
- %rootDir%/../../nunomaduro/larastan/stubs/HasManyThrough.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Mailable.stub
- %rootDir%/../../nunomaduro/larastan/stubs/MorphOne.stub
- %rootDir%/../../nunomaduro/larastan/stubs/MorphOneOrMany.stub
- %rootDir%/../../nunomaduro/larastan/stubs/MorphTo.stub
- %rootDir%/../../nunomaduro/larastan/stubs/MorphToMany.stub
- %rootDir%/../../nunomaduro/larastan/stubs/MorphMany.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Helpers.stub
- %rootDir%/../../nunomaduro/larastan/stubs/HigherOrderProxies.stub
- %rootDir%/../../nunomaduro/larastan/stubs/QueryBuilder.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Facades.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Pagination.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Contracts/Pagination.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Contracts/Support.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Redis/Connection.stub
- %rootDir%/../../nunomaduro/larastan/stubs/Logger.stub
- %rootDir%/../../nunomaduro/larastan/stubs/EnumeratesValues.stub
universalObjectCratesClasses:
- Illuminate\Http\Request
earlyTerminatingFunctionCalls:

View File

@ -1,17 +1,23 @@
parameters:
ignoreErrors:
# Remove this group below with larastan 2.0 (i.e Flarum 2.0)
- "#Relation '[A-z_-]+' is not found in [A-z\_]+ model.#"
- '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:union\(\) expects [A-z_<> .,|\\]+ given\.$#'
- '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:joinSub\(\) expects [A-z_<> .,|\\]+ given\.$#'
- message: "#Relation '[A-z_-]+' is not found in [A-z\_]+ model.#"
reportUnmatched: false
- message: '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:union\(\) expects [A-z_<> .,|\\]+ given\.$#'
reportUnmatched: false
- message: '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:joinSub\(\) expects [A-z_<> .,|\\]+ given\.$#'
reportUnmatched: false
# We ignore this because resolve can either take a class name as the generic return type or just a binding name.
- "#Template type T of function resolve[()]{2} is not referenced in a parameter.#"
- message: "#Template type T of function resolve[()]{2} is not referenced in a parameter.#"
reportUnmatched: false
# We ignore new static errors because we want extensibility.
# @TODO: needs discussion.
- "#^Unsafe usage of new static[()]{2}.$#"
- message: "#^Unsafe usage of new static[()]{2}.$#"
reportUnmatched: false
# ConnectionInterface lacks methods that exist in the implementation,
# yet we don't want to inject the implementation.
- '#^Call to an undefined method Illuminate\\Database\\ConnectionInterface\:\:[A-z0-9_]+\(\)\.$#'
- message: '#^Call to an undefined method Illuminate\\Database\\ConnectionInterface\:\:[A-z0-9_]+\(\)\.$#'
reportUnmatched: false