You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a less simplified example demonstrating why someone might use this:
<?php
class A {
private static $cache = [];
private static function &GetCache() {
// Imagine that instead of returning the same cache, this instead
// was shared logic to decide one of a number of caches to return
return static::$cache;
}
public static function ClearCache() {
$cache = &static::GetCache();
$cache = [];
}
public static function InsertToCache($key, $value) {
$cache = &static::GetCache();
$cache[$key] = $value;
}
}
PHPMD warns about ClearCache. (Curiously, it doesn't warn about InsertToCache- testing elsewhere, it seems like an array insertion is considered using a variable?)
The text was updated successfully, but these errors were encountered:
Current Behavior
PHPMD doesn't seem to have special handling for variables that are references (though it does seem to handle reference parameters correctly).
However, $b is used.
#720 seems relevant but distinct.
Here's a less simplified example demonstrating why someone might use this:
PHPMD warns about ClearCache. (Curiously, it doesn't warn about InsertToCache- testing elsewhere, it seems like an array insertion is considered using a variable?)
The text was updated successfully, but these errors were encountered: