Completed
Push — master ( 09b86b...ba0798 )
by Andreas
20:05 queued 12s
created

Doctrine/ODM/MongoDB/Event/PreLoadEventArgs.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ODM\MongoDB\Event;
6
7
use Doctrine\ODM\MongoDB\DocumentManager;
8
use const E_USER_DEPRECATED;
9
use function sprintf;
10
use function trigger_error;
11
12
/**
13
 * Class that holds event arguments for a preLoad event.
14
 *
15
 * @final
16
 */
17 View Code Duplication
class PreLoadEventArgs extends LifecycleEventArgs
18
{
19
    /** @var array */
20
    private $data;
21
22 18
    public function __construct(object $document, DocumentManager $dm, array &$data)
23
    {
24 18
        if (self::class !== static::class) {
25
            @trigger_error(sprintf('The class "%s" extends "%s" which will be final in MongoDB ODM 2.0.', static::class, self::class), E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
26
        }
27 18
        parent::__construct($document, $dm);
28 18
        $this->data =& $data;
29 18
    }
30
31
    /**
32
     * Get the array of data to be loaded and hydrated.
33
     */
34 2
    public function &getData() : array
35
    {
36 2
        return $this->data;
37
    }
38
}
39