mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Exclude functions and closures from scope conversion #2617
This commit is contained in:
parent
50dd010e2d
commit
8e5480674d
4 changed files with 88 additions and 0 deletions
|
|
@ -62,6 +62,27 @@
|
|||
<span @style(['a' => false, 'b' => false])></span>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$employees = [
|
||||
['name' => 'Alice', 'age' => 30],
|
||||
['name' => 'Bob', 'age' => 25],
|
||||
['name' => 'Charlie', 'age' => 35],
|
||||
];
|
||||
$suffix = '님';
|
||||
$names = array_map(function($e, $key = 'name') use ($suffix) {
|
||||
return $e[$key] . $suffix;
|
||||
}, $employees);
|
||||
function convert_names(array $names = array()): array
|
||||
{
|
||||
return array_map(function($name) {
|
||||
return ucfirst($name);
|
||||
}, $names);
|
||||
}
|
||||
@endphp
|
||||
<div class="employees">
|
||||
{{ implode(', ', convert_names($names)) }} welcome!
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
const foo = '{{ $foo }}';
|
||||
const bar = @json($bar);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue