Failed Conditions
Pull Request — master (#3087)
by Grégoire
117:30 queued 52:53
created

bin/doctrine-dbal.php (2 issues)

1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
use Symfony\Component\Console\Helper\HelperSet;
0 ignored issues
show
The type Symfony\Component\Console\Helper\HelperSet 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...
21
use Doctrine\DBAL\Tools\Console\ConsoleRunner;
0 ignored issues
show
The type Doctrine\DBAL\Tools\Console\ConsoleRunner 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...
22
23
$files       = array(__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php');
24
$loader      = null;
25
$cwd         = getcwd();
26
$directories = array($cwd, $cwd . DIRECTORY_SEPARATOR . 'config');
27
$configFile  = null;
28
29
foreach ($files as $file) {
30
    if (file_exists($file)) {
31
        $loader = require $file;
32
33
        break;
34
    }
35
}
36
37
if ( ! $loader) {
38
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
39
}
40
41
foreach ($directories as $directory) {
42
    $configFile = $directory . DIRECTORY_SEPARATOR . 'cli-config.php';
43
44
    if (file_exists($configFile)) {
45
        break;
46
    }
47
}
48
49
if ( ! file_exists($configFile)) {
50
    ConsoleRunner::printCliConfigTemplate();
51
52
    exit(1);
53
}
54
55
if ( ! is_readable($configFile)) {
56
    echo 'Configuration file [' . $configFile . '] does not have read permission.' . PHP_EOL;
57
58
    exit(1);
59
}
60
61
$commands  = array();
62
$helperSet = require $configFile;
63
64
if ( ! $helperSet instanceof HelperSet) {
65
    foreach ($GLOBALS as $helperSetCandidate) {
66
        if ($helperSetCandidate instanceof HelperSet) {
67
            $helperSet = $helperSetCandidate;
68
69
            break;
70
        }
71
    }
72
}
73
74
ConsoleRunner::run($helperSet, $commands);
75