diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 3f3ec9fa7af..6913899d728 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -13266,108 +13266,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/admin/admin_hrm.php - - - message: '#^Call to function method_exists\(\) with \$this\(Evaluation\) and ''getLibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Evaluation\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Call to function property_exists\(\) with Evaluation and ''date_creation'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Call to function property_exists\(\) with Evaluation and ''date_modification'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Call to function property_exists\(\) with Evaluation and ''label'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Call to function property_exists\(\) with Evaluation and ''ref'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Call to function property_exists\(\) with Evaluation and ''status'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Property Evaluation\:\:\$status \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/class/evaluation.class.php - - - - message: '#^Call to function property_exists\(\) with EvaluationLine and ''date_creation'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - - - message: '#^Call to function property_exists\(\) with EvaluationLine and ''date_modification'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - - - message: '#^Call to function property_exists\(\) with EvaluationLine and ''ref'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - - - message: '#^Call to function property_exists\(\) with EvaluationLine and ''status'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - - - message: '#^Left side of && is always false\.$#' - identifier: booleanAnd.leftAlwaysFalse - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - - - message: '#^Method EvaluationLine\:\:fetchAll\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - - - message: '#^Method EvaluationLine\:\:getLinesArray\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/hrm/class/evaluationdet.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Job\) and ''getNomUrl'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index b76aba54eee..d6a3e5876e6 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -128,14 +128,6 @@ class Evaluation extends CommonObject * @var string */ public $description; - /** - * @var string - */ - public $note_public; - /** - * @var string - */ - public $note_private; /** * @var int */ @@ -149,7 +141,7 @@ class Evaluation extends CommonObject */ public $import_key; /** - * @var int + * @var int|null */ public $status; /** @@ -319,24 +311,16 @@ class Evaluation extends CommonObject unset($object->import_key); // Clear fields - if (property_exists($object, 'ref')) { + if (!empty($object->ref)) { // @phan-suppress-next-line PhanTypeMismatchProperty $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; } - if (property_exists($object, 'label')) { - // @phan-suppress-next-line PhanTypeInvalidDimOffset - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; + if (!empty($object->label)) { + $object->label = $langs->trans("CopyOf")." ".$object->label; } - if (property_exists($object, 'status')) { - $object->status = self::STATUS_DRAFT; - } - if (property_exists($object, 'date_creation')) { - $object->date_creation = dol_now(); - } - if (property_exists($object, 'date_modification')) { - $object->date_modification = null; - } - // ... + $object->status = self::STATUS_DRAFT; + $object->date_creation = dol_now(); + // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); @@ -555,7 +539,7 @@ class Evaluation extends CommonObject $this->db->begin(); // Define new ref - if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life + if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life $num = $this->getNextNumRef(); } else { $num = $this->ref; @@ -1073,7 +1057,7 @@ class Evaluation extends CommonObject $return .= img_picto('', $this->picto); $return .= ''; $return .= '