commit eaf1503caa55400c6b70996a770a281fb81cb147
parent 23f682aba179592ada8b17e99c00e9b247d6e5f8
Author: MTRNord <mtrnord1@gmail.com>
Date: Sat, 21 Oct 2023 20:22:13 +0200
Improve static analysis and fix some bugs
Diffstat:
7 files changed, 212 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml
@@ -21,4 +21,4 @@ jobs:
npm install && npm run build
- name: Run Static Analysis
- run: ./vendor/bin/phpstan --error-format=github analyse .
+ run: ./vendor/bin/phpstan --error-format=github analyse
diff --git a/app/Http/Controllers/Auth/VerifyEmailController.php b/app/Http/Controllers/Auth/VerifyEmailController.php
@@ -15,14 +15,17 @@ class VerifyEmailController extends Controller
*/
public function __invoke(EmailVerificationRequest $request): RedirectResponse
{
+ if ($request->user() == null) {
+ return redirect()->route("/");
+ }
if ($request->user()->hasVerifiedEmail()) {
- return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
+ return redirect()->intended(RouteServiceProvider::HOME . '?verified=1');
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
- return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
+ return redirect()->intended(RouteServiceProvider::HOME . '?verified=1');
}
}
diff --git a/app/Models/Room.php b/app/Models/Room.php
@@ -15,7 +15,7 @@ class Room extends Model
/**
* The attributes that are mass assignable.
*
- * @var array
+ * @var array<string>
*/
protected $fillable = ['name', 'description'];
diff --git a/app/Models/User.php b/app/Models/User.php
@@ -3,12 +3,13 @@
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
+use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
-class User extends Authenticatable
+class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens, HasFactory, Notifiable;
diff --git a/composer.json b/composer.json
@@ -23,6 +23,7 @@
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
+ "nunomaduro/larastan": "^2.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
diff --git a/composer.lock b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e9d95b0169ad95d85c8796f16ba4d35d",
+ "content-hash": "222d993dbf261659917e0fb5e1f9ae16",
"packages": [
{
"name": "brick/math",
@@ -6737,6 +6737,102 @@
"time": "2023-10-11T15:45:01+00:00"
},
{
+ "name": "nunomaduro/larastan",
+ "version": "v2.6.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nunomaduro/larastan.git",
+ "reference": "6c5e8820f3db6397546f3ce48520af9d312aed27"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nunomaduro/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/nunomaduro/larastan/issues",
+ "source": "https://github.com/nunomaduro/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": "phar-io/manifest",
"version": "2.0.3",
"source": {
@@ -6848,6 +6944,93 @@
"time": "2022-02-21T01:04:05+00:00"
},
{
+ "name": "phpmyadmin/sql-parser",
+ "version": "5.8.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpmyadmin/sql-parser.git",
+ "reference": "f1720ae19abe6294cb5599594a8a57bc3c8cc287"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/f1720ae19abe6294cb5599594a8a57bc3c8cc287",
+ "reference": "f1720ae19abe6294cb5599594a8a57bc3c8cc287",
+ "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/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": "2023-09-19T12:34:29+00:00"
+ },
+ {
"name": "phpstan/phpstan",
"version": "1.10.39",
"source": {
diff --git a/phpstan.neon b/phpstan.neon
@@ -0,0 +1,18 @@
+includes:
+ - ./vendor/nunomaduro/larastan/extension.neon
+
+parameters:
+
+ paths:
+ - app/
+
+ # Level 9 is the highest level
+ level: 5
+
+# ignoreErrors:
+# - '#PHPDoc tag @var#'
+#
+# excludePaths:
+# - ./*/*/FileToBeExcluded.php
+#
+# checkMissingIterableValueType: false