for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* HiPanel core package
*
* @link https://hipanel.com/
* @package hipanel-core
* @license BSD-3-Clause
* @copyright Copyright (c) 2014-2016, HiQDev (http://hiqdev.com/)
*/
namespace hipanel\base;
use Yii;
/**
* AHnames Lang to Yii2 i18n conversion.
class Lang
{
* AHNAMES Lang to Yii2 i18n.
* @param null $txt
$txt
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.
* @param string $path
* @return string
public static function t($str = null, $path = 'app')
$res = self::lang($str, $path);
return $res === $str ? Yii::t($str, $path) : $res;
}
public static function lang($txt = null, $path = 'app')
$path
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
__construct()
return preg_replace_callback('/{(lang):([^}]*)}/i', ['hipanel\base\Lang', 'translate'], $txt);
public static function translate($a, $path = 'app')
$str = $a[2];
$res = Yii::t('app', $str);
if (ctype_upper($str[0]) || ctype_upper($a[1][0])) {
$res = ucfirst($res);
return $res;
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
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.