Skip to content

Commit

Permalink
fix: phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Nov 12, 2023
1 parent 707fbd9 commit 11ef4ab
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/Command/EditPageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace FoF\Pages\Command;

use Carbon\Carbon;
use FoF\Pages\PageRepository;
use FoF\Pages\PageValidator;
use Illuminate\Support\Arr;
Expand Down Expand Up @@ -79,7 +80,7 @@ public function handle(EditPage $command)
$page->is_html = (bool) $attributes['isHtml'];
}

$page->edit_time = time();
$page->edit_time = Carbon::now();

$this->validator->assertValid($page->getDirty());

Expand Down
18 changes: 9 additions & 9 deletions src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
use Flarum\Post\Post;

/**
* @property string title
* @property string slug
* @property Carbon time
* @property Carbon edit_time
* @property string content
* @property bool is_hidden
* @property bool is_restricted
* @property bool is_html
* @property string $title
* @property string $slug
* @property Carbon $time
* @property Carbon $edit_time
* @property string $content
* @property bool $is_hidden
* @property bool $is_restricted
* @property bool $is_html
*/
class Page extends AbstractModel
{
Expand Down Expand Up @@ -69,7 +69,7 @@ public static function build($title, $slug, $content, $isHidden, $isRestricted,

$page->title = $title;
$page->slug = $slug;
$page->time = time();
$page->time = Carbon::now();
$page->content = $content;
$page->is_restricted = (bool) $isRestricted;
$page->is_hidden = (bool) $isHidden;
Expand Down
2 changes: 1 addition & 1 deletion src/PageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function query()
*/
public function findOrFail($id, User $user = null)
{
return $this->query()
return Page::query()
// We never pass a null $user from our own code, but third-party extensions
// like v17development/flarum-seo do it so we must allow null for backward compatibility
->whereVisibleTo($user ?? new Guest())
Expand Down
1 change: 1 addition & 0 deletions src/Search/NoOpGambit.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ public function filter(FilterState $filterState, string $filterValue, bool $nega
public function apply(SearchState $search, $bit)
{
// Does nothing
return false;
}
}

0 comments on commit 11ef4ab

Please sign in to comment.