diff --git a/crates/core/src/test.rs b/crates/core/src/test.rs index 8589458b9..88d9e71c7 100644 --- a/crates/core/src/test.rs +++ b/crates/core/src/test.rs @@ -12823,7 +12823,7 @@ fn php_simple_match() { pattern: r#" |language php | - |`echo ^match;` => `^match + ^match;` + |`echo ^x;` => `^x + ^x;` |"# .trim_margin() .unwrap(), @@ -12945,6 +12945,72 @@ fn php_delete_include() { .unwrap(); } +#[test] +fn php_function_modifier() { + run_test_expected( + TestArgExpected { + pattern: r#" + |language php + | + |`class ^_ { ^mod function ^name(){ ^_ } }` where { + | ^mod => `private`, + | ^name => `modified`, + |} + |"# + .trim_margin() + .unwrap(), + source: r#" + |class Log { + | public function printHello() + | { + | echo $this->public; + | echo $this->protected; + | echo $this->private; + | } + |} + |"# + .trim_margin(). + unwrap(), + expected: r#" + |class Log { + | private function modified() + | { + | echo $this->public; + | echo $this->protected; + | echo $this->private; + | } + |} + |"# + .trim_margin() + .unwrap(), + } + ) + .unwrap(); +} + +#[test] +fn php_rewrite_arrow_function() { + run_test_expected( + TestArgExpected { + pattern: r#" + |language php + | + |`fn(^a) => ^_` => `fn(^a) => $x * $x` + |"# + .trim_margin() + .unwrap(), + source: "$fn1 = fn($x) => $x + $y;" + .trim_margin(). + unwrap(), + expected: "$fn1 = fn($x) => $x * $x;" + .trim_margin() + .unwrap(), + } + ) + .unwrap(); +} + + #[test] fn css_property_value() { run_test_match(TestArg {