Completed
Push — master ( 6d6774...64f3ed )
by Jeroen
11:23 queued 05:13
created

AdminBundle/Controller/SettingsController.php (1 issue)

Checks whether return doc types can be made more specific.

Documentation Informational

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\AdminBundle\Controller;
4
5
use Symfony\Component\Routing\Annotation\Route;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
8
9
/**
10
 * Main settings controller
11
 */
12
class SettingsController extends BaseSettingsController
13
{
14
    /**
15
     * Index page for the settings
16
     *
17
     * @Route("/", name="KunstmaanAdminBundle_settings")
18
     * @Template("@KunstmaanAdmin/Settings/index.html.twig")
19
     *
20
     * @throws AccessDeniedException
21
     *
22
     * @return array
23
     */
24
    public function indexAction()
25
    {
26
        $this->denyAccessUnlessGranted('ROLE_ADMIN');
27
28
        return array();
29
    }
30
31
    /**
32
     * Show bundles version update information
33
     *
34
     * @Route("/bundle-version", name="KunstmaanAdminBundle_settings_bundle_version")
35
     * @Template("@KunstmaanAdmin/Settings/bundleVersion.html.twig")
36
     *
37
     * @throws AccessDeniedException
38
     *
39
     * @return array
0 ignored issues
show
Consider making the return type a bit more specific; maybe use array<string,null>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
40
     */
41
    public function bundleVersionAction()
42
    {
43
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');
44
45
        $versionChecker = $this->container->get('kunstmaan_admin.versionchecker');
46
        if (!$versionChecker->isEnabled()) {
47
            return array('data' => null);
48
        }
49
50
        $data = null;
51
52
        try {
53
            $data = $versionChecker->check();
54
        } catch (\Exception $e) {
55
            $this->container->get('logger')->error(
56
                $e->getMessage(),
57
                array('exception' => $e)
58
            );
59
        }
60
61
        return array(
62
            'data' => $data,
63
        );
64
    }
65
}
66