From 697c8d14b77932c306ff17dd81fba89879edbf37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 10:16:54 +0100 Subject: [PATCH] Fix phpcs --- build/dmg/dolimamp/install.forced.php | 31 +++++------ build/generate_filelist_xml.php | 74 +++++++++++++-------------- build/phpstan/bootstrap.php | 9 +++- build/rpm/conf.php | 1 + 4 files changed, 61 insertions(+), 54 deletions(-) diff --git a/build/dmg/dolimamp/install.forced.php b/build/dmg/dolimamp/install.forced.php index 31d0b5ae685..45a9875e78a 100644 --- a/build/dmg/dolimamp/install.forced.php +++ b/build/dmg/dolimamp/install.forced.php @@ -1,16 +1,17 @@ $tmp) { print "\n"; //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; -$outputdir=dirname(dirname(__FILE__)).'/htdocs/install'; +$outputdir = dirname(dirname(__FILE__)).'/htdocs/install'; print 'Delete current files '.$outputdir.'/filelist*.xml*'."\n"; dol_delete_file($outputdir.'/filelist*.xml*', 0, 1, 1); -$checksumconcat=array(); +$checksumconcat = array(); -$outputfile=$outputdir.'/filelist-'.$release.'.xml'; +$outputfile = $outputdir.'/filelist-'.$release.'.xml'; $fp = fopen($outputfile, 'w'); if (empty($fp)) { print 'Failed to open file '.$outputfile."\n"; @@ -156,8 +156,8 @@ fputs($fp, ''."\n"); foreach ($tmp as $constname => $constvalue) { - $valueforchecksum=(empty($constvalue)?'0':$constvalue); - $checksumconcat[]=$valueforchecksum; + $valueforchecksum = (empty($constvalue) ? '0' : $constvalue); + $checksumconcat[] = $valueforchecksum; fputs($fp, ' '.$valueforchecksum.''."\n"); } fputs($fp, ''."\n"); @@ -172,26 +172,26 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom */ // Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php) $regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; -$regextoexclude = '('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs +$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); -$dir=''; -$needtoclose=0; +$dir = ''; +$needtoclose = 0; foreach ($files as $filetmp) { $file = $filetmp['fullname']; //$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file)); $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); - if ($newdir!=$dir) { + if ($newdir != $dir) { if ($needtoclose) { fputs($fp, ' '."\n"); } fputs($fp, ' '."\n"); $dir = $newdir; - $needtoclose=1; + $needtoclose = 1; } - if (filetype($file)=="file") { - $md5=md5_file($file); - $checksumconcat[]=$md5; + if (filetype($file) == "file") { + $md5 = md5_file($file); + $checksumconcat[] = $md5; fputs($fp, ' '.$md5.''."\n"); } } @@ -205,7 +205,7 @@ fputs($fp, md5(join(',', $checksumconcat))."\n"); fputs($fp, ''."\n"); -$checksumconcat=array(); +$checksumconcat = array(); fputs($fp, ''."\n"); @@ -215,27 +215,27 @@ $iterator2 = new RecursiveIteratorIterator($dir_iterator2); // Need to ignore document custom etc. Note: this also ignore natively symbolic links. $files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); */ -$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; -$regextoexclude='(custom|documents|conf|install)$'; // Exclude dirs +$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; +$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs $files = dol_dir_list(dirname(__FILE__).'/../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); -$dir=''; -$needtoclose=0; +$dir = ''; +$needtoclose = 0; foreach ($files as $filetmp) { $file = $filetmp['fullname']; //$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); $newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); - if ($newdir!=$dir) { + if ($newdir != $dir) { if ($needtoclose) { fputs($fp, ' '."\n"); } fputs($fp, ' '."\n"); $dir = $newdir; - $needtoclose=1; + $needtoclose = 1; } - if (filetype($file)=="file") { - $md5=md5_file($file); - $checksumconcat[]=$md5; + if (filetype($file) == "file") { + $md5 = md5_file($file); + $checksumconcat[] = $md5; fputs($fp, ' '.$md5.''."\n"); } } diff --git a/build/phpstan/bootstrap.php b/build/phpstan/bootstrap.php index 8883bb158a5..2d5eab1c4e6 100644 --- a/build/phpstan/bootstrap.php +++ b/build/phpstan/bootstrap.php @@ -1,11 +1,16 @@