for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BFW\Install;
use bultonFr\Utils\Files\ReadDirectory;
/**
* Class use to detect modules in a directory and sub-directories
*/
class ReadDirLoadModule extends ReadDirectory
{
* {@inheritdoc}
protected function itemAction(string $fileName, string $pathToFile): string
//Call parent method to check ignored files
$parentAction = parent::itemAction($fileName, $pathToFile);
if (!empty($parentAction)) {
return $parentAction;
}
//Detect the file containing module infos
if ($fileName === 'bfwModulesInfos.json') {
$this->list[] = $pathToFile;
return 'break';
return '';
protected function dirAction(string $dirPath)
if (preg_match('/test(s?)$/', $dirPath) === 1) {
return;
return parent::dirAction($dirPath);
parent::dirAction($dirPath)
bultonFr\Utils\Files\ReadDirectory::dirAction()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.