src/util/FlagCache.php
Avoid using undefined variables such as '$aFullName' which will lead to PHP notices. Open
Open
$idx = $f->GetIdxByName($aName, $aFullName);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid unused local variables such as '$aFullName'. Open
Open
$idx = $f->GetIdxByName($aName, $aFullName);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid variables with short names like $f. Configured minimum length is 3. Open
Open
$f = self::$_gFlagCache[$aSize];
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Property name "$_gFlagCache" should not be prefixed with an underscore to indicate visibility Open
Open
private static $_gFlagCache = [
- Exclude checks
Method name "FlagCache::GetFlagImgByName" is not in camel caps format Open
Open
public static function GetFlagImgByName($aSize, $aName)
- Exclude checks