diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index dca2156b61..c31270101d 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -170,7 +170,7 @@ class PhpDocController extends Controller $namespaceLine = ''; $contentAfterNamespace = false; foreach($lines as $i => $line) { - if (substr(trim($line), 0, 9) === 'namespace') { + if (substr_compare(trim($line), 'namespace', 0, 9) === 0) { $namespace = $i; $namespaceLine = trim($line); } elseif ($namespace !== false && trim($line) !== '') { @@ -275,13 +275,13 @@ class PhpDocController extends Controller // TODO move these checks to different action $lines = explode("\n", $newDoc); - if (trim($lines[1]) == '*' || substr(trim($lines[1]), 0, 3) == '* @') { + if (trim($lines[1]) == '*' || substr_compare(trim($lines[1]), '* @', 0, 3) === 0) { $this->stderr("[WARN] Class $className has no short description.\n", Console::FG_YELLOW, Console::BOLD); } foreach ($lines as $line) { - if (substr(trim($line), 0, 9) == '* @since ') { + if (substr_compare(trim($line), '* @since ', 0, 9) === 0) { $seenSince = true; - } elseif (substr(trim($line), 0, 10) == '* @author ') { + } elseif (substr_compare(trim($line), '* @author ', 0, 10) === 0) { $seenAuthor = true; } } @@ -350,13 +350,13 @@ class PhpDocController extends Controller $propertyPart = false; $propertyPosition = false; foreach ($lines as $i => $line) { - if (substr(trim($line), 0, 12) == '* @property ') { + if (substr_compare(trim($line), '* @property ', 0, 12) === 0) { $propertyPart = true; } elseif ($propertyPart && trim($line) == '*') { $propertyPosition = $i; $propertyPart = false; } - if (substr(trim($line), 0, 10) == '* @author ' && $propertyPosition === false) { + if (substr_compare(trim($line), '* @author ', 0, 10) === 0 && $propertyPosition === false) { $propertyPosition = $i - 1; $propertyPart = false; } diff --git a/extensions/apidoc/models/TypeDoc.php b/extensions/apidoc/models/TypeDoc.php index 12bbc5753c..80d31d91ee 100644 --- a/extensions/apidoc/models/TypeDoc.php +++ b/extensions/apidoc/models/TypeDoc.php @@ -46,7 +46,7 @@ class TypeDoc extends BaseDoc } } } - if (substr($subjectName, -2, 2) == '()') { + if (substr_compare($subjectName, '()', -2, 2) === 0) { return null; } if ($this->properties === null) { diff --git a/extensions/apidoc/renderers/BaseRenderer.php b/extensions/apidoc/renderers/BaseRenderer.php index 86ab186d0b..812cfd924a 100644 --- a/extensions/apidoc/renderers/BaseRenderer.php +++ b/extensions/apidoc/renderers/BaseRenderer.php @@ -72,7 +72,7 @@ abstract class BaseRenderer extends Component foreach ($types as $type) { $postfix = ''; if (!is_object($type)) { - if (substr($type, -2, 2) == '[]') { + if (substr_compare($type, '[]', -2, 2) === 0) { $postfix = '[]'; $type = substr($type, 0, -2); } diff --git a/extensions/apidoc/templates/html/views/seeAlso.php b/extensions/apidoc/templates/html/views/seeAlso.php index 5d6e3774c5..12d83c12fc 100644 --- a/extensions/apidoc/templates/html/views/seeAlso.php +++ b/extensions/apidoc/templates/html/views/seeAlso.php @@ -23,7 +23,7 @@ if (empty($see)) { } else { echo '

See also: