Issues (902)

framework/mutex/DbMutex.php (1 issue)

Severity
1
<?php
2
/**
3
 * @link https://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license https://www.yiiframework.com/license/
6
 */
7
8
namespace yii\mutex;
9
10
use yii\base\InvalidConfigException;
11
use yii\db\Connection;
12
use yii\di\Instance;
13
14
/**
15
 * DbMutex is the base class for classes, which relies on database while implementing mutex "lock" mechanism.
16
 *
17
 * @see Mutex
18
 *
19
 * @author resurtm <[email protected]>
20
 * @since 2.0
21
 */
22
abstract class DbMutex extends Mutex
23
{
24
    /**
25
     * @var Connection|array|string the DB connection object or the application component ID of the DB connection.
26
     * After the Mutex object is created, if you want to change this property, you should only assign
27
     * it with a DB connection object.
28
     * Starting from version 2.0.2, this can also be a configuration array for creating the object.
29
     */
30
    public $db = 'db';
31
32
33
    /**
34
     * Initializes generic database table based mutex implementation.
35
     * @throws InvalidConfigException if [[db]] is invalid.
36
     */
37 39
    public function init()
38
    {
39 39
        parent::init();
40 39
        $this->db = Instance::ensure($this->db, Connection::className());
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

40
        $this->db = Instance::ensure($this->db, /** @scrutinizer ignore-deprecated */ Connection::className());

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
41
    }
42
}
43