Passed
Pull Request — master (#6735)
by Angel Fernando Quiroz
08:16
created

LdapController::connect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Controller\Ldap;
8
9
use Chamilo\CoreBundle\Helpers\AuthenticationConfigHelper;
10
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
11
use Symfony\Component\HttpFoundation\Response;
12
use Symfony\Component\Ldap\Ldap;
13
use Symfony\Component\Routing\Attribute\Route;
14
15
class LdapController extends AbstractController
16
{
17
    public function __construct(
18
        AuthenticationConfigHelper $authenticationConfigHelper,
19
    ) {
20
    }
21
22
    #[Route('/connect/ldap', name: 'chamilo.ldap_start')]
23
    public function connect(): Response
24
    {
25
        $ldap = Ldap::create('ext_ldap');
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Symfony\Component\HttpFoundation\Response. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
26
    }
27
}