Commit df21e10c by Carsten Brandt

fixed postioning of property tags in php-doc command

parent 14181b2b
...@@ -105,16 +105,18 @@ class PhpDocController extends Controller ...@@ -105,16 +105,18 @@ class PhpDocController extends Controller
if ($oldDoc != $newDoc) { if ($oldDoc != $newDoc) {
$fileContent = file($file); $fileContent = explode("\n", file_get_contents($file));
$start = $ref->getStartLine(); $start = $ref->getStartLine() - 2;
$docStart = $start - count(explode("\n", $oldDoc)); $docStart = $start - count(explode("\n", $oldDoc)) + 1;
$newFileContent = array(); $newFileContent = array();
foreach($fileContent as $i => $line) { $n = count($fileContent);
for($i = 0; $i < $n; $i++) {
if ($i > $start || $i < $docStart) { if ($i > $start || $i < $docStart) {
$newFileContent[] = $line; $newFileContent[] = $fileContent[$i];
} else { } else {
$newFileContent[] = trim($newDoc); $newFileContent[] = trim($newDoc);
$i = $start;
} }
} }
...@@ -163,7 +165,7 @@ class PhpDocController extends Controller ...@@ -163,7 +165,7 @@ class PhpDocController extends Controller
$propertyPart = false; $propertyPart = false;
} }
if (substr(trim($line), 0, 10) == '* @author ' && $propertyPosition === false) { if (substr(trim($line), 0, 10) == '* @author ' && $propertyPosition === false) {
$propertyPosition = $i; $propertyPosition = $i - 1;
$propertyPart = false; $propertyPart = false;
} }
if ($propertyPart) { if ($propertyPart) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment