Some PHP 7.1 compatible code.

This commit is contained in:
James Cole 2017-07-23 19:06:24 +02:00
parent 05e73344eb
commit 7b03b0c5fc
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
12 changed files with 15 additions and 14 deletions

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
);

View File

@ -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;

View File

@ -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) {

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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',

View File

@ -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';
}