From 9a04e8f766e4c1598e0ba270882f4c713caa60f0 Mon Sep 17 00:00:00 2001 From: Matthias Glaub Date: Fri, 18 Apr 2014 10:28:17 +0200 Subject: [PATCH 1/3] replaced preg_replace with modifier e by preg_replace_callback to avoid deprecated warning on classmap generation --- src/ZFTool/Controller/ClassmapController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ZFTool/Controller/ClassmapController.php b/src/ZFTool/Controller/ClassmapController.php index 67ed521..30d6181 100644 --- a/src/ZFTool/Controller/ClassmapController.php +++ b/src/ZFTool/Controller/ClassmapController.php @@ -189,9 +189,11 @@ public function generateAction() $maxWidth = max($maxWidth, strlen($match[1])); } - $content = preg_replace('(\n\s+([^=]+)=>)e', "'\n \\1' . str_repeat(' ', " . $maxWidth . " - strlen('\\1')) . '=>'", $content); + $content = preg_replace_callback('(\n\s+([^=]+)=>)', function ($match) use ($maxWidth) { + return PHP_EOL . ' ' . $match[1] . str_repeat(' ', $maxWidth - strlen($match[1])) . '=>'; + }, $content); - if (!$usingStdout) { + if (!$usingStdout) { $console->writeLine(" DONE" . PHP_EOL, Color::GREEN); $console->write('Writing classmap to '); $console->write($output, Color::LIGHT_WHITE); From 44c88c2a63c4f8069175660e22ccde1ecbbe28df Mon Sep 17 00:00:00 2001 From: Matthias Glaub Date: Fri, 18 Apr 2014 10:35:12 +0200 Subject: [PATCH 2/3] cs fixes --- src/ZFTool/Controller/ClassmapController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ZFTool/Controller/ClassmapController.php b/src/ZFTool/Controller/ClassmapController.php index 30d6181..ef9e4c7 100644 --- a/src/ZFTool/Controller/ClassmapController.php +++ b/src/ZFTool/Controller/ClassmapController.php @@ -190,10 +190,10 @@ public function generateAction() } $content = preg_replace_callback('(\n\s+([^=]+)=>)', function ($match) use ($maxWidth) { - return PHP_EOL . ' ' . $match[1] . str_repeat(' ', $maxWidth - strlen($match[1])) . '=>'; - }, $content); + return PHP_EOL . ' ' . $match[1] . str_repeat(' ', $maxWidth - strlen($match[1])) . '=>'; + }, $content); - if (!$usingStdout) { + if (!$usingStdout) { $console->writeLine(" DONE" . PHP_EOL, Color::GREEN); $console->write('Writing classmap to '); $console->write($output, Color::LIGHT_WHITE); From 9189fc088c891e83af65e0c8d473befc297215fb Mon Sep 17 00:00:00 2001 From: Matthias Glaub Date: Sat, 19 Apr 2014 20:45:16 +0200 Subject: [PATCH 3/3] replaced PHP_EOL with \n --- src/ZFTool/Controller/ClassmapController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZFTool/Controller/ClassmapController.php b/src/ZFTool/Controller/ClassmapController.php index ef9e4c7..e51307d 100644 --- a/src/ZFTool/Controller/ClassmapController.php +++ b/src/ZFTool/Controller/ClassmapController.php @@ -190,7 +190,7 @@ public function generateAction() } $content = preg_replace_callback('(\n\s+([^=]+)=>)', function ($match) use ($maxWidth) { - return PHP_EOL . ' ' . $match[1] . str_repeat(' ', $maxWidth - strlen($match[1])) . '=>'; + return "\n " . $match[1] . str_repeat(' ', $maxWidth - strlen($match[1])) . '=>'; }, $content); if (!$usingStdout) {