From df21e10c5d7047b890c428954e903494887f9e25 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 28 Aug 2013 11:51:19 +0200 Subject: [PATCH] fixed postioning of property tags in php-doc command --- build/controllers/PhpDocController.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index 7f1ba58..17dcca7 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -105,16 +105,18 @@ class PhpDocController extends Controller if ($oldDoc != $newDoc) { - $fileContent = file($file); - $start = $ref->getStartLine(); - $docStart = $start - count(explode("\n", $oldDoc)); + $fileContent = explode("\n", file_get_contents($file)); + $start = $ref->getStartLine() - 2; + $docStart = $start - count(explode("\n", $oldDoc)) + 1; $newFileContent = array(); - foreach($fileContent as $i => $line) { + $n = count($fileContent); + for($i = 0; $i < $n; $i++) { if ($i > $start || $i < $docStart) { - $newFileContent[] = $line; + $newFileContent[] = $fileContent[$i]; } else { $newFileContent[] = trim($newDoc); + $i = $start; } } @@ -163,7 +165,7 @@ class PhpDocController extends Controller $propertyPart = false; } if (substr(trim($line), 0, 10) == '* @author ' && $propertyPosition === false) { - $propertyPosition = $i; + $propertyPosition = $i - 1; $propertyPart = false; } if ($propertyPart) {