Showing 5 of 5 total issues
Avoid unused local variables such as '$value'. Open
Open
foreach ($details as $property => $value) {
- 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 unused private fields such as '$conference'. Open
Open
private string $conference;
- Read upRead up
- Exclude checks
UnusedPrivateField
Since: 0.2
Detects when a private field is declared and/or assigned a value, but not used.
Example
class Something
{
private static $FOO = 2; // Unused
private $i = 5; // Unused
private $j = 6;
public function addOne()
{
return $this->j++;
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield
Avoid unused private methods such as 'setPropertyIfExists'. Open
Open
private function setPropertyIfExists(array $details, string $property): void
{
$methodName = 'set'.ucfirst($property);
if (isset($details[$property]) && method_exists($this, $methodName)) {
$this->$methodName($details[$property]);
- Read upRead up
- Exclude checks
UnusedPrivateMethod
Since: 0.2
Unused Private Method detects when a private method is declared but is unused.
Example
class Something
{
private function foo() {} // unused
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod
Line exceeds 120 characters; contains 138 characters Open
Open
* @param DateTimeZone|string $timezone The timezone to set (can be a DateTimeZone object or a string representation of a timezone)
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
Open
* @return EventClassificationEnum Returns the EventClassification object representing the classification of the event.
- Exclude checks