set_flash accesses the super-global variable $_SESSION. Open
function set_flash(array $input)
{
$has_flash = !isset($_SESSION['_flash']) || !is_array($_SESSION['_flash']);
$flash = $has_flash ? $_SESSION['_flash'] : [];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
set_flash accesses the super-global variable $_SESSION. Open
function set_flash(array $input)
{
$has_flash = !isset($_SESSION['_flash']) || !is_array($_SESSION['_flash']);
$flash = $has_flash ? $_SESSION['_flash'] : [];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
set_flash accesses the super-global variable $_SESSION. Open
function set_flash(array $input)
{
$has_flash = !isset($_SESSION['_flash']) || !is_array($_SESSION['_flash']);
$flash = $has_flash ? $_SESSION['_flash'] : [];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
set_flash accesses the super-global variable $_SESSION. Open
function set_flash(array $input)
{
$has_flash = !isset($_SESSION['_flash']) || !is_array($_SESSION['_flash']);
$flash = $has_flash ? $_SESSION['_flash'] : [];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Missing class import via use statement (line '39', column '16'). Open
$var = new variables($data);
- Read upRead up
- Exclude checks
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
Missing class import via use statement (line '35', column '19'). Open
throw new \RuntimeException("Template file not exists: {$tpl_name}");
- Read upRead up
- Exclude checks
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
Missing class import via use statement (line '120', column '24'). Open
$logger = new \Monolog\Logger('');
- Read upRead up
- Exclude checks
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
Missing class import via use statement (line '104', column '23'). Open
$logger = new \Monolog\Logger('');
- Read upRead up
- Exclude checks
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
Call to method __construct
from undeclared class \Monolog\Logger
Open
$logger = new \Monolog\Logger('');
- Exclude checks
Call to method pushHandler
from undeclared class \Monolog\Logger
Open
$logger->pushHandler(new StreamHandler($fp, Logger::INFO, true, null, true));
- Exclude checks
Return type of chrome_log()
is undeclared type \Monolog\Logger
Open
function chrome_log()
- Exclude checks
Call to method pushHandler
from undeclared class \Monolog\Logger
Open
$logger->pushHandler($handler);
- Exclude checks
Return type of router()
is undeclared type \Teto\Routing\Router
Open
function router(Router $router = null)
- Exclude checks
Call to method __construct
from undeclared class \Monolog\Handler\ChromePHPHandler
Open
$handler = is_production() ? new NoopHandler : new ChromePHPHandler(Logger::INFO);
- Exclude checks
Doc-block of $flash
in last_flash
is phpdoc param type array
which is not a permitted replacement of the nullable param type ?array
declared in the signature ('?T' should be documented as 'T|null' or '?T') Open
* @param array $flash
- Exclude checks
Reference to constant INFO
from undeclared class \Monolog\Logger
Open
$logger->pushHandler(new StreamHandler($fp, Logger::INFO, true, null, true));
- Exclude checks
Call to method __construct
from undeclared class \Monolog\Handler\StreamHandler
Open
$logger->pushHandler(new StreamHandler($fp, Logger::INFO, true, null, true));
- Exclude checks
Parameter $router
has undeclared type ?\Teto\Routing\Router
Open
function router(Router $router = null)
- Exclude checks
Return type of app_log()
is undeclared type \Monolog\Logger
Open
function app_log()
- Exclude checks
Call to method __construct
from undeclared class \Monolog\Logger
Open
$logger = new \Monolog\Logger('');
- Exclude checks
Reference to constant INFO
from undeclared class \Monolog\Logger
Open
$handler = is_production() ? new NoopHandler : new ChromePHPHandler(Logger::INFO);
- Exclude checks
Call to method __construct
from undeclared class \Monolog\Handler\NoopHandler
Open
$handler = is_production() ? new NoopHandler : new ChromePHPHandler(Logger::INFO);
- Exclude checks
Doc-block of $router
in router
is phpdoc param type \Teto\Routing\Router
which is not a permitted replacement of the nullable param type ?\Teto\Routing\Router
declared in the signature ('?T' should be documented as 'T|null' or '?T') Open
* @param Router $router
- Exclude checks
Avoid using short method names like ::h(). The configured minimum method name length is 3. Open
function h($input)
{
return htmlspecialchars($input, ENT_QUOTES, 'UTF-8');
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}