Giving this code snippet:
<?php function foo() { $bar = 123; // The variable '$bar' is assigned, but its value is never usedPHP(PHP0421) $baz = fn () => fn () => $bar; $baz(); }
The PHP0421 error is thrown — it's a bug
using v1.20.10937
thank you for reporting the issue, this has been fixed recently.