for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sepia\PoParser\Catalog;
class EntryFactory
{
/**
* @param array $entry
$entry
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @return Entry
*/
public static function createFromArray(array $entryArray)
$entry = new Entry(
$entryArray['msgid'],
isset($entryArray['msgstr']) ? $entryArray['msgstr'] : null
);
$plurals = array();
foreach ($entryArray as $key => $value) {
switch (true) {
case $key === 'msgctxt':
$entry->setMsgCtxt($entryArray['msgctxt']);
break;
case $key === 'flags':
$entry->setFlags($entryArray['flags']);
case $key === 'reference':
$entry->setReference($entryArray['reference']);
case $key === 'previous':
$entry->setPreviousEntry(self::createFromArray($entryArray['previous']));
case $key === 'tcomment':
$entry->setTranslatorComments($value);
case $key === 'ccomment':
$entry->setDeveloperComments($value);
case $key === 'obsolete':
$entry->setObsolete(true);
case 0 === strpos($key, 'msgstr['):
$plurals[] = $value;
}
if (count($plurals) > 0) {
$entry->setMsgStrPlurals($plurals);
return $entry;
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.