for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace hidev\helpers;
class Sys
{
public static function mkdir(string $dir)
self::passthru("mkdir -p $dir");
}
public static function chmod($mode, $path)
self::passthru("sudo chmod $mode $path");
public static function passthru(string $cmd)
echo "> $cmd\n";
$res = \passthru($cmd, $exitcode);
$res
passthru($cmd, $exitcode)
null
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
class A { function getObject() { return null; } } $a = new A(); $object = $a->getObject();
The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
if ($exitcode) {
echo "! failed $cmd";
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.