Skip to content

Separate Larastan config #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions larastan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
parameters:
scopeClass: NunoMaduro\Larastan\Analyser\Scope
universalObjectCratesClasses:
- Illuminate\Database\Eloquent\Model
- Illuminate\Http\Resources\Json\JsonResource
- Illuminate\Http\Request
- Illuminate\Contracts\Auth\Authenticatable
excludes_analyse:
- *.blade.php
ignoreErrors:
#- '#Result of function abort \(void\) is used#'
#- '#Call to an undefined method Illuminate\\Support\\HigherOrder#'
#- '#Method App\\Exceptions\\Handler::render\(\) should return Illuminate\\Http\\Response but returns Symfony\\Component\\HttpFoundation\\Response#'
#- '#Property App\\Http\\Middleware\\TrustProxies::\$headers \(string\) does not accept default value of type int#'
# Ignore error from issue #244
#- '#Cannot call method viaRequest\(\) on Illuminate\\Auth\\AuthManager\|null\.#'
services:
-
class: NunoMaduro\Larastan\Methods\Extension
tags:
- phpstan.broker.methodsClassReflectionExtension

-
class: NunoMaduro\Larastan\Properties\Extension
tags:
- phpstan.broker.propertiesClassReflectionExtension

-
class: NunoMaduro\Larastan\ReturnTypes\ModelExtension
tags:
- phpstan.broker.dynamicStaticMethodReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\AuthExtension
tags:
- phpstan.broker.dynamicStaticMethodReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\RequestExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\CookieExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\ResponseExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\RequestExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\RedirectExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\UrlExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\ViewExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\TransExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
85 changes: 2 additions & 83 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
includes:
- larastan.neon
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering, can't we just reference the config shipped with larastan that way? 🤷‍♀️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to experiment with it. Actually I promote phpstan, I'm not a graphql user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vendor/nunomaduro/larastan/extension.neon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know how to un-ignore errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know how to un-ignore errors.

Ahh. I guess that what the reason in the first place why I assimilated it.

parameters:
### This library
level: max
paths:
- %currentWorkingDirectory%/src/
- %currentWorkingDirectory%/tests/
### Larastan
scopeClass: NunoMaduro\Larastan\Analyser\Scope
universalObjectCratesClasses:
- Illuminate\Database\Eloquent\Model
- Illuminate\Http\Resources\Json\JsonResource
- Illuminate\Http\Request
- Illuminate\Contracts\Auth\Authenticatable
excludes_analyse:
### This library
- %currentWorkingDirectory%/tests/Support/database/
### Larastan
- *.blade.php
ignoreErrors:
### This library
- '/Call to an undefined method Rebing\\GraphQL\\Tests\\TestCaseDatabase::setupSqlAssertionTrait\(\)/'
- '/Class Orchestra\\Database\\ConsoleServiceProvider not found/'
- '/Parameter #3 \$subject of function str_replace expects array\|string, string\|false given/'
Expand Down Expand Up @@ -52,76 +42,5 @@ parameters:
- '/Anonymous function should return string but returns string\|false/'
# tests/Unit/UploadTests/UploadSingleFileMutation.php
- '/Method Rebing\\GraphQL\\Tests\\Unit\\UploadTests\\UploadSingleFileMutation::resolve\(\) should return string but returns string\|false/'
### Larastan ; manually disable the ones reported
#- '#Result of function abort \(void\) is used#'
#- '#Call to an undefined method Illuminate\\Support\\HigherOrder#'
#- '#Method App\\Exceptions\\Handler::render\(\) should return Illuminate\\Http\\Response but returns Symfony\\Component\\HttpFoundation\\Response#'
#- '#Property App\\Http\\Middleware\\TrustProxies::\$headers \(string\) does not accept default value of type int#'
# Ignore error from issue #244
#- '#Cannot call method viaRequest\(\) on Illuminate\\Auth\\AuthManager\|null\.#'
# From Larastan but path changed
bootstrap: %currentWorkingDirectory%/vendor/nunomaduro/larastan/bootstrap.php
# From Larastan but changed to true
reportUnmatchedIgnoredErrors: true

### Below here only Larastan defaults
services:
-
class: NunoMaduro\Larastan\Methods\Extension
tags:
- phpstan.broker.methodsClassReflectionExtension

-
class: NunoMaduro\Larastan\Properties\Extension
tags:
- phpstan.broker.propertiesClassReflectionExtension

-
class: NunoMaduro\Larastan\ReturnTypes\ModelExtension
tags:
- phpstan.broker.dynamicStaticMethodReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\AuthExtension
tags:
- phpstan.broker.dynamicStaticMethodReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\RequestExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\CookieExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\ResponseExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\RequestExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\RedirectExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\UrlExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\ViewExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: NunoMaduro\Larastan\ReturnTypes\Helpers\TransExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension