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.
Completed
Push — master ( 34546e...94b458 )
by
unknown
13s
created

src/EventListener/ORM/ConfirmableListener.php (1 issue)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\Doctrine\EventListener\ORM;
13
14
use Core23\Doctrine\Model\Traits\ConfirmableTrait;
15
use Core23\Doctrine\Util\ClassUtils;
16
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
17
use Doctrine\ORM\Events;
18
use Doctrine\ORM\Mapping\ClassMetadata;
19
use Doctrine\ORM\Mapping\MappingException;
20
use LogicException;
21
22
final class ConfirmableListener extends AbstractListener
23
{
24
    public function getSubscribedEvents()
25
    {
26
        return [
27
            Events::loadClassMetadata,
28
        ];
29
    }
30
31
    /**
32
     * @throws MappingException
33
     */
34
    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
35
    {
36
        $meta = $eventArgs->getClassMetadata();
37
38
        if (!$meta instanceof ClassMetadata) {
0 ignored issues
show
$meta is always a sub-type of Doctrine\ORM\Mapping\ClassMetadata.
Loading history...
39
            throw new LogicException('Class metadata was no ORM');
40
        }
41
42
        $reflClass = $meta->getReflectionClass();
43
44
        if (null === $reflClass || !ClassUtils::containsTrait($reflClass, ConfirmableTrait::class)) {
45
            return;
46
        }
47
48
        $this->createDateTimeField($meta, 'confirmedAt', true);
49
    }
50
}
51