Skip to content

Commit

Permalink
Merge pull request #33134 from mdeweerd/fix/phan.theme
Browse files Browse the repository at this point in the history
Qual: Fix phan notices (theme)
  • Loading branch information
eldy authored Feb 19, 2025
2 parents fab600a + 272808c commit 1516850
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 19 deletions.
14 changes: 1 addition & 13 deletions dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ return [
// PhanUndeclaredProperty : 500+ occurrences
// PhanTypeMismatchArgumentNullable : 320+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 170+ occurrences
// PhanUndeclaredGlobalVariable : 160+ occurrences
// PhanTypeMismatchProperty : 120+ occurrences
// PhanPluginUnknownArrayMethodParamType : 110+ occurrences
// PhanUndeclaredGlobalVariable : 100+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 35+ occurrences
// PhanTypeExpectedObjectPropAccess : 30+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 25+ occurrences
Expand All @@ -33,7 +33,6 @@ return [
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
// PhanPluginSuspiciousParamPosition : 3 occurrences
// PhanRedefineFunction : 2 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
// PhanTypeSuspiciousStringExpression : 2 occurrences
// PhanAccessMethodProtected : 1 occurrence
Expand Down Expand Up @@ -644,17 +643,6 @@ return [
'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/takepos/invoice.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction'],
'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/eldy/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/eldy/flags-sprite.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/eldy/main_menu_fa_icons.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/eldy/progress.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/md/badges.inc.php' => ['PhanRedefineFunction'],
'htdocs/theme/md/btn.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/md/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/md/flags-sprite.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/md/progress.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/ticket/agenda.php' => ['PhanTypeMismatchArgument'],
'htdocs/ticket/card.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/ticket/class/actions_ticket.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
Expand Down
4 changes: 3 additions & 1 deletion htdocs/theme/eldy/badges.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2024 MDW <[email protected]>
/* Copyright (C) 2024-2025 MDW <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
Expand Down Expand Up @@ -254,6 +254,8 @@
* @param string $commentLabel a comment label
* @param string $cssPrefix a css prefix
* @return void
*
* @phan-suppress PhanRedefineFunction
*/
function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentLabel = '', $cssPrefix = '')
{
Expand Down
13 changes: 13 additions & 0 deletions htdocs/theme/eldy/btn.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2025 MDW <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
Expand All @@ -12,9 +13,21 @@
* @var string $colortextlink
* @var int $dol_optimize_smallscreen
* @var string $textbutaction
* @var int<0,max> $nbtopmenuentries
* @var string $right
* @var string $left
*/

'
@phan-var-force string $butactionbg
@phan-var-force string $colortextlink
@phan-var-force int<0,1> $dol_optimize_smallscreen
@phan-var-force string $fontlist
@phan-var-force string $left
@phan-var-force int<0,max> $nbtopmenuentries
@phan-var-force string $right
@phan-var-force string $textbutaction
';
?>

/* IDE Hack <style type="text/css"> */
Expand Down
20 changes: 20 additions & 0 deletions htdocs/theme/eldy/dropdown.inc.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
<?php
/* Copyright (C) 2025 MDW <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
}
include_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php";
/**
* @var string $colorbackhmenu1
* @var string $colorbacklinepair1
* @var string $colortextbackhmenu
* @var string $colortextlink
* @var int<0,1> $disableimages
* @var string $left
* @var string $right
*/
'
@phan-var-force string $colorbackhmenu1
@phan-var-force string $colorbacklinepair1
@phan-var-force string $colortextbackhmenu
@phan-var-force string $colortextlink
@phan-var-force int<0,1> $disableimages
@phan-var-force string $left
@phan-var-force string $right
';
?>

/* IDE Hack <style type="text/css"> */
Expand Down
5 changes: 4 additions & 1 deletion htdocs/theme/eldy/flags-sprite.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
/* Copyright (C) 2004-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2025 MDW <[email protected]>
*
* 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
Expand All @@ -27,6 +27,9 @@
/**
* @var string $path
*/
'
@phan-var-force string $path
';
?>
/* IDE Hack <style type="text/css"> */

Expand Down
18 changes: 17 additions & 1 deletion htdocs/theme/eldy/main_menu_fa_icons.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
/* Copyright (C) 2004-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2025 MDW <[email protected]>
*
* 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
Expand All @@ -24,6 +24,22 @@
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by stylesheet');
}
/**
* @var string $badgeDanger
* @var string $badgeSuccess
* @var string $badgeWarning
* @var string $colorblind_deuteranopes_badgeDanger
* @var string $colorblind_deuteranopes_badgeSuccess
* @var string $topMenuFontSize
*/
'
@phan-var-force string $badgeDanger
@phan-var-force string $badgeSuccess
@phan-var-force string $badgeWarning
@phan-var-force string $colorblind_deuteranopes_badgeDanger
@phan-var-force string $colorblind_deuteranopes_badgeSuccess
@phan-var-force string $topMenuFontSize
';
?>
/* IDE Hack <style type="text/css"> */

Expand Down
19 changes: 18 additions & 1 deletion htdocs/theme/eldy/progress.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<?php
/* Copyright (C) 2025 MDW <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
}
/**
* @var string $badgeDanger
* @var string $badgeSuccess
* @var string $badgeWarning
* @var string $colorblind_deuteranopes_badgeDanger
* @var string $colorblind_deuteranopes_badgeSuccess
*/
'
@phan-var-force string $badgeDanger
@phan-var-force string $badgeSuccess
@phan-var-force string $badgeWarning
@phan-var-force string $colorblind_deuteranopes_badgeDanger
@phan-var-force string $colorblind_deuteranopes_badgeSuccess
'
?>

/* IDE Hack <style type="text/css"> */

Expand Down
4 changes: 3 additions & 1 deletion htdocs/theme/md/badges.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2024 MDW <[email protected]>
/* Copyright (C) 2024-2025 MDW <[email protected]>
* Copyright (C) 2025 Frédéric France <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
Expand Down Expand Up @@ -257,6 +257,8 @@
* @param string $commentLabel a comment label
* @param string $cssPrefix a css prefix
* @return void
*
* @phan-suppress PhanRedefineFunction
*/
function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentLabel = '', $cssPrefix = '')
{
Expand Down
11 changes: 11 additions & 0 deletions htdocs/theme/md/btn.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2025 MDW <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
Expand All @@ -12,6 +13,16 @@
* @var string $butactionbg
* @var string $textbutaction
*/
'
@phan-var-force string $butactionbg
@phan-var-force string $colortextlink
@phan-var-force int $dol_optimize_smallscreen
@phan-var-force string $fontlist
@phan-var-force string $left
@phan-var-force int $nbtopmenuentries
@phan-var-force string $right
@phan-var-force string $textbutaction
';
?>

/* IDE Hack <style type="text/css"> */
Expand Down
21 changes: 21 additions & 0 deletions htdocs/theme/md/dropdown.inc.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
<?php
/* Copyright (C) 2025 MDW <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
}

// When no photo, we show the login name, so we need an offset to output picto at a fixed position.
$atoploginusername = empty($user->photo) ? 52 : 0;

/**
* @var string $colorbackhmenu1
* @var string $colorbacklinepair1
* @var string $colortextbackhmenu
* @var string $colortextlink
* @var int<0,1> $disableimages
* @var string $left
* @var string $right
*/
'
@phan-var-force string $colorbackhmenu1
@phan-var-force string $colorbacklinepair1
@phan-var-force string $colortextbackhmenu
@phan-var-force string $colortextlink
@phan-var-force int<0,1> $disableimages
@phan-var-force string $left
@phan-var-force string $right
';

?>

/* IDE Hack <style type="text/css"> */
Expand Down
11 changes: 10 additions & 1 deletion htdocs/theme/md/flags-sprite.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<?php
/* Copyright (C) 2025 MDW <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
}
/**
* @var string $path
*/
'
@phan-var-force string $path
';
?>

/* IDE Hack <style type="text/css"> */

Expand Down
9 changes: 9 additions & 0 deletions htdocs/theme/md/progress.inc.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?php
/* Copyright (C) 2025 MDW <[email protected]>
*/
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
}

/**
* @var string $path
*/
'
@phan-var-force string $path
';

include dol_buildpath($path.'/theme/eldy/progress.inc.php', 0); // actually md use same style as eldy theme

0 comments on commit 1516850

Please sign in to comment.