phossa2/cache

View on GitHub
src/Cache/CacheItem.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '210', column '20').
Open

        return new \DateTime('@' . $this->expire);
Severity: Minor
Found in src/Cache/CacheItem.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Remove error control operator '@' on line 292.
Open

    protected function postGetValue()
    {
        if (is_null($this->value)) {
            $val = @unserialize($this->strval);
            $this->value = false === $val ? $this->strval : $val;
Severity: Minor
Found in src/Cache/CacheItem.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

There are no issues that match your filters.

Category
Status