@wasm-fmt/mago_fmt 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jsr.jsonc CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://jsr.io/schema/config-file.v1.json",
3
3
  "name": "@fmt/mago-fmt",
4
- "version": "0.7.0",
4
+ "version": "0.10.0",
5
5
  "exports": {
6
6
  ".": "./mago_fmt.js",
7
7
  "./esm": "./mago_fmt_esm.js",
package/mago_fmt_bg.wasm CHANGED
Binary file
@@ -51,7 +51,7 @@ export interface Settings {
51
51
 
52
52
  /**
53
53
  * End-of-line characters to use.
54
- * @default "lf"
54
+ * @default "auto"
55
55
  */
56
56
  "end-of-line"?: "auto" | "lf" | "crlf" | "cr";
57
57
 
@@ -438,6 +438,31 @@ export interface Settings {
438
438
  */
439
439
  "preserve-breaking-member-access-chain"?: boolean;
440
440
 
441
+ /**
442
+ * When preserving a broken object method chain, keep the first method call on the same line as the receiver.
443
+ *
444
+ * This only affects already-broken chains preserved by
445
+ * `"preserve-breaking-member-access-chain"`, and does not change the default
446
+ * breaking style for newly broken chains.
447
+ * @default false
448
+ *
449
+ * @example true
450
+ * ```php
451
+ * $object->method1()
452
+ * ->method2()
453
+ * ->method3();
454
+ * ```
455
+ *
456
+ * @example false
457
+ * ```php
458
+ * $object
459
+ * ->method1()
460
+ * ->method2()
461
+ * ->method3();
462
+ * ```
463
+ */
464
+ "preserve-breaking-member-access-chain-first-method-on-same-line"?: boolean;
465
+
441
466
  /**
442
467
  * Whether to preserve line breaks in argument lists, even if they could fit on a single line.
443
468
  * @default false
@@ -468,6 +493,15 @@ export interface Settings {
468
493
  */
469
494
  "preserve-breaking-conditional-expression"?: boolean;
470
495
 
496
+ /**
497
+ * Whether to preserve line breaks in condition expressions (if, elseif, while, do-while, switch, match).
498
+ *
499
+ * When enabled, if the original source has conditions broken across multiple lines,
500
+ * the formatter maintains that layout using PER Coding Style 3.0 rules.
501
+ * @default false
502
+ */
503
+ "preserve-breaking-condition-expression"?: boolean;
504
+
471
505
  /**
472
506
  * Whether to break a parameter list with one or more promoted properties into multiple lines.
473
507
  * @default true
@@ -537,6 +571,82 @@ export interface Settings {
537
571
  */
538
572
  "line-before-binary-operator"?: boolean;
539
573
 
574
+ /**
575
+ * Whether to indent continuation lines of binary expressions.
576
+ *
577
+ * When enabled, if a binary expression breaks across lines, the continuation
578
+ * is indented relative to the start of the expression:
579
+ * @default false
580
+ *
581
+ * @example true
582
+ * ```php
583
+ * $emailNotifications = $this->stringUtils->splitStringToArray($jobPosting->getVacancyEmailNotification())
584
+ * ?? [];
585
+ * ```
586
+ *
587
+ * @example false
588
+ * ```php
589
+ * $emailNotifications = $this->stringUtils->splitStringToArray($jobPosting->getVacancyEmailNotification())
590
+ * ?? [];
591
+ * ```
592
+ */
593
+ "indent-binary-expression-continuation"?: boolean;
594
+
595
+ /**
596
+ * Whether to omit redundant parentheses around arithmetic binary expressions under comparison and null coalesce expressions.
597
+ * @default false
598
+ *
599
+ * @example true
600
+ * ```php
601
+ * if ($i === $retries - 1) {
602
+ * }
603
+ * ```
604
+ *
605
+ * @example false
606
+ * ```php
607
+ * if ($i === ($retries - 1)) {
608
+ * }
609
+ * ```
610
+ */
611
+ "omit-redundant-arithmetic-binary-expression-parentheses"?: boolean;
612
+
613
+ /**
614
+ * Whether to omit redundant parentheses around bitwise binary child expressions.
615
+ * @default false
616
+ *
617
+ * @example true
618
+ * ```php
619
+ * if ($mask === $flags << 1) {
620
+ * }
621
+ * ```
622
+ *
623
+ * @example false
624
+ * ```php
625
+ * if ($mask === ($flags << 1)) {
626
+ * }
627
+ * ```
628
+ */
629
+ "omit-redundant-bitwise-binary-expression-parentheses"?: boolean;
630
+
631
+ /**
632
+ * Whether to preserve author-written parentheses around logical binary sub-expressions
633
+ * even when PHP's operator precedence makes them redundant.
634
+ * @default false
635
+ *
636
+ * @example true
637
+ * ```php
638
+ * if (($var1 > 200 && $var2 < 1) || ($var1 <= 200 && $var2 < 3)) {
639
+ * }
640
+ * ```
641
+ *
642
+ * @example false
643
+ * ```php
644
+ * if ($var1 > 200 && $var2 < 1 || $var1 <= 200 && $var2 < 3) {
645
+ * }
646
+ * ```
647
+ */
648
+ "preserve-redundant-logical-binary-expression-parentheses"?: boolean;
649
+
540
650
  /**
541
651
  * Whether to always break named argument lists into multiple lines.
542
652
  * @default false
@@ -566,6 +676,29 @@ export interface Settings {
566
676
  */
567
677
  "always-break-attribute-named-argument-lists"?: boolean;
568
678
 
679
+ /**
680
+ * Whether to align named arguments in multiline argument lists.
681
+ * @default false
682
+ *
683
+ * @example true
684
+ * ```php
685
+ * some_function(
686
+ * short: 1,
687
+ * longerName: 2,
688
+ * longestName: 3,
689
+ * );
690
+ * ```
691
+ */
692
+ "align-named-arguments"?: boolean;
693
+
694
+ /**
695
+ * Whether to align multiline function and method parameter lists by the variable column.
696
+ *
697
+ * This is especially useful for promoted constructor properties with visibility modifiers.
698
+ * @default false
699
+ */
700
+ "align-parameters"?: boolean;
701
+
569
702
  /**
570
703
  * Whether to use table-style alignment for arrays.
571
704
  * @default true
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "magic-akari <akari.ccino@gmail.com>"
6
6
  ],
7
7
  "description": "A WASM based PHP Formatter",
8
- "version": "0.8.0",
8
+ "version": "0.10.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",