mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 01:11:37 -06:00
These are the first commits that make FF require php 7.
This commit is contained in:
parent
baecc256f6
commit
554640c345
@ -44,7 +44,7 @@ class UpgradeFireflyInstructions extends Command
|
||||
//
|
||||
$version = Config::get('firefly.version');
|
||||
$config = Config::get('upgrade.text');
|
||||
$text = isset($config[$version]) ? $config[$version] : null;
|
||||
$text = $config[$version] ?? null;
|
||||
|
||||
$this->line('+------------------------------------------------------------------------------+');
|
||||
$this->line('');
|
||||
|
@ -137,7 +137,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
|
||||
|
||||
while ($end >= $current) {
|
||||
$theDate = $current->format('Y-m-d');
|
||||
$balance = isset($range[$theDate]) ? $range[$theDate] : $previous;
|
||||
$balance = $range[$theDate] ?? $previous;
|
||||
|
||||
$data['labels'][] = $current->formatLocalized($format);
|
||||
$data['datasets'][0]['data'][] = $balance;
|
||||
|
@ -122,7 +122,7 @@ class BalanceLine
|
||||
*/
|
||||
public function leftOfRepetition()
|
||||
{
|
||||
$start = isset($this->budget->amount) ? $this->budget->amount : 0;
|
||||
$start = $this->budget->amount ?? 0;
|
||||
/** @var BalanceEntry $balanceEntry */
|
||||
foreach ($this->getBalanceEntries() as $balanceEntry) {
|
||||
$start += $balanceEntry->getSpent();
|
||||
|
@ -228,7 +228,7 @@ class Importer
|
||||
|
||||
$data = $this->getFiller(); // These fields are necessary to create a new transaction journal. Some are optional
|
||||
foreach ($row as $index => $value) {
|
||||
$role = isset($this->roles[$index]) ? $this->roles[$index] : '_ignore';
|
||||
$role = $this->roles[$index] ?? '_ignore';
|
||||
$class = Config::get('csv.roles.' . $role . '.converter');
|
||||
$field = Config::get('csv.roles.' . $role . '.field');
|
||||
|
||||
|
@ -48,7 +48,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
||||
return $rep->budget_id == $budget->id;
|
||||
}
|
||||
);
|
||||
$totalSpent = isset($allTotalSpent[$budget->id]) ? $allTotalSpent[$budget->id] : [];
|
||||
$totalSpent = $allTotalSpent[$budget->id] ?? [];
|
||||
|
||||
// no repetition(s) for this budget:
|
||||
if ($repetitions->count() == 0) {
|
||||
|
@ -405,8 +405,8 @@ class CategoryController extends Controller
|
||||
|
||||
while ($start <= $end) {
|
||||
$str = $start->format('Y-m-d');
|
||||
$spent = isset($spentArray[$str]) ? $spentArray[$str] : 0;
|
||||
$earned = isset($earnedArray[$str]) ? $earnedArray[$str] : 0;
|
||||
$spent = $spentArray[$str] ?? 0;
|
||||
$earned = $earnedArray[$str] ?? 0;
|
||||
$date = Navigation::periodShow($start, '1D');
|
||||
$entries->push([clone $start, $date, $spent, $earned]);
|
||||
$start->addDay();
|
||||
|
@ -133,7 +133,7 @@ class ReportController extends Controller
|
||||
$count = 0;
|
||||
while ($start < $end) {
|
||||
$date = $start->format('Y-m');
|
||||
$currentIncome = isset($earned[$date]) ? $earned[$date] : 0;
|
||||
$currentIncome = $earned[$date] ?? 0;
|
||||
$currentExpense = isset($spent[$date]) ? ($spent[$date] * -1) : 0;
|
||||
$income = bcadd($income, $currentIncome);
|
||||
$expense = bcadd($expense, $currentExpense);
|
||||
@ -218,7 +218,7 @@ class ReportController extends Controller
|
||||
while ($start < $end) {
|
||||
// total income and total expenses:
|
||||
$date = $start->format('Y-m');
|
||||
$incomeSum = isset($earned[$date]) ? $earned[$date] : 0;
|
||||
$incomeSum = $earned[$date] ?? 0;
|
||||
$expenseSum = isset($spent[$date]) ? ($spent[$date] * -1) : 0;
|
||||
|
||||
$entries->push([clone $start, $incomeSum, $expenseSum]);
|
||||
|
@ -56,7 +56,7 @@ class Tag extends Model
|
||||
}
|
||||
// create it!
|
||||
$fields['tagMode'] = 'nothing';
|
||||
$fields['description'] = isset($fields['description']) && !is_null($fields['description']) ? $fields['description'] : '';
|
||||
$fields['description'] = $fields['description'] ?? '';
|
||||
$tag = Tag::create($fields);
|
||||
|
||||
return $tag;
|
||||
|
@ -291,7 +291,7 @@ class General extends Twig_Extension
|
||||
$args = func_get_args();
|
||||
$route = $args[1]; // name of the route.
|
||||
$what = $args[2]; // name of the route.
|
||||
$activeWhat = isset($context['what']) ? $context['what'] : false;
|
||||
$activeWhat = $context['what'] ?? false;
|
||||
|
||||
if ($what == $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
|
||||
return 'active';
|
||||
|
@ -49,7 +49,7 @@ class FireflyValidator extends Validator
|
||||
*/
|
||||
public function validateBelongsToUser($attribute, $value, $parameters)
|
||||
{
|
||||
$field = isset($parameters[1]) ? $parameters[1] : 'id';
|
||||
$field = $parameters[1] ?? 'id';
|
||||
|
||||
|
||||
$count = DB::table($parameters[0])->where('user_id', Auth::user()->id)->where($field, $value)->count();
|
||||
@ -105,8 +105,8 @@ class FireflyValidator extends Validator
|
||||
// check if rule-action-value matches the thing.
|
||||
|
||||
if (is_array($this->data['rule-action'])) {
|
||||
$name = isset($this->data['rule-action'][$index]) ? $this->data['rule-action'][$index] : 'invalid';
|
||||
$value = isset($this->data['rule-action-value'][$index]) ? $this->data['rule-action-value'][$index] : false;
|
||||
$name = $this->data['rule-action'][$index] ?? 'invalid';
|
||||
$value = $this->data['rule-action-value'][$index] ?? false;
|
||||
switch ($name) {
|
||||
default:
|
||||
Log::debug(' (' . $attribute . ') (index:' . $index . ') Name is "' . $name . '" so no action is taken.');
|
||||
@ -243,7 +243,7 @@ class FireflyValidator extends Validator
|
||||
// exclude?
|
||||
$table = $parameters[0];
|
||||
$field = $parameters[1];
|
||||
$exclude = isset($parameters[2]) ? intval($parameters[2]) : 0;
|
||||
$exclude = $parameters[2] ?? 0;
|
||||
|
||||
// get entries from table
|
||||
$set = DB::table($table)->where('user_id', Auth::user()->id)
|
||||
@ -272,7 +272,7 @@ class FireflyValidator extends Validator
|
||||
*/
|
||||
public function validateUniquePiggyBankForUser($attribute, $value, $parameters)
|
||||
{
|
||||
$exclude = isset($parameters[0]) ? $parameters[0] : null;
|
||||
$exclude = $parameters[0] ?? null;
|
||||
$query = DB::table('piggy_banks')->whereNull('piggy_banks.deleted_at')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', Auth::user()->id);
|
||||
if (!is_null($exclude)) {
|
||||
@ -369,7 +369,7 @@ class FireflyValidator extends Validator
|
||||
protected function validateByAccountTypeId($value, $parameters)
|
||||
{
|
||||
$type = AccountType::find($this->data['account_type_id'])->first();
|
||||
$ignore = isset($parameters[0]) ? intval($parameters[0]) : 0;
|
||||
$ignore = $parameters[0] ?? 0;
|
||||
$value = $this->tryDecrypt($value);
|
||||
|
||||
$set = Auth::user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
||||
@ -394,7 +394,7 @@ class FireflyValidator extends Validator
|
||||
{
|
||||
$search = Config::get('firefly.accountTypeByIdentifier.' . $this->data['what']);
|
||||
$type = AccountType::whereType($search)->first();
|
||||
$ignore = isset($parameters[0]) ? intval($parameters[0]) : 0;
|
||||
$ignore = $parameters[0] ?? 0;
|
||||
|
||||
$set = Auth::user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
||||
/** @var Account $entry */
|
||||
@ -414,7 +414,7 @@ class FireflyValidator extends Validator
|
||||
*/
|
||||
private function getRuleTriggerName($index)
|
||||
{
|
||||
return isset($this->data['rule-trigger'][$index]) ? $this->data['rule-trigger'][$index] : 'invalid';
|
||||
return $this->data['rule-trigger'][$index] ?? 'invalid';
|
||||
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ class FireflyValidator extends Validator
|
||||
*/
|
||||
private function getRuleTriggerValue($index)
|
||||
{
|
||||
return isset($this->data['rule-trigger-value'][$index]) ? $this->data['rule-trigger-value'][$index] : '';
|
||||
return $this->data['rule-trigger-value'][$index] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user