Skip to content

Commit

Permalink
fix by phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
fey committed Mar 26, 2024
1 parent 64a4638 commit c02c311
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/Http/Controllers/Chapter/ChapterMemberController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
use App\Models\User;
use App\Services\ActivityService;
use Flash;
use Illuminate\Http\RedirectResponse;

class ChapterMemberController extends Controller
{
public function finish(Chapter $chapter, ActivityService $activityService)
public function finish(Chapter $chapter, ActivityService $activityService): RedirectResponse
{
$user = auth()->user();
$currentChapterMember = $this->getMember($user, $chapter);
Expand All @@ -31,7 +32,7 @@ private function getMember(User $user, Chapter $chapter): ChapterMember
->members()
->whereUserId($user->id)
->firstOr(function () use ($chapter, $user): ChapterMember {
$chapterMember = ChapterMember::make([]);
$chapterMember = new ChapterMember([]);

$chapterMember->user()->associate($user);
$chapterMember->chapter()->associate($chapter);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ChapterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function show(Chapter $chapter): View
$currentChapterMember = $chapter
->members()
->whereUserId($authUser->id)->firstOr(function () use ($chapter, $authUser): ChapterMember {
$chapterMember = ChapterMember::make([]);
$chapterMember = new ChapterMember([]);

$chapterMember->user()->associate($authUser);
$chapterMember->chapter()->associate($chapter);
Expand Down
2 changes: 2 additions & 0 deletions app/Models/ChapterMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Models;

use AllowDynamicProperties;
use Database\Factories\ChapterMemberFactory;
use Iben\Statable\Statable;
use Illuminate\Database\Eloquent\Builder;
Expand All @@ -12,6 +13,7 @@

/**
* @method static ChapterMemberFactory factory(...$parameters)
* @property string $state
*/
class ChapterMember extends Model
{
Expand Down
1 change: 0 additions & 1 deletion database/factories/ReadChapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function chapter(Chapter $chapter): self
public function configure(): self
{
return $this->afterCreating(function (ChapterMember $chapterMember) {
/** @var ActivityService $service */
// TODO: add logging
// $service = app()->make(ActivityService::class);
// $service->logChangedUserChapters(
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ parameters:
- vendor/*
- app/Http/Controllers/Auth/*
ignoreErrors:
- '/Parameter #1 \$value of function collect expects/'
- '/PHPDoc type array of property App\\Models\\User::\$hidden is not covariant with PHPDoc type/'
- '/PHPDoc type array of property App\\Models\\User::\$casts is not covariant with PHPDoc type/'
- '/Unable to resolve the template type TKey in call to function collect/'
Expand Down

0 comments on commit c02c311

Please sign in to comment.