mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-14 01:13:37 -06:00
Add some method annotators, see if this helps with Scrutinizer issues.
This commit is contained in:
parent
c424bb097d
commit
5dad569d62
@ -166,7 +166,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
$attachment->md5 = md5_file($path);
|
||||
$attachment->mime = $mime;
|
||||
$attachment->size = \strlen($content);
|
||||
$attachment->uploaded = 1;
|
||||
$attachment->uploaded = true;
|
||||
$attachment->save();
|
||||
|
||||
return true;
|
||||
|
@ -210,7 +210,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace FireflyIII\Repositories\LinkType;
|
||||
use FireflyIII\Models\LinkType;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionJournalLink;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@ -62,6 +63,13 @@ interface LinkTypeRepositoryInterface
|
||||
*/
|
||||
public function find(int $id): LinkType;
|
||||
|
||||
/**
|
||||
* Set the user for this instance.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user): void;
|
||||
|
||||
/**
|
||||
* Find link type by name.
|
||||
*
|
||||
|
@ -22,11 +22,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Facades;
|
||||
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Amount.
|
||||
*
|
||||
* @method TransactionCurrency getDefaultCurrencyByUser(User $user)
|
||||
*/
|
||||
class Amount extends Facade
|
||||
{
|
||||
|
@ -27,6 +27,9 @@ use Illuminate\Support\Facades\Facade;
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Navigation.
|
||||
*
|
||||
* @method array blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range)
|
||||
* @method string periodShow(\Carbon\Carbon $theDate, string $repeatFrequency)
|
||||
*/
|
||||
class Navigation extends Facade
|
||||
{
|
||||
|
@ -22,11 +22,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Facades;
|
||||
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Preferences.
|
||||
*
|
||||
* @method Preference set(string $name, $value)
|
||||
* @method Preference get(string $name, $value)
|
||||
* @method Preference|null getForUser(User $user, string $name, $default)
|
||||
* @method void mark()
|
||||
*/
|
||||
class Preferences extends Facade
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ use Illuminate\Support\Facades\Facade;
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Steam.
|
||||
* @method string positive(string $amount)
|
||||
*/
|
||||
class Steam extends Facade
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ class Navigation
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function periodShow(Carbon $theDate, string $repeatFrequency): string
|
||||
public function periodShow(\Carbon\Carbon $theDate, string $repeatFrequency): string
|
||||
{
|
||||
$date = clone $theDate;
|
||||
$formatMap = [
|
||||
|
@ -79,12 +79,12 @@ class Preferences
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $default
|
||||
* @param string $name
|
||||
* @param null $default
|
||||
*
|
||||
* @return \FireflyIII\Models\Preference|null
|
||||
*/
|
||||
public function get($name, $default = null)
|
||||
public function get(string $name, $default = null): ?Preference
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
@ -125,7 +125,7 @@ class Preferences
|
||||
*
|
||||
* @return \FireflyIII\Models\Preference|null
|
||||
*/
|
||||
public function getForUser(User $user, $name, $default = null): ?Preference
|
||||
public function getForUser(User $user, string $name, $default = null): ?Preference
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||
if (Cache::has($fullName)) {
|
||||
@ -177,23 +177,21 @@ class Preferences
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function mark(): bool
|
||||
public function mark(): void
|
||||
{
|
||||
$this->set('lastActivity', microtime());
|
||||
Session::forget('first');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return Preference
|
||||
* @return \FireflyIII\Models\Preference
|
||||
*/
|
||||
public function set($name, $value): Preference
|
||||
public function set(string $name, $value): Preference
|
||||
{
|
||||
$user = auth()->user();
|
||||
if (null === $user) {
|
||||
@ -210,12 +208,12 @@ class Preferences
|
||||
|
||||
/**
|
||||
* @param \FireflyIII\User $user
|
||||
* @param $name
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return Preference
|
||||
*/
|
||||
public function setForUser(User $user, $name, $value): Preference
|
||||
public function setForUser(User $user, string $name, $value): Preference
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||
Cache::forget($fullName);
|
||||
|
Loading…
Reference in New Issue
Block a user