Move named inner function out in po2php.php

While PHP seems to be able to handle this construct, PHPStan don't. In
this case there's also no reason for this to be an inner function, so
just move it out to the global scope.
This commit is contained in:
Harald Eilertsen
2025-09-10 18:58:04 +02:00
parent b31123ae2f
commit a7e734b700

View File

@@ -1,5 +1,9 @@
<?php
function escape_s($match){
return str_replace('$','\$',$match[0]);
}
function po2php_run($argc,$argv) {
if ($argc < 2) {
@@ -42,10 +46,6 @@ function po2php_run($argc,$argv) {
$inv = False;
$escape_s_exp = '|[^\\\\]\$[a-z]|';
function escape_s($match){
return str_replace('$','\$',$match[0]);
}
foreach ($infile as $l) {
$l = str_replace(array('$projectname','$Projectname'),array('\$projectname','\$Projectname'),$l);
$len = strlen($l);