Issues (1426)

app/src/Controller/DocController.php (22 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace Db3v4l\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
0 ignored issues
show
The type Symfony\Bundle\Framework...ller\AbstractController was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\Routing\Annotation\Route;
0 ignored issues
show
The type Symfony\Component\Routing\Annotation\Route was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
9
 * @Route("/doc")
10
 */
0 ignored issues
show
Missing @category tag in class comment
Loading history...
Missing @package tag in class comment
Loading history...
Missing @author tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
11
class DocController extends AbstractController
12
{
13
    /// @todo get this injected
14
    protected $docRoot = '/var/www/doc';
15
16
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
17
     * @Route("/list", name="doc_list")
18
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
19
    public function list()
20
    {
21
        $docs = glob($this->docRoot . '/*.md');
22
        array_walk($docs, function(&$path, $key) {$path = basename($path);});
0 ignored issues
show
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

22
        array_walk($docs, function(&$path, /** @scrutinizer ignore-unused */ $key) {$path = basename($path);});

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
It seems like $docs can also be of type false; however, parameter $array of array_walk() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        array_walk(/** @scrutinizer ignore-type */ $docs, function(&$path, $key) {$path = basename($path);});
Loading history...
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Opening brace must be the last content on the line
Loading history...
Closing brace must be on a line by itself
Loading history...
23
        return $this->render('Doc/list.html.twig', ['docs' => $docs]);
24
    }
25
26
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
27
     * @Route("/view/{filename}", name="doc_view")
28
     *
29
     * @param string $filename
0 ignored issues
show
Parameter tags must be defined first in a doc comment
Loading history...
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
30
     * @return \Symfony\Component\HttpFoundation\Response
0 ignored issues
show
The type Symfony\Component\HttpFoundation\Response was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
31
     */
32
    public function displayFile($filename)
33
    {
34
        // sanitize
35
        $filename = basename($filename);
36
37
        $filename = $this->docRoot . '/' . $filename;
38
39
        if (!is_file($filename)) {
40
            throw $this->createNotFoundException("The doc file '$filename' does not exist");
41
        }
42
43
        /// @todo allow different types of doc format
44
        return $this->render('Doc/File/markdown.html.twig', ['file' => basename($filename), 'markup' => file_get_contents($filename)]);
45
    }
46
}
47