diff --git a/blocks_fonctions.php b/blocks_fonctions.php index 9f36d1eaa479c4e7acc006aa7746164718b15c62..c4d8c8c0febe57deb8d2f71d78c387e3c9fa040f 100644 --- a/blocks_fonctions.php +++ b/blocks_fonctions.php @@ -27,10 +27,11 @@ function blocks_serialize($data) { * Désérialisation de données (saisies ou valeurs) * * @param $data - * @return mixed + * @return array|null */ function blocks_deserialize($data) { - return json_decode($data ?? '', true); + $retour = json_decode($data ?? '', true); + return is_array($retour) ? $retour : null; } /** @@ -69,11 +70,11 @@ function balise_GENERER_BLOCK_dist($p) { /** * Fonction interne à la balise GENERER_BLOCK * - * @param $id_block - * @return array|string + * @param int $id_block + * @return string */ -function _block_charger_block($id_block) { - $retour = ''; +function _block_charger_block(int $id_block): string { + $html = ''; $where = ['b.id_block = ' . (int)$id_block]; if (!test_espace_prive()) { $where[] = 'b.statut = ' . sql_quote('publie'); @@ -90,7 +91,7 @@ function _block_charger_block($id_block) { $retour = recuperer_fond('inclure/block', $contexte); } - return $retour; + return $html; } /** @@ -133,11 +134,11 @@ function balise_GENERER_BLOCKS_dist($p) { /** * Fonction interne à la balise GENERER_BLOCKS * - * @param $objet - * @param $id_objet + * @param string $objet + * @param int $id_objet * @return string */ -function _block_charger_blocks($objet, $id_objet): string { +function _block_charger_blocks(string $objet, int $id_objet): string { $retour = ''; $where = [ 'objet = ' . sql_quote($objet),