include/oninstall.php
xoops_module_pre_install_tag accesses the super-global variable $GLOBALS. Open
Open
function xoops_module_pre_install_tag(\XoopsModule $module): bool
{
$moduleDirName = \basename(\dirname(__DIR__));
$utility = new Tag\Utility();
//check for minimum XOOPS version
- 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
xoops_module_pre_install_tag accesses the super-global variable $GLOBALS. Open
Open
function xoops_module_pre_install_tag(\XoopsModule $module): bool
{
$moduleDirName = \basename(\dirname(__DIR__));
$utility = new Tag\Utility();
//check for minimum XOOPS version
- 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
Avoid unused local variables such as '$moduleDirName'. Open
Open
$moduleDirName = \basename(\dirname(__DIR__));
- 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 parameters such as '$module'. Open
Open
function xoops_module_install_tag(\XoopsModule $module): bool
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}