Skip to content

Commit

Permalink
Update PHPStan config
Browse files Browse the repository at this point in the history
  • Loading branch information
jewei committed Oct 23, 2024
1 parent b2c9487 commit 3d3e7da
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
6 changes: 5 additions & 1 deletion app/Http/Middleware/Idempotency.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ private function hasCache(): bool

/**
* Get the cache value.
*
* @return array{content: string, status: int, headers: array<string, list<string|null>>}
*/
private function getCache(): array
{
return (array) Cache::get($this->resolveCacheKey());
return Cache::get($this->resolveCacheKey()); // @phpstan-ignore-line
}

/**
* Set the cache value.
*
* @param array{content: string, status: int, headers: array<string, list<string|null>>} $value
*/
private function setCache(array $value): void
{
Expand Down
16 changes: 3 additions & 13 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,23 @@

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;
use Override;

final class User extends Authenticatable
final class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens;
use HasFactory;
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];

/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
* @var list<string>
*/
protected $hidden = [
'password',
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"refactor": "rector",
"test:lint": "pint --test",
"test:refactor": "rector --dry-run",
"test:types": "phpstan analyse --ansi",
"test:types": "phpstan analyse --ansi --memory-limit=2G",
"test:arch": "pest --filter=arch",
"test:unit": "pest --parallel --coverage --min=100",
"test": [
Expand Down
11 changes: 8 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
includes:
- ./vendor/larastan/larastan/extension.neon
- ./vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
level: max
paths:
- app
- config
- bootstrap
- database
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
- database/factories
- routes
checkOctaneCompatibility: true
ignoreErrors:
- '#^Class App\\Models\\[a-zA-Z0-9\\_]+ uses generic trait Illuminate\\Database\\Eloquent\\Factories\\HasFactory but does not specify its types\: TFactory$#'

7 changes: 0 additions & 7 deletions routes/console.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
<?php

declare(strict_types=1);

use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;

Artisan::command('inspire', function (): void {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote')->hourly();

0 comments on commit 3d3e7da

Please sign in to comment.