Completed
Pull Request — master (#28)
by
unknown
19:12 queued 09:24
created

PDOConnection::requiresQueryForServerVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Licensed to CRATE Technology GmbH("Crate") under one or more contributor
4
 * license agreements.  See the NOTICE file distributed with this work for
5
 * additional information regarding copyright ownership.  Crate licenses
6
 * this file to you under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.  You may
8
 * obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15
 * License for the specific language governing permissions and limitations
16
 * under the License.
17
 *
18
 * However, if you have executed another commercial license agreement
19
 * with Crate these terms will supersede the license and you may use the
20
 * software solely pursuant to the terms of the relevant commercial agreement.
21
 */
22
23
namespace Crate\DBAL\Driver\PDOCrate;
24
25
use Crate\PDO\PDO;
26
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
27
28
class PDOConnection extends PDO implements ServerInfoAwareConnection
29
{
30
    /**
31
     * @param string $dsn
32
     * @param string $user
33
     * @param string $password
34
     * @param array $options
35 6
     */
36
    public function __construct($dsn, $user = null, $password = null, array $options = null)
37 6
    {
38 6
        parent::__construct($dsn, $user, $password, $options);
0 ignored issues
show
Bug introduced by
It seems like $user defined by parameter $user on line 36 can also be of type string; however, Crate\PDO\PDO::__construct() does only seem to accept null, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $password defined by parameter $password on line 36 can also be of type string; however, Crate\PDO\PDO::__construct() does only seem to accept null, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
39 6
        $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
40
    }
41
42
    /**
43
     * Checks whether a query is required to retrieve the database server version.
44
     *
45
     * @return boolean True if a query is required to retrieve the database server version, false otherwise.
46
     */
47
    public function requiresQueryForServerVersion()
48
    {
49
        return false;
50
    }
51
}
52