mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 02:40:43 -06:00
Some PHP 7.1 compatible code.
This commit is contained in:
parent
05e73344eb
commit
7b03b0c5fc
@ -99,7 +99,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function saveAttachmentsForModel(Model $model, array $files = null): bool
|
||||
public function saveAttachmentsForModel(Model $model, ?array $files): bool
|
||||
{
|
||||
if (is_array($files)) {
|
||||
foreach ($files as $entry) {
|
||||
|
@ -55,6 +55,6 @@ interface AttachmentHelperInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function saveAttachmentsForModel(Model $model, array $files = null): bool;
|
||||
public function saveAttachmentsForModel(Model $model, ?array $files): bool;
|
||||
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function index(string $moment = null)
|
||||
public function index(?string $moment)
|
||||
{
|
||||
$range = Preferences::get('viewRange', '1M')->data;
|
||||
$start = session('start', new Carbon);
|
||||
|
@ -163,7 +163,7 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function expenseAsset(Budget $budget, BudgetLimit $budgetLimit = null)
|
||||
public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit)
|
||||
{
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($budget->id);
|
||||
@ -208,7 +208,7 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function expenseCategory(Budget $budget, BudgetLimit $budgetLimit = null)
|
||||
public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit)
|
||||
{
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($budget->id);
|
||||
@ -255,7 +255,7 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function expenseExpense(Budget $budget, BudgetLimit $budgetLimit = null)
|
||||
public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit)
|
||||
{
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($budget->id);
|
||||
|
@ -805,7 +805,7 @@ Breadcrumbs::register(
|
||||
* MASS TRANSACTION EDIT / DELETE
|
||||
*/
|
||||
Breadcrumbs::register(
|
||||
'transactions.mass.edit', function (BreadCrumbGenerator $breadcrumbs, Collection $journals) {
|
||||
'transactions.mass.edit', function (BreadCrumbGenerator $breadcrumbs, Collection $journals): void {
|
||||
|
||||
if ($journals->count() > 0) {
|
||||
$journalIds = $journals->pluck('id')->toArray();
|
||||
@ -817,6 +817,7 @@ Breadcrumbs::register(
|
||||
}
|
||||
|
||||
$breadcrumbs->parent('index');
|
||||
return;
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -500,7 +500,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
private function filterIban(string $iban = null)
|
||||
private function filterIban(?string $iban)
|
||||
{
|
||||
if (is_null($iban)) {
|
||||
return null;
|
||||
|
@ -44,7 +44,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool
|
||||
public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool
|
||||
{
|
||||
/** @var Rule $rule */
|
||||
foreach ($ruleGroup->rules as $rule) {
|
||||
|
@ -39,7 +39,7 @@ interface RuleGroupRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool;
|
||||
public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool;
|
||||
|
||||
/**
|
||||
* @param int $ruleGroupId
|
||||
|
@ -253,7 +253,7 @@ class TagRepository implements TagRepositoryInterface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sumOfTag(Tag $tag, Carbon $start = null, Carbon $end = null): string
|
||||
public function sumOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
|
@ -133,7 +133,7 @@ interface TagRepositoryInterface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sumOfTag(Tag $tag, Carbon $start = null, Carbon $end = null): string;
|
||||
public function sumOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string;
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
|
@ -135,7 +135,7 @@ class Navigation
|
||||
*
|
||||
* @return Carbon
|
||||
*/
|
||||
public function endOfX(Carbon $theCurrentEnd, string $repeatFreq, Carbon $maxDate = null): Carbon
|
||||
public function endOfX(Carbon $theCurrentEnd, string $repeatFreq, ?Carbon $maxDate): Carbon
|
||||
{
|
||||
$functionMap = [
|
||||
'1D' => 'endOfDay',
|
||||
|
@ -147,7 +147,7 @@ class General extends Twig_Extension
|
||||
protected function balance(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'balance', function (Account $account = null): string {
|
||||
'balance', function (?Account $account): string {
|
||||
if (is_null($account)) {
|
||||
return 'NULL';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user