Fix $mybool |=... which is binary op, not boolean op

# Fix $mybool |=... which is binary op, not boolean op

This fixes PhanTypeInvalidLeftOperandOfBitwiseOp.
Replace $var |= ... with $var = ... || $var .
Add cast before ... when needed (@include does not always return bool).
|= always evaluates expression, there for || $var, not $var ||
This commit is contained in:
MDW 2024-03-21 13:21:40 +01:00
parent e19a60cd62
commit effe9e79b5
No known key found for this signature in database

View file

@ -10,6 +10,7 @@
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -279,9 +280,9 @@ class PaiementFourn extends Paiement
// If we want to closed paid invoices
if ($closepaidinvoices) {
$paiement = $invoice->getSommePaiement();
$creditnotes=$invoice->getSumCreditNotesUsed();
$creditnotes = $invoice->getSumCreditNotesUsed();
//$creditnotes = 0;
$deposits=$invoice->getSumDepositsUsed();
$deposits = $invoice->getSumDepositsUsed();
//$deposits = 0;
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
@ -712,7 +713,7 @@ class PaiementFourn extends Paiement
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -783,7 +784,7 @@ class PaiementFourn extends Paiement
// Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
$mybool = (include_once $dir.$file) || $mybool;
}
}
@ -798,7 +799,7 @@ class PaiementFourn extends Paiement
// Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
$mybool = (include_once $dir.$file) || $mybool;
}
}
}