diff --git a/config/application.php b/config/application.php index ed2c28f7..d563d373 100755 --- a/config/application.php +++ b/config/application.php @@ -11,21 +11,21 @@ declare(strict_types=1); -use Roots\WPConfig\Config; - use function Env\env; +use Roots\WPConfig\Config; + // USE_ENV_ARRAY + CONVERT_* + STRIP_QUOTES Env\Env::$options = 31; -/* +/** * Directory containing all of the site's files. * * @var string */ $root_dir = dirname(__DIR__); -/* +/** * Document Root. * * @var string @@ -59,7 +59,7 @@ if (file_exists($root_dir.'/.env')) { define('WP_ENV', env('WP_ENV') ?: 'production'); // Infer WP_ENVIRONMENT_TYPE based on WP_ENV -if (!env('WP_ENVIRONMENT_TYPE') && in_array(WP_ENV, ['production', 'staging', 'development', 'local'])) { +if (!env('WP_ENVIRONMENT_TYPE') && in_array(WP_ENV, ['production', 'staging', 'development', 'local'], true)) { Config::define('WP_ENVIRONMENT_TYPE', WP_ENV); } @@ -74,7 +74,7 @@ Config::define('WP_CONTENT_URL', Config::get('WP_HOME').Config::get('CONTENT_DIR // DB settings if (env('DB_SSL')) { - Config::define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL); + Config::define('MYSQL_CLIENT_FLAGS', \MYSQLI_CLIENT_SSL); } Config::define('DB_NAME', env('DB_NAME')); @@ -88,9 +88,9 @@ $table_prefix = env('DB_PREFIX') ?: 'wp_'; if (env('DATABASE_URL')) { $dsn = (object) parse_url(env('DATABASE_URL')); - Config::define('DB_NAME', substr($dsn->path, 1)); + Config::define('DB_NAME', mb_substr($dsn->path, 1)); Config::define('DB_USER', $dsn->user); - Config::define('DB_PASSWORD', isset($dsn->pass) ? $dsn->pass : null); + Config::define('DB_PASSWORD', $dsn->pass ?? null); Config::define('DB_HOST', isset($dsn->port) ? "{$dsn->host}:{$dsn->port}" : $dsn->host); } diff --git a/config/environments/development.php b/config/environments/development.php index ef0ba272..c6a272ad 100755 --- a/config/environments/development.php +++ b/config/environments/development.php @@ -6,13 +6,13 @@ declare(strict_types=1); -use Roots\WPConfig\Config; - use function Env\env; +use Roots\WPConfig\Config; + Config::define('SAVEQUERIES', true); Config::define('WP_DEBUG', true); -Config::define('WP_DEBUG_DISPLAY', false); +Config::define('WP_DEBUG_DISPLAY', true); Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG') ?? true); Config::define('WP_DISABLE_FATAL_ERROR_HANDLER', true); Config::define('SCRIPT_DEBUG', true); diff --git a/config/environments/production.php b/config/environments/production.php index 93b792c3..249fe661 100755 --- a/config/environments/production.php +++ b/config/environments/production.php @@ -6,10 +6,10 @@ declare(strict_types=1); -use Roots\WPConfig\Config; - use function Env\env; +use Roots\WPConfig\Config; + Config::define('WP_DEBUG', true); Config::define('WP_DEBUG_DISPLAY', false); Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG') ?? true); diff --git a/config/environments/staging.php b/config/environments/staging.php index 1651c055..3ae418be 100755 --- a/config/environments/staging.php +++ b/config/environments/staging.php @@ -6,10 +6,10 @@ declare(strict_types=1); -use Roots\WPConfig\Config; - use function Env\env; +use Roots\WPConfig\Config; + Config::define('DISALLOW_INDEXING', true); Config::define('WOOCOMMERCE_API_CONSUMER_KEY', env('WOOCOMMERCE_API_CONSUMER_KEY')); Config::define('WOOCOMMERCE_API_CONSUMER_SECRET', env('WOOCOMMERCE_API_CONSUMER_SECRET')); diff --git a/scripts/remove-scaled-images.php b/scripts/remove-scaled-images.php index 2c7d67c3..c543ca59 100755 --- a/scripts/remove-scaled-images.php +++ b/scripts/remove-scaled-images.php @@ -1,9 +1,9 @@ - $informations_produits Les informations brutes des Produits. */ +/** @var list $informations_produits Les informations brutes des Produits. */ $informations_produits = wc_get_products([ 'limit' => 12, 'order' => 'DESC', @@ -22,9 +22,9 @@ $informations_produits = wc_get_products([ 'status' => 'publish', ]); -/** @var InformationsProduitShop $produits Les informations strictement nécessaires pour la grille des Produits. */ +/** @var mixed $produits Les informations strictement nécessaires pour la grille des Produits. */ $produits = array_map( - callback: 'recupere_informations_produit_shop', + callback: recupere_informations_produit_shop(...), array: $informations_produits, ); $contexte['produits'] = $produits; diff --git a/web/app/themes/haiku-atelier-2024/functions.php b/web/app/themes/haiku-atelier-2024/functions.php index a29f3c87..5c7dfd6e 100755 --- a/web/app/themes/haiku-atelier-2024/functions.php +++ b/web/app/themes/haiku-atelier-2024/functions.php @@ -71,10 +71,8 @@ new StarterSite(); /** * Personnalisation du thème. - * - * @param mixed $wp_customize */ -function enregistre_personnalisations_theme($wp_customize) { +function enregistre_personnalisations_theme(mixed $wp_customize): void { // Section « Réseaux sociaux » $wp_customize->add_section('liens_reseaux_sociaux', [ 'title' => __('Liens des réseaux sociaux'), @@ -149,15 +147,15 @@ function enregistre_personnalisations_theme($wp_customize) { add_action('customize_register', 'enregistre_personnalisations_theme'); function retire_tailles_image_par_defaut(mixed $sizes): mixed { - error_log(print_r($sizes, true)); - - /** @var array */ + /** @var list */ $targets = ['full', 'thumbnail']; foreach ($sizes as $size_index => $size) { - if (!in_array($size, $targets, true)) { - unset($sizes[$size_index]); + if (in_array($size, $targets, true)) { + continue; } + + unset($sizes[$size_index]); } return $sizes; @@ -171,7 +169,7 @@ add_filter('async_update_translation', '__return_false'); add_filter('auto_update_translation', '__return_false'); // Block Patterns -add_action('after_setup_theme', function () { +add_action('after_setup_theme', static function (): void { remove_theme_support('core-block-patterns'); }); add_filter('should_load_remote_block_patterns', '__return_false'); diff --git a/web/app/themes/haiku-atelier-2024/page-cart.php b/web/app/themes/haiku-atelier-2024/page-cart.php index f8ffeb76..cdfaaac8 100755 --- a/web/app/themes/haiku-atelier-2024/page-cart.php +++ b/web/app/themes/haiku-atelier-2024/page-cart.php @@ -1,15 +1,13 @@ -cart->get_subtotal(); -/** @var null|string $code_promo Le code promo appliqué au Panier s'il existe. */ +/** @var string|null $code_promo Le code promo appliqué au Panier s'il existe. */ $code_promo = collect(WC()->cart->get_applied_coupons())->first(); /** @var int $sous_total_reduction Le total du montant de la Réduction appliquée au Panier */ $sous_total_reduction = Number::format(WC()->cart->get_totals()['discount_total'], maxPrecision: 2); /** @var float $total_panier Le total de la Commande dans le Panier. */ -$total_panier = Number::format(floatval(WC()->cart->get_totals()['total']), maxPrecision: 2); +$total_panier = Number::format((float) WC()->cart->get_totals()['total'], maxPrecision: 2); foreach (WC()->cart->get_cart() as $cle_panier => $article_panier) { $panier[$cle_panier] = [ - 'attributs' => $article_panier['data']?->get_type() == 'variation' + 'attributs' => $article_panier['data']?->get_type() === 'variation' ? recupere_et_formate_attributs_produit($article_panier['data']?->get_attributes()) : [], 'cle' => $cle_panier, 'id_produit' => $article_panier['product_id'], 'id_variation' => $article_panier['variation_id'], - 'image' => pipe($article_panier['data']?->get_image_id(), fn($id) => genere_balise_img_multiformats( - id: $id, + 'image' => pipe($article_panier['data']?->get_image_id(), static fn($id): string => genere_balise_img_multiformats( + id: (string) $id, lazy: true, )), 'prix' => $article_panier['data']?->get_price(), @@ -127,15 +125,15 @@ foreach (WC()->cart->get_cart() as $cle_panier => $article_panier) { $email = WC()->customer->get_billing_email(); $adresse_livraison = WC()->customer->get_shipping(); $adresse_facturation = WC()->customer->get_billing(); -$adresse_renseignee = $adresse_livraison['city'] != ''; +$adresse_renseignee = $adresse_livraison['city'] !== ''; $pays_livraison = collect(WC()->countries->get_countries())->only($pays_acceptes)->toArray(); -$total_livraison = Number::format(floatval(WC()->cart->get_totals()['shipping_total']), precision: 0); +$total_livraison = Number::format((float) WC()->cart->get_totals()['shipping_total'], precision: 0); $methodes_livraison = collect(WC()->session->get('shipping_for_package_0')['rates']) ->values() - ->map(fn(WC_Shipping_Rate $methode) => [ + ->map(static fn(WC_Shipping_Rate $methode): array => [ 'id' => $methode->get_method_id(), - 'prix' => Number::format(intval($methode->get_cost()), maxPrecision: 2), - 'selectionnee' => collect(WC()->session->get('chosen_shipping_methods'))->first() == $methode->get_id(), + 'prix' => Number::format((int) $methode->get_cost(), maxPrecision: 2), + 'selectionnee' => collect(WC()->session->get('chosen_shipping_methods'))->first() === $methode->get_id(), 'titre' => $methode->get_label(), ]); @@ -152,14 +150,6 @@ $contexte['pays_livraison'] = $pays_livraison; $contexte['sous_total_livraison'] = $total_livraison; $contexte['methodes_livraison'] = $methodes_livraison; -// echo "
";
-// print_r($adresse_livraison);
-// print_r($adresse_facturation);
-// print_r($adresse_renseignee);
-// print_r($methodes_livraison);
-// print_r(WC()->session->get("chosen_shipping_methods"));
-// echo "
"; - // Charge les scripts et styles de la page function charge_scripts_styles_page_panier(): void { wp_enqueue_style( @@ -179,6 +169,9 @@ function charge_scripts_styles_page_panier(): void { add_action('wp_enqueue_scripts', 'charge_scripts_styles_page_panier'); +$lal = wp_json_encode($contexte); +echo ""; + // Rendu Timber::render( filenames: $modeles, diff --git a/web/app/themes/haiku-atelier-2024/page-checkout.php b/web/app/themes/haiku-atelier-2024/page-checkout.php index ce0cab56..1a1f4c58 100755 --- a/web/app/themes/haiku-atelier-2024/page-checkout.php +++ b/web/app/themes/haiku-atelier-2024/page-checkout.php @@ -6,12 +6,12 @@ declare(strict_types=1); -use Ramsey\Uuid\Uuid; use Roots\WPConfig\Config; use Stripe\BillingPortal\Session; use Stripe\Coupon; use Stripe\Product; use Stripe\Stripe; +use Symfony\Component\Uid\Uuid; header('Content-Type: application/json; charset=utf-8'); @@ -61,13 +61,13 @@ $panier = WC()->cart; /** @var string $email_client */ $email_client = WC()->session->get('customer')['email']; -/** @var array $articles */ +/** @var list $articles */ $articles = collect($panier->get_cart()) - ->map(function ($article_panier) { - $titre_produit = match ('variable' == $article_panier['data']?->get_type()) { + ->map(static function ($article_panier) { + $titre_produit = match ('variable' === $article_panier['data']?->get_type()) { true => $article_panier['data']?->get_title() . ' (' - . explode(': ', $article_panier['data']?->get_attribute_summary())[1] + . explode(': ', (string) $article_panier['data']?->get_attribute_summary())[1] . ')', false => $article_panier['data']?->get_title(), }; @@ -91,7 +91,6 @@ $articles = collect($panier->get_cart()) /** @var WC_Order $commande */ $commande = wc_get_order($order_id); -/** @var mixed $methode_livraison */ $methode_livraison = ['nom' => $commande->get_shipping_method(), 'cout' => $commande->get_shipping_total() * 100]; // Le nom de la méthode de livraison ne peut être une chaîne vide. @@ -105,19 +104,19 @@ Stripe::setApiKey(Config::get('STRIPE_API_SECRET')); // Met à jour les Codes promos $coupons_stripe = collect(Coupon::all()->data); $coupons_wc = collect(WC()->cart->get_coupons()) - ->map(fn(WC_Coupon $coupon) => [ + ->map(static fn(WC_Coupon $coupon): array => [ 'duration' => 'forever', 'id' => $coupon->get_code(), 'name' => $coupon->get_code(), 'fixed_cart' === $coupon->get_discount_type() ? 'amount_off' : 'percent_off' => $coupon->get_amount(), ]) - ->each(function (array $item) use ($coupons_stripe) { + ->each(static function (array $item) use ($coupons_stripe): void { // Si le code promo n'existe, le créer if (!$coupons_stripe->contains('name', $item['name'])) { Coupon::create($item); } }); -$reductions_stripe = $coupons_wc->map(fn($coupon) => ['coupon' => $coupon['name']])->values()->toArray(); +$reductions_stripe = $coupons_wc->map(static fn($coupon): array => ['coupon' => $coupon['name']])->values()->toArray(); /** @var Session $session_checkout_stripe */ $session_checkout_stripe = \Stripe\Checkout\Session::create([ @@ -134,9 +133,9 @@ $session_checkout_stripe = \Stripe\Checkout\Session::create([ 'tax_behavior' => 'inclusive', 'type' => 'fixed_amount', ]]], -], ['idempotency_key' => Uuid::uuid4()]); +], ['idempotency_key' => Uuid::v4()]); // echo json_encode($session_checkout_stripe); header('HTTP/1.1 303 See Other'); header('Location: ' . $session_checkout_stripe->url); -exit(); +exit; diff --git a/web/app/themes/haiku-atelier-2024/page-contact.php b/web/app/themes/haiku-atelier-2024/page-contact.php index c0d34ae4..c13037e7 100755 --- a/web/app/themes/haiku-atelier-2024/page-contact.php +++ b/web/app/themes/haiku-atelier-2024/page-contact.php @@ -1,11 +1,9 @@ -get_items())->map(function (WC_Order_Item $produit_commande) { + $produits = collect($commande->get_items())->map(static function (WC_Order_Item $produit_commande) { /** @var string $id_produit L'ID du Produit. */ $id_produit = $produit_commande['product_id']; @@ -72,7 +72,7 @@ try { // Récupère le nom et la valeur de l'attribut du Produit $attribut = $produit->is_type('variable') - ? collect($produit->get_attributes())->mapWithKeys(function ($_atr, $cle) use ($produit_commande) { + ? collect($produit->get_attributes())->mapWithKeys(static function ($_atr, $cle) use ($produit_commande) { $nom_attribut = wc_attribute_label($cle, $produit_commande->get_product()); $valeur_attribut = $produit_commande->get_product()->get_attribute($cle); @@ -83,7 +83,7 @@ try { return [ 'attribut' => $attribut, 'id_produit' => $id_produit, - 'image' => pipe($produit->get_image_id(), fn($id) => genere_balise_img_multiformats( + 'image' => pipe($produit->get_image_id(), static fn($id): string => genere_balise_img_multiformats( id: $id, lazy: true, )), @@ -114,7 +114,7 @@ try { filenames: $modeles, data: $contexte, ); -} catch (Error $e) { +} catch (Error $error) { http_response_code(500); - echo json_encode(['error' => esc_html($e->getMessage())]); + echo json_encode(['error' => esc_html($error->getMessage())]); } diff --git a/web/app/themes/haiku-atelier-2024/page-terms-and-conditions.php b/web/app/themes/haiku-atelier-2024/page-terms-and-conditions.php index ef557e4a..c33034d2 100755 --- a/web/app/themes/haiku-atelier-2024/page-terms-and-conditions.php +++ b/web/app/themes/haiku-atelier-2024/page-terms-and-conditions.php @@ -1,11 +1,9 @@ -defini_fonctionnalites_theme(...)); add_action('after_setup_theme', [$this, 'charge_traductions_theme']); - add_action('timber/context', [$this, 'ajoute_au_contexte_twig']); - add_action('timber/twig/environment/options', [$this, 'maj_environnement_twig']); + add_action('timber/context', $this->ajoute_au_contexte_twig(...)); + add_action('timber/twig/environment/options', $this->maj_environnement_twig(...)); parent::__construct(); } /** - * @param array $context + * @param array $context + * * @return array */ public function ajoute_au_contexte_twig(array $context): array { @@ -65,13 +66,13 @@ class StarterSite extends Site { $context['descriptions_produits'] = $descriptions_produits; // Logo personnalisée - $context['logo'] = pipe(get_theme_mod('custom_logo'), fn($id) => wp_get_attachment_image_src( + $context['logo'] = pipe(get_theme_mod('custom_logo'), static fn($id) => wp_get_attachment_image_src( attachment_id: $id, size: 'full', )); // Informations des Pages - $recupere_informations_page = function ($slug) { + $recupere_informations_page = static function ($slug) { $page = get_page_by_path($slug); return (object) ['nom' => $page->post_title ?? '', 'lien' => get_page_link($page?->ID)]; @@ -118,18 +119,18 @@ class StarterSite extends Site { $context['base_categorie_produit'] = get_option('woocommerce_permalinks')['category_base'] ?? ''; // Récupère les Catégories de Produits - $cree_entree_menu = fn($categorie) => [ + $cree_entree_menu = static fn($categorie): array => [ 'nom' => $categorie->name, 'slug' => $categorie->slug, // Détermine si l'URL courante est celle de la Page d'Archive d'une Catégorie de Produits 'courante' => preg_match( pattern: "/(\\b{$categorie->slug}\\b)/", - subject: pipe(URLHelper::get_current_url(), URLHelper::get_rel_url(...)), + subject: (string) pipe(URLHelper::get_current_url(), URLHelper::get_rel_url(...)), ), ]; $entrees_menu_categories = pipe( get_categories(['hide_empty' => false, 'orderby' => 'menu_order', 'taxonomy' => 'product_cat']), - fn($categories) => array_map( + static fn($categories): array => array_map( callback: $cree_entree_menu, array: $categories, ), @@ -178,7 +179,7 @@ class StarterSite extends Site { /** * Met à jour l'environnement de Twig. * - * @param array $options un tableau avec les options d'environnement + * @param array $options un tableau avec les options d'environnement */ public function maj_environnement_twig(array $options): array { return $options; diff --git a/web/app/themes/haiku-atelier-2024/src/inc/ControlesPersonnalises.php b/web/app/themes/haiku-atelier-2024/src/inc/ControlesPersonnalises.php index 8d32b79b..3c17134c 100755 --- a/web/app/themes/haiku-atelier-2024/src/inc/ControlesPersonnalises.php +++ b/web/app/themes/haiku-atelier-2024/src/inc/ControlesPersonnalises.php @@ -1,4 +1,5 @@ +
+ label); ?> + description)) { ?> + description); ?> + + +
+ -
- label); ?> - description)) { ?> - description); ?> - - -
- $configuration un tableau associatif de la configuration TinyMCE + * @param array $configuration un tableau associatif de la configuration TinyMCE + * * @return array le même tableau avec des configurations en plus */ function desactive_transformation_contenu_tinymce(array $configuration): array { @@ -32,7 +33,8 @@ function desactive_transformation_contenu_tinymce(array $configuration): array { /** * Autorise les imports en SVG dans la médiathèque. * - * @param array $file_types un tableau des types de fichiers autorisés dans la médiathèque + * @param array $file_types un tableau des types de fichiers autorisés dans la médiathèque + * * @return array le même tableau avec SVG en plus */ function autorise_import_svg_mediatheque(array $file_types): array { diff --git a/web/app/themes/haiku-atelier-2024/src/inc/FonctionnalitesWooCommerce.php b/web/app/themes/haiku-atelier-2024/src/inc/FonctionnalitesWooCommerce.php index ebbf1ff5..0f76b740 100755 --- a/web/app/themes/haiku-atelier-2024/src/inc/FonctionnalitesWooCommerce.php +++ b/web/app/themes/haiku-atelier-2024/src/inc/FonctionnalitesWooCommerce.php @@ -112,7 +112,7 @@ function retire_script_galerie(): void { remove_action('wp_head', 'wc_gallery_noscript'); } -function retire_merdes_wc() { +function retire_merdes_wc(): void { // remove WC generator tag remove_filter('get_the_generator_html', 'wc_generator_tag', 10, 2); remove_filter('get_the_generator_xhtml', 'wc_generator_tag', 10, 2); @@ -128,11 +128,11 @@ function retire_merdes_wc() { * Modifie la réponse REST pour un Produit en y ajoutant des balises pour chaque image d'intérêt. * * @param WP_REST_Response $response the response object - * @param WC_Data $product object data - * - * @return WP_REST_Response */ -function genere_balises_img_dans_produit_dans_reponse_rest($response, $_product) { +function genere_balises_img_dans_produit_dans_reponse_rest( + WP_REST_Response $response, + mixed $_product, +): WP_REST_Response { // Vérifie que la Réponse a des données if (empty($response->data)) { return $response; @@ -141,35 +141,35 @@ function genere_balises_img_dans_produit_dans_reponse_rest($response, $_product) // Génère la balise pour l'image au repos $response->data['image_repos'] = pipe( $response->data['meta_data'], - fn($metadata) => array_filter( + static fn($metadata): array => array_filter( array: $metadata, - callback: fn($entree) => '_photos_colonne_gauche|||0|value' === $entree->key, + callback: static fn($entree): bool => '_photos_colonne_gauche|||0|value' === $entree->key, ), - fn($metadata) => array_map( + static fn($metadata): array => array_map( array: $metadata, - callback: fn($entree) => genere_balise_img_multiformats( + callback: static fn($entree): string => genere_balise_img_multiformats( id: $entree?->value, lazy: true, ), ), - fn($image) => array_values(array: $image)[0], + static fn($image) => array_values(array: $image)[0], ); // Génère la balise pour l'image au survol $response->data['image_survol'] = pipe( $response->data['meta_data'], - fn($metadata) => array_filter( + static fn($metadata): array => array_filter( array: $metadata, - callback: fn($entree) => '_photos_colonne_droite|||0|value' === $entree->key, + callback: static fn($entree): bool => '_photos_colonne_droite|||0|value' === $entree->key, ), - fn($metadata) => array_map( + static fn($metadata): array => array_map( array: $metadata, - callback: fn($entree) => genere_balise_img_multiformats( + callback: static fn($entree): string => genere_balise_img_multiformats( id: $entree?->value, lazy: true, ), ), - fn($image) => array_values(array: $image)[0], + static fn($image) => array_values(array: $image)[0], ); return $response; @@ -179,20 +179,18 @@ add_filter('woocommerce_rest_prepare_product_object', 'genere_balises_img_dans_p /** * TODO. - * - * @param WP_REST_Response $reponse - * @param WC_Data $_produit - * - * @return WP_REST_Response */ -function genere_prix_maximal_produit_variable_dans_reponse_rest($reponse, $_produit) { +function genere_prix_maximal_produit_variable_dans_reponse_rest( + WP_REST_Response $reponse, + WC_Data $_produit, +): WP_REST_Response { // Vérifie que la Réponse a des données if (empty($reponse->data)) { return $reponse; } // Si le Produit n'est pas Variable, assigner le prix du Produit comme prix maximal - if ('variable' != $reponse->data['type']) { + if ('variable' !== $reponse->data['type']) { $reponse->data['prix_maximal'] = $reponse->data['regular_price']; return $reponse; @@ -200,7 +198,7 @@ function genere_prix_maximal_produit_variable_dans_reponse_rest($reponse, $_prod // Assigne le prix de la Variation la plus chère dans la Réponse $reponse->data['prix_maximal'] = collect($reponse->data['variations'])->map(wc_get_product(...))->map( - fn($p) => $p->get_price(), + static fn($p) => $p->get_price(), )->max(); return $reponse; diff --git a/web/app/themes/haiku-atelier-2024/src/inc/HTML.php b/web/app/themes/haiku-atelier-2024/src/inc/HTML.php index 236161d0..ec4ceba1 100755 --- a/web/app/themes/haiku-atelier-2024/src/inc/HTML.php +++ b/web/app/themes/haiku-atelier-2024/src/inc/HTML.php @@ -8,11 +8,8 @@ declare(strict_types=1); /** * Génère la balise `` d'un Média attaché à un Produit selon son ID. - * - * @param int $id_image - * @return string */ -function genere_balise_img($id_image) { +function genere_balise_img(int $id_image): string { return wp_get_attachment_image( attachment_id: $id_image, size: 'full', diff --git a/web/app/themes/haiku-atelier-2024/taxonomy-product_cat.php b/web/app/themes/haiku-atelier-2024/taxonomy-product_cat.php index 0feb6962..3d796f63 100755 --- a/web/app/themes/haiku-atelier-2024/taxonomy-product_cat.php +++ b/web/app/themes/haiku-atelier-2024/taxonomy-product_cat.php @@ -14,7 +14,7 @@ require_once __DIR__ . '/src/inc/TraitementInformations.php'; $contexte = Timber::context(); $modeles = ['boutique.twig']; -/** @var array $informations_produits Les informations brutes des Produits. */ +/** @var list $informations_produits Les informations brutes des Produits. */ $informations_produits = wc_get_products([ 'category' => [get_queried_object()?->slug], 'limit' => 12, diff --git a/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-completed-order.php b/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-completed-order.php index 4d5ea015..f2db1685 100755 --- a/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-completed-order.php +++ b/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-completed-order.php @@ -12,7 +12,7 @@ use Illuminate\Support\Str; use Timber\Timber; if (!defined('ABSPATH')) { - exit(); + exit; } // Initialise Timber @@ -23,10 +23,10 @@ Timber::$dirname = ['views']; $contexte = Timber::context(); $modeles = ['email-commande-envoyee.twig']; -// @var Order $commande La Commande issue du contexte contenu dans la variable $order. +/** @var Order $commande La Commande issue du contexte contenu dans la variable $order. */ $commande = $order; -// @var Carbon $date +/** @var Carbon $date */ $date = new Carbon($commande->get_date_created()); $email = [ diff --git a/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-invoice.php b/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-invoice.php index 56ac1546..c309d1b3 100755 --- a/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-invoice.php +++ b/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-invoice.php @@ -13,7 +13,7 @@ use Illuminate\Support\Str; use Timber\Timber; if (!defined('ABSPATH')) { - exit(); + exit; } // Initialise Timber @@ -41,7 +41,7 @@ $email = [ 'numero_suivi' => $commande->get_meta('tracking_number'), ], 'paiement' => ['methode' => ''], - 'produits' => collect($commande->get_items())->map(function (WC_Order_Item_Product $article) { + 'produits' => collect($commande->get_items())->map(static function (WC_Order_Item_Product $article) { $produit = $article->get_product(); if (is_bool($produit) || $produit === null) { @@ -52,7 +52,7 @@ $email = [ // Récupère l'Attribut d'un Produit variable ou renvoie un tableau vide 'attribut' => $produit->is_type('variable') ? collect($produit->get_attributes()) - ->mapWithKeys(fn($_atr, $cle) => [ + ->mapWithKeys(static fn($_atr, $cle): array => [ 'nom' => Str::lower(wc_attribute_label($cle, $produit)), 'valeur' => $produit->get_attribute($cle), ]) diff --git a/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-processing-order.php b/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-processing-order.php index 8bfab522..728a4a4b 100755 --- a/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-processing-order.php +++ b/web/app/themes/haiku-atelier-2024/woocommerce/emails/customer-processing-order.php @@ -13,7 +13,7 @@ use Illuminate\Support\Str; use Timber\Timber; if (!defined('ABSPATH')) { - exit(); + exit; } // Initialise Timber @@ -37,7 +37,7 @@ $email = [ ], 'commande' => ['date' => $date->toDateString(), 'id' => $commande->get_id()], 'paiement' => ['methode' => ''], - 'produits' => collect($commande->get_items())->map(function (WC_Order_Item_Product $article) { + 'produits' => collect($commande->get_items())->map(static function (WC_Order_Item_Product $article) { $produit = $article->get_product(); if (is_bool($produit) || $produit === null) { @@ -48,7 +48,7 @@ $email = [ // Récupère l'Attribut d'un Produit variable ou renvoie un tableau vide 'attribut' => $article->is_type('variable') ? collect($produit->get_attributes()) - ->mapWithKeys(fn($_atr, $cle) => [ + ->mapWithKeys(static fn($_atr, $cle): array => [ 'nom' => Str::lower(wc_attribute_label($cle, $produit)), 'valeur' => $produit->get_attribute($cle), ]) diff --git a/web/index.php b/web/index.php index 1466b207..339d02e9 100755 --- a/web/index.php +++ b/web/index.php @@ -1,4 +1,4 @@ -