/** * Process the subpackage tag. * * @param int $errorpos The line number where the error occurs. * * @return void */ protected function processsubpackage($errorpos) { $package = $this->commentparser->getSubpackage(); if ($package !== null) { $content = $package->getcontent(); if ($content !== '') { if (PHP_CodeSniffer::isUnderscorename($content) !== true) { $newcontent = str_replace(' ', '_', $content); $namebits = explode('_', $newcontent); $firstbit = array_shift($namebits); $newname = strtoupper($firstbit[0]) . substr($firstbit, 1) . '_'; foreach ($namebits as $bit) { $newname .= strtoupper($bit[0]) . substr($bit, 1) . '_'; } $validname = trim($newname, '_'); $error = "Subpackage name \"{$content}\" is not valid; consider \"{$validname}\" instead"; // $this->currentfile->adderror($error, $errorpos); } } else { $error = '@subpackage tag must contain a name'; $this->currentfile->adderror($error, $errorpos); } } }