Issues (54)

src/Install/ReadDirLoadModule.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace BFW\Install;
4
5
use bultonFr\Utils\Files\ReadDirectory;
6
7
/**
8
 * Class use to detect modules in a directory and sub-directories
9
 */
10
class ReadDirLoadModule extends ReadDirectory
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    protected function itemAction(string $fileName, string $pathToFile): string
16
    {
17
        //Call parent method to check ignored files
18
        $parentAction = parent::itemAction($fileName, $pathToFile);
19
20
        if (!empty($parentAction)) {
21
            return $parentAction;
22
        }
23
24
        //Detect the file containing module infos
25
        if ($fileName === 'bfwModulesInfos.json') {
26
            $this->list[] = $pathToFile;
27
28
            return 'break';
29
        }
30
31
        return '';
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    protected function dirAction(string $dirPath)
38
    {
39
        if (preg_match('/test(s?)$/', $dirPath) === 1) {
40
            return;
41
        }
42
43
        return parent::dirAction($dirPath);
0 ignored issues
show
Are you sure the usage of parent::dirAction($dirPath) targeting bultonFr\Utils\Files\ReadDirectory::dirAction() seems to always return null.

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.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
44
    }
45
}
46