Browse Source

fixed postioning of property tags in php-doc command

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
df21e10c5d
  1. 14
      build/controllers/PhpDocController.php

14
build/controllers/PhpDocController.php

@ -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
$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) {

Loading…
Cancel
Save