attogram/shared-media-sandbox

View on GitHub
src/Sandbox.php

Summary

Maintainability
A
0 mins
Test Coverage

Suspicious type null of a variable or expression used to build a string. (Expected type to be able to cast to a string)
Open

            $form .= '<br />' . $this->action[2]
Severity: Minor
Found in src/Sandbox.php by phan

Returning type object but getClass() is declared to return bool
Open

        return new $this->class($this->logger);
Severity: Minor
Found in src/Sandbox.php by phan

Invalid offset 2 of array type array{}
Open

            $form .= '<br />' . $this->action[2]
Severity: Minor
Found in src/Sandbox.php by phan

Argument 1 (object) is bool but \get_class() takes object
Open

        $this->logger->debug('SANDBOX: class: '.get_class($class));
Severity: Minor
Found in src/Sandbox.php by phan

Invalid offset 2 of array type array{}
Open

        if (isset($this->action[2]) && $this->action[2]) { // Requires argument
Severity: Minor
Found in src/Sandbox.php by phan

Call to method format on non-class type string
Open

                    $response = $class->format($results);
Severity: Critical
Found in src/Sandbox.php by phan

Invalid offset 3 of array type array{}
Open

        if (isset($this->action[3]) && $this->action[3]) { // Requires Identifier
Severity: Minor
Found in src/Sandbox.php by phan

Suspicious type void of a variable or expression used to build a string. (Expected type to be able to cast to a string)
Open

                $response = '<pre>' . var_dump($results) . '</pre>';
Severity: Minor
Found in src/Sandbox.php by phan

Cannot assign void return value
Open

                $response = var_dump($results);
Severity: Info
Found in src/Sandbox.php by phan

The 'getClass()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    protected function getClass()
    {
        $classNames = array_unique(array_column($this->methods, '0'));
        if (!in_array($this->class, $classNames)) {
            $this->logger->critical('getClass: Class Denied:', [$this->class]);
Severity: Minor
Found in src/Sandbox.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

There are no issues that match your filters.

Category
Status