corvée(formatage) màj de la configuration Mago

This commit is contained in:
gcch 2026-05-02 10:31:24 +02:00
commit 8e0ec560fd
34 changed files with 1108 additions and 847 deletions

View file

@ -24,15 +24,13 @@ return new Config()
'blank_line_after_namespace' => true,
'blank_lines_before_namespace' => ['min_line_breaks' => 1, 'max_line_breaks' => 2],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
'class_attributes_separation' => ['elements' => [
'case' => 'none',
'const' => 'none',
'method' => 'one',
'property' => 'one',
'trait_import' => 'none',
],
],
]],
'class_reference_name_casing' => true,
'clean_namespace' => true,
'combine_consecutive_issets' => true,
@ -56,7 +54,11 @@ return new Config()
'full_opening_tag' => true,
'fully_qualified_strict_types' => ['import_symbols' => true],
'function_to_constant' => true,
'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'heredoc_to_nowdoc' => true,
'integer_literal_case' => true,
'lambda_not_used_import' => true,
@ -75,7 +77,11 @@ return new Config()
'multiline_comment_opening_closing' => true,
'native_constant_invocation' => true,
'native_function_casing' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
'native_function_invocation' => [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
'strict' => true,
],
'native_type_declaration_casing' => true,
'new_expression_parentheses' => true,
'no_alias_functions' => ['sets' => ['@all']],
@ -95,8 +101,7 @@ return new Config()
'no_trailing_comma_in_singleline' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_braces' => ['namespaces' => true],
'no_unneeded_control_parentheses' => [
'statements' => [
'no_unneeded_control_parentheses' => ['statements' => [
'break',
'clone',
'continue',
@ -107,8 +112,7 @@ return new Config()
'switch_case',
'yield',
'yield_from',
],
],
]],
'no_unneeded_final_method' => true,
'no_unneeded_import_alias' => true,
'no_unreachable_default_argument_value' => true,
@ -139,9 +143,11 @@ return new Config()
'pow_to_exponentiation' => true,
'protected_to_private' => true,
'psr_autoloading' => true,
'random_api_migration' => [
'replacements' => ['getrandmax' => 'mt_getrandmax', 'rand' => 'mt_rand', 'srand' => 'mt_srand'],
],
'random_api_migration' => ['replacements' => [
'getrandmax' => 'mt_getrandmax',
'rand' => 'mt_rand',
'srand' => 'mt_srand',
]],
'return_assignment' => true,
'self_accessor' => true,
'self_static_accessor' => true,
@ -216,8 +222,7 @@ return new Config()
// The type of @return annotations of methods returning a reference to itself must the configured one.
'phpdoc_return_self_reference' => true,
// Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double.
'phpdoc_scalar' => [
'types' => [
'phpdoc_scalar' => ['types' => [
'boolean',
'callback',
'double',
@ -227,8 +232,7 @@ return new Config()
'no-return',
'real',
'str',
],
],
]],
// Annotations in PHPDoc should be grouped together so that annotations of the same type immediately follow each other. Annotations of a different type are separated by a single blank line.
'phpdoc_separation' => [
'groups' => [

View file

@ -3,8 +3,7 @@
"authors": [],
"autoload": {
"psr-4": {
"HaikuAtelier\\": "web/app/themes/haiku-atelier-2024/src/inc/",
"WooCommerce\\": "web/app/plugins/woocommerce"
"HaikuAtelier\\": "web/app/themes/haiku-atelier-2024/src/inc/"
}
},
"config": {

File diff suppressed because it is too large Load diff

View file

@ -36,6 +36,7 @@ threads = 0
no-else-clause = { enabled = false }
[analyzer]
allow-implicit-pipe-callable-types = false
allow-possibly-undefined-array-keys = false
allow-side-effects-in-conditions = true
analyze-dead-code = true

View file

@ -95,8 +95,7 @@ final class StarterSite extends Site {
$url_courante = URLHelper::get_current_url();
$context['page_courante'] = $url_courante;
$context['est_page_tous_produits'] = preg_match(pattern: '/(\bshop\b)/', subject: $url_courante);
$context['est_page_boutique'] =
preg_match(pattern: '/(\bshop\b)/', subject: $url_courante)
$context['est_page_boutique'] = preg_match(pattern: '/(\bshop\b)/', subject: $url_courante)
|| preg_match(pattern: '/(\bproduct\b)/', subject: $url_courante)
|| preg_match(pattern: '/(\bproduct-category\b)/', subject: $url_courante);

View file

@ -26,8 +26,10 @@ final readonly class Attribute {
public static function new(WC_Product_Attribute $attribute): self {
$name = wc_attribute_label($attribute->get_name());
$slug = $attribute->get_name();
/** @var list<WP_Term> */
$terms = $attribute->get_terms() ?? [];
/** @var list<AttributeOption> */
$options = Arr::map($terms, AttributeOption::new(...))
|> (static fn($options) => Arr::sort($options, static fn($attribute) => $attribute->id))

View file

@ -18,9 +18,12 @@ use function Psl\Option\from_nullable;
use function wc_get_products;
use function wpautop;
/**
* Représente un **Produit** (selon _WooCommerce_) avec de nombreuses données d'intérêt pour les opérations courantes.
*/
final readonly class Product {
/**
* @param list<Attribute> $attributes
* @param list<Attribute> $attributes La liste des `Attribute` appliquées.
* @param list<string> $left_column_photos
* @param list<string> $right_column_photos
* @param array<ProductVariation> $variations

View file

@ -84,8 +84,7 @@ final readonly class Resource {
static fn($tableau): array => array_map(array: $tableau, callback: static fn($chemin_format): array => [
'format' => pathinfo((string) $chemin_format)['extension'],
'taille' => filesize($chemin_format),
'url' =>
pathinfo($url)['dirname']
'url' => pathinfo($url)['dirname']
. '/'
. pathinfo($url)['filename']
. '.'

View file

@ -31,7 +31,10 @@ $commande = $order;
$date = new Carbon($commande->get_date_created());
$email = [
'adresses' => ['facturation' => $commande->get_address('billing'), 'livraison' => $commande->get_address('shipping')],
'adresses' => [
'facturation' => $commande->get_address('billing'),
'livraison' => $commande->get_address('shipping'),
],
'commande' => ['date' => $date->toDateString(), 'id' => $commande->get_id()],
'livraison' => [
'methode' => $commande->get_shipping_method(),