From ef0a3329a1215db03d594a3790ae08157abc7774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Sep 2024 03:11:43 +0200 Subject: [PATCH] fix phpstan (#30914) * fix phpstan * fix phpstan --------- Co-authored-by: Laurent Destailleur --- htdocs/public/fichinter/agendaexport.php | 3 ++- htdocs/ticket/class/ticket.class.php | 2 +- htdocs/website/samples/wrapper.php | 17 ++++++++++++++++- phpstan.neon.dist | 1 - 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/public/fichinter/agendaexport.php b/htdocs/public/fichinter/agendaexport.php index ec84ba705ca..979054601ba 100644 --- a/htdocs/public/fichinter/agendaexport.php +++ b/htdocs/public/fichinter/agendaexport.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Charlene Benke + * Copyright (C) 2024 Frédéric France * * 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 @@ -704,7 +705,7 @@ function build_exportfile($format, $type, $cachedelay, $filename, $filters) } if ($result >= 0) { - if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) { + if (dol_move($outputfiletmp, $outputfile, '0', 1, 0, 0)) { $result = 1; } else { $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6e12584582a..b164438e1e4 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2567,7 +2567,7 @@ class Ticket extends CommonObject } $moreinfo = array('description' => 'File saved by copyFilesForTicket', 'src_object_type' => $this->element, 'src_object_id' => $this->id); - $res = dol_move($filepath[$i], $destfile, 0, 1, 0, 1, $moreinfo); + $res = dol_move($filepath[$i], $destfile, '0', 1, 0, 1, $moreinfo); if (!$res) { // Move has failed $this->error = "Failed to move file ".dirbasename($filepath[$i])." into ".dirbasename($destfile); diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 2eb54ac1d7e..0823b551efe 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -1,4 +1,19 @@ + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ // BEGIN PHP File wrapper.php used to download rss, logo, shared files - DO NOT MODIFY - It is just a copy of file website/samples/wrapper.php $websitekey = basename(__DIR__); @@ -172,7 +187,7 @@ if ($rss) { $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l); if ($result >= 0) { - if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) { + if (dol_move($outputfiletmp, $outputfile, '0', 1, 0, 0)) { $result = 1; } else { $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 42b35c42426..fe73c449322 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -81,7 +81,6 @@ parameters: - '#EvalMath::trigger\(\) expects string, int given#' - '#get_next_value expects string, int given#' - '#pdf_writeLinkedObjects expects string, int given#' - - '#dol_move expects string, int given#' - '#expects int, float#' - '#expects int, array\|string given.#' - "# (img_picto) expects int<0, 1>, (false|'') given.#"