From a2d51a8ae56624fd6f640057ae9f325d89cd2d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:24:01 +0100 Subject: [PATCH] fix phpstan --- .github/workflows/test.yaml | 2 +- build/phpstan/phpstan-baseline.neon | 30 --------------------- htdocs/compta/bank/various_payment/list.php | 13 ++++----- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 30ccca5b0e9..dc0bfbdf63c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: steps: - name: Log run: | - echo "Run action by ${{ github.actor }}" + echo "Run action by ${{ github.actor }}" echo "github.token=${{ github.token }}" echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 0863ab2d843..fd515408bf0 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -5496,42 +5496,12 @@ parameters: count: 1 path: ../../htdocs/compta/bank/various_payment/list.php - - - message: '#^Variable \$accountingaccount might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$accountingjournal might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$accountstatic might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$bankline might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/bank/various_payment/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable count: 1 path: ../../htdocs/compta/bank/various_payment/list.php - - - message: '#^Variable \$variousstatic might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../htdocs/compta/bank/various_payment/list.php - - message: '#^Loose comparison using \=\= between ''card'' and ''card'' will always evaluate to true\.$#' identifier: equal.alwaysTrue diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index bfb4a783c65..a9abe660819 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -239,24 +239,21 @@ if (empty($reshook)) { $form = new Form($db); $proj = null; +$bankline = new AccountLine($db); +$variousstatic = new PaymentVarious($db); +$accountstatic = null; if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { $formaccounting = new FormAccounting($db); } if ($arrayfields['bank']['checked'] && isModEnabled('accounting')) { $accountingjournal = new AccountingJournal($db); } -if ($arrayfields['ref']['checked']) { - $variousstatic = new PaymentVarious($db); -} if ($arrayfields['bank']['checked']) { - $accountstatic = new Account($db); + $accountstatic = new Account($db); } if ($arrayfields['project']['checked']) { $proj = new Project($db); } -if ($arrayfields['entry']['checked']) { - $bankline = new AccountLine($db); -} if ($arrayfields['account']['checked']) { $accountingaccount = new AccountingAccount($db); } @@ -817,7 +814,7 @@ while ($i < $imaxinloop) { } // Bank account - if ($arrayfields['bank']['checked']) { + if ($arrayfields['bank']['checked'] && is_object($accountstatic)) { print ''; if ($obj->bid > 0) { $accountstatic->id = $obj->bid;