diff --git a/example/android/AddIntDef.php b/example/android/AddIntDef.php index e6b2bdfc9..d4ae4a65b 100644 --- a/example/android/AddIntDef.php +++ b/example/android/AddIntDef.php @@ -12,7 +12,7 @@ 'import androidx.annotation.Nullable;'.PHP_EOL. PHP_EOL. 'import java.lang.annotation.Retention;'.PHP_EOL. - 'import java.lang.annotation.RetentionPolicy;', $file); + 'import java.lang.annotation.RetentionPolicy;'.PHP_EOL, $file); preg_match_all('/public static class ([A-Za-z0-9]+) extends ([A-Za-z0-9]+)/', $file, $matches, PREG_SET_ORDER); $children = []; @@ -21,13 +21,20 @@ continue; } - $children[$val[2]][] = PHP_EOL.' '.$val[1].'.CONSTRUCTOR'; + $children[$val[2]][] = ' '.$val[1].'.CONSTRUCTOR'; } $file = preg_replace_callback('/public abstract static class ([A-Za-z0-9]+)()? extends Object [{]/', function ($val) use ($children) { - return $val[0].PHP_EOL.' @Retention(RetentionPolicy.SOURCE)'.PHP_EOL.' @IntDef({'.implode(',', $children[$val[1]]).<<<'EOL' + $values = implode(','.PHP_EOL, $children[$val[1]]); + return $val[0].<<