Add phpstan to help with static analysis

This commit is contained in:
Lance Pioch 2024-03-16 14:19:32 -04:00
parent afc22a2787
commit 6b5e990a1c
3 changed files with 267 additions and 4 deletions

View File

@ -42,6 +42,7 @@
"barryvdh/laravel-ide-helper": "~2.13.0", "barryvdh/laravel-ide-helper": "~2.13.0",
"fakerphp/faker": "~1.21.0", "fakerphp/faker": "~1.21.0",
"itsgoingd/clockwork": "~5.1.12", "itsgoingd/clockwork": "~5.1.12",
"larastan/larastan": "^2.0",
"laravel/pint": "^1.14", "laravel/pint": "^1.14",
"laravel/sail": "~1.21.0", "laravel/sail": "~1.21.0",
"mockery/mockery": "~1.5.1", "mockery/mockery": "~1.5.1",

251
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c54f09cfe2d7f52cd512f711600bdee2", "content-hash": "20a00ec8e157cd0294272aea6ed4d90d",
"packages": [ "packages": [
{ {
"name": "aws/aws-crt-php", "name": "aws/aws-crt-php",
@ -8402,6 +8402,102 @@
], ],
"time": "2022-12-13T00:04:12+00:00" "time": "2022-12-13T00:04:12+00:00"
}, },
{
"name": "larastan/larastan",
"version": "v2.6.4",
"source": {
"type": "git",
"url": "https://github.com/larastan/larastan.git",
"reference": "6c5e8820f3db6397546f3ce48520af9d312aed27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/larastan/larastan/zipball/6c5e8820f3db6397546f3ce48520af9d312aed27",
"reference": "6c5e8820f3db6397546f3ce48520af9d312aed27",
"shasum": ""
},
"require": {
"ext-json": "*",
"illuminate/console": "^9.47.0 || ^10.0.0",
"illuminate/container": "^9.47.0 || ^10.0.0",
"illuminate/contracts": "^9.47.0 || ^10.0.0",
"illuminate/database": "^9.47.0 || ^10.0.0",
"illuminate/http": "^9.47.0 || ^10.0.0",
"illuminate/pipeline": "^9.47.0 || ^10.0.0",
"illuminate/support": "^9.47.0 || ^10.0.0",
"php": "^8.0.2",
"phpmyadmin/sql-parser": "^5.6.0",
"phpstan/phpstan": "~1.10.6"
},
"require-dev": {
"nikic/php-parser": "^4.15.2",
"orchestra/testbench": "^7.19.0 || ^8.0.0",
"phpunit/phpunit": "^9.5.27"
},
"suggest": {
"orchestra/testbench": "Using Larastan for analysing a package needs Testbench"
},
"type": "phpstan-extension",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"autoload": {
"psr-4": {
"NunoMaduro\\Larastan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nuno Maduro",
"email": "enunomaduro@gmail.com"
}
],
"description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel",
"keywords": [
"PHPStan",
"code analyse",
"code analysis",
"larastan",
"laravel",
"package",
"php",
"static analysis"
],
"support": {
"issues": "https://github.com/larastan/larastan/issues",
"source": "https://github.com/larastan/larastan/tree/v2.6.4"
},
"funding": [
{
"url": "https://www.paypal.com/paypalme/enunomaduro",
"type": "custom"
},
{
"url": "https://github.com/canvural",
"type": "github"
},
{
"url": "https://github.com/nunomaduro",
"type": "github"
},
{
"url": "https://www.patreon.com/nunomaduro",
"type": "patreon"
}
],
"time": "2023-07-29T12:13:13+00:00"
},
{ {
"name": "laravel/pint", "name": "laravel/pint",
"version": "v1.14.0", "version": "v1.14.0",
@ -8971,6 +9067,156 @@
}, },
"time": "2022-10-14T12:47:21+00:00" "time": "2022-10-14T12:47:21+00:00"
}, },
{
"name": "phpmyadmin/sql-parser",
"version": "5.9.0",
"source": {
"type": "git",
"url": "https://github.com/phpmyadmin/sql-parser.git",
"reference": "011fa18a4e55591fac6545a821921dd1d61c6984"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/011fa18a4e55591fac6545a821921dd1d61c6984",
"reference": "011fa18a4e55591fac6545a821921dd1d61c6984",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
"symfony/polyfill-mbstring": "^1.3",
"symfony/polyfill-php80": "^1.16"
},
"conflict": {
"phpmyadmin/motranslator": "<3.0"
},
"require-dev": {
"phpbench/phpbench": "^1.1",
"phpmyadmin/coding-standard": "^3.0",
"phpmyadmin/motranslator": "^4.0 || ^5.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.9.12",
"phpstan/phpstan-phpunit": "^1.3.3",
"phpunit/php-code-coverage": "*",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psalm/plugin-phpunit": "^0.16.1",
"vimeo/psalm": "^4.11",
"zumba/json-serializer": "~3.0.2"
},
"suggest": {
"ext-mbstring": "For best performance",
"phpmyadmin/motranslator": "Translate messages to your favorite locale"
},
"bin": [
"bin/highlight-query",
"bin/lint-query",
"bin/sql-parser",
"bin/tokenize-query"
],
"type": "library",
"autoload": {
"psr-4": {
"PhpMyAdmin\\SqlParser\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "The phpMyAdmin Team",
"email": "developers@phpmyadmin.net",
"homepage": "https://www.phpmyadmin.net/team/"
}
],
"description": "A validating SQL lexer and parser with a focus on MySQL dialect.",
"homepage": "https://github.com/phpmyadmin/sql-parser",
"keywords": [
"analysis",
"lexer",
"parser",
"query linter",
"sql",
"sql lexer",
"sql linter",
"sql parser",
"sql syntax highlighter",
"sql tokenizer"
],
"support": {
"issues": "https://github.com/phpmyadmin/sql-parser/issues",
"source": "https://github.com/phpmyadmin/sql-parser"
},
"funding": [
{
"url": "https://www.phpmyadmin.net/donate/",
"type": "other"
}
],
"time": "2024-01-20T20:34:02+00:00"
},
{
"name": "phpstan/phpstan",
"version": "1.10.62",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd5c8a1660ed3540b211407c77abf4af193a6af9",
"reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues",
"security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2024-03-13T12:27:20+00:00"
},
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "10.0.0", "version": "10.0.0",
@ -10656,8 +10902,5 @@
"ext-zip": "*" "ext-zip": "*"
}, },
"platform-dev": [], "platform-dev": [],
"platform-overrides": {
"php": "8.1.0"
},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.6.0"
} }

19
phpstan.neon Normal file
View File

@ -0,0 +1,19 @@
includes:
- vendor/larastan/larastan/extension.neon
parameters:
paths:
- app/
# Level 9 is the highest level
level: 0
# ignoreErrors:
# - '#PHPDoc tag @var#'
#
# excludePaths:
# - ./*/*/FileToBeExcluded.php
#
# checkMissingIterableValueType: false