mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
PHP7 compatible function definitions.
This commit is contained in:
@@ -33,7 +33,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return $this->user->ruleGroups()->count();
|
||||
}
|
||||
@@ -42,9 +42,9 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
* @param RuleGroup $ruleGroup
|
||||
* @param RuleGroup $moveTo
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null)
|
||||
public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool
|
||||
{
|
||||
/** @var Rule $rule */
|
||||
foreach ($ruleGroup->rules as $rule) {
|
||||
@@ -72,7 +72,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function get()
|
||||
public function get(): Collection
|
||||
{
|
||||
return $this->user->ruleGroups()->orderBy('order', 'ASC')->get();
|
||||
}
|
||||
@@ -80,7 +80,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHighestOrderRuleGroup()
|
||||
public function getHighestOrderRuleGroup(): int
|
||||
{
|
||||
$entry = $this->user->ruleGroups()->max('order');
|
||||
|
||||
@@ -119,7 +119,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveDown(RuleGroup $ruleGroup)
|
||||
public function moveDown(RuleGroup $ruleGroup): bool
|
||||
{
|
||||
$order = $ruleGroup->order;
|
||||
|
||||
@@ -133,6 +133,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
$ruleGroup->order = ($ruleGroup->order + 1);
|
||||
$ruleGroup->save();
|
||||
$this->resetRuleGroupOrder();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,7 +141,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveUp(RuleGroup $ruleGroup)
|
||||
public function moveUp(RuleGroup $ruleGroup): bool
|
||||
{
|
||||
$order = $ruleGroup->order;
|
||||
|
||||
@@ -159,7 +160,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function resetRuleGroupOrder()
|
||||
public function resetRuleGroupOrder(): bool
|
||||
{
|
||||
$this->user->ruleGroups()->whereNotNull('deleted_at')->update(['order' => 0]);
|
||||
|
||||
@@ -181,7 +182,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup)
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool
|
||||
{
|
||||
$ruleGroup->rules()->whereNotNull('deleted_at')->update(['order' => 0]);
|
||||
|
||||
@@ -206,7 +207,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return RuleGroup
|
||||
*/
|
||||
public function store(array $data)
|
||||
public function store(array $data): RuleGroup
|
||||
{
|
||||
$order = $this->getHighestOrderRuleGroup();
|
||||
|
||||
@@ -233,7 +234,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return RuleGroup
|
||||
*/
|
||||
public function update(RuleGroup $ruleGroup, array $data)
|
||||
public function update(RuleGroup $ruleGroup, array $data): RuleGroup
|
||||
{
|
||||
// update the account:
|
||||
$ruleGroup->title = $data['title'];
|
||||
|
@@ -20,7 +20,7 @@ interface RuleGroupRepositoryInterface
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count();
|
||||
public function count(): int;
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
@@ -28,17 +28,17 @@ interface RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null);
|
||||
public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function get();
|
||||
public function get(): Collection;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHighestOrderRuleGroup();
|
||||
public function getHighestOrderRuleGroup(): int;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
@@ -52,33 +52,33 @@ interface RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveDown(RuleGroup $ruleGroup);
|
||||
public function moveDown(RuleGroup $ruleGroup): bool;
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveUp(RuleGroup $ruleGroup);
|
||||
public function moveUp(RuleGroup $ruleGroup): bool;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function resetRuleGroupOrder();
|
||||
public function resetRuleGroupOrder(): bool;
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup);
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool;
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return RuleGroup
|
||||
*/
|
||||
public function store(array $data);
|
||||
public function store(array $data): RuleGroup;
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
@@ -86,7 +86,7 @@ interface RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return RuleGroup
|
||||
*/
|
||||
public function update(RuleGroup $ruleGroup, array $data);
|
||||
public function update(RuleGroup $ruleGroup, array $data): RuleGroup;
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user