@@ -5,6 +5,7 @@ exports[`match.php 1`] = `
55parsers: ["php"]
66phpVersion: "8.0"
77printWidth: 80
8+ trailingCommaPHP: false
89 | printWidth
910=====================================input======================================
1011<?php
@@ -65,3 +66,70 @@ $nest = match (match ($a) { true => 1, false => 2 }) {
6566
6667================================================================================
6768` ;
69+
70+ exports [` match.php 2` ] = `
71+ ====================================options=====================================
72+ parsers: ["php"]
73+ phpVersion: "8.0"
74+ printWidth: 80
75+ trailingCommaPHP: true
76+ | printWidth
77+ =====================================input======================================
78+ <?php
79+
80+ $really_really_really_long_variable_name = match(getValue()) {
81+ true => implode (' ,' ,[1 ,2 ,3 ]),
82+ false => $a || ' Empty' ,
83+ null => null ,
84+ default => throw new \\InvalidArgumentException (' Unknown Value' ),
85+ } ;
86+
87+ $boolStr = match($v) { true => ' true' , false => ' false' } ;
88+
89+ $boolish = match($v) {
90+ true , 1 => true ,
91+ false ,0 ,' ' ,null => false ,
92+ default => null
93+ } ;
94+
95+ $a = match(true) {
96+ test () => ' Good' ,
97+ test2 () => ' Two' ,
98+ default => ' fail'
99+ } ;
100+
101+ $nest = match(match($a) { true => 1 , false => 2 } ) {
102+ 1 => match ($b ) {
103+ 'ok' => true ,
104+ 'fail' => false ,
105+ default => false
106+ },
107+ 2 => ' null'
108+ } ;
109+ =====================================output=====================================
110+ <?php
111+
112+ $really_really_really_long_variable_name = match (getValue()) {
113+ true => implode (" ," , [1 , 2 , 3 ]),
114+ false => $a || " Empty" ,
115+ null => null ,
116+ default => throw new \\InvalidArgumentException (" Unknown Value" ),
117+ } ;
118+
119+ $boolStr = match ($v) { true => " true" , false => " false" } ;
120+
121+ $boolish = match ($v) {
122+ true , 1 => true ,
123+ false , 0 , " " , null => false ,
124+ default => null ,
125+ } ;
126+
127+ $a = match (true) { test () => " Good" , test2 () => " Two" , default => " fail" } ;
128+
129+ $nest = match (match ($a) { true => 1 , false => 2 } ) {
130+ 1 => match ($b ) { "ok" => true , "fail" => false , default => false },
131+ 2 => " null" ,
132+ } ;
133+
134+ ================================================================================
135+ ` ;
0 commit comments