GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (246)

tests/bootstrap.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
require __DIR__ . '/xdebug-filter.php';
6
7
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest;
0 ignored issues
show
This use statement conflicts with another class in this namespace, AbstractTest. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
8
use Symfony\Component\Filesystem\Filesystem;
9
10
/**
11
 * Empty out the var path of everything but the .gitignore file
12
 *
13
 * Will reinstate an existing .gitignore or default to a standard one
14
 *
15
 * Set error handler to convert everythign to Exceptions. PHPUnit is supposed to do this but is not reliable
16
 *
17
 * @throws ReflectionException
18
 */
19
(static function () {
20
    $filesystem = new Filesystem();
21
    if (!is_dir(AbstractTest::VAR_PATH)) {
22
        $filesystem->mkdir(AbstractTest::VAR_PATH);
23
    }
24
    $gitIgnorePath = AbstractTest::VAR_PATH . '/.gitignore';
25
    if ($filesystem->exists($gitIgnorePath)) {
26
        $gitIgnore = file_get_contents(AbstractTest::VAR_PATH . '/.gitignore');
27
    } else {
28
        $gitIgnore = "*\n!.gitignore\n";
29
    }
30
    $filesystem->remove(AbstractTest::VAR_PATH);
31
    $filesystem->mkdir(AbstractTest::VAR_PATH);
32
    file_put_contents(AbstractTest::VAR_PATH . '/.gitignore', $gitIgnore);
33
34
    set_error_handler(static function ($errno, $errstr, $errfile, $errline) {
35
        $type = 'ERROR';
36
        switch ($errno) {
37
            case E_USER_NOTICE:
38
                $type = 'NOTICE';
39
                break;
40
            case E_USER_WARNING:
41
                $type = 'WARNING';
42
                break;
43
            case E_USER_DEPRECATED:
44
                $type = 'DEPRECATED';
45
                if (false !== strpos($errstr, 'Doctrine\Common\ClassLoader is deprecated')) {
46
                    return true;
47
                }
48
                break;
49
        }
50
        throw new ErrorException("$type\n$errstr\non line $errline\nin file  $errfile\n");
51
    });
52
})();
53