@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * then using the main DBLoadBalancer service may be incorrect. |
26 | 26 | * @param string|false $dbName Database name ($domain for ILoadBalancer methods). |
27 | 27 | */ |
28 | - public function __construct( ILoadBalancer $lb, $dbName ) { |
|
28 | + public function __construct(ILoadBalancer $lb, $dbName) { |
|
29 | 29 | $this->lb = $lb; |
30 | 30 | $this->dbName = $dbName; |
31 | 31 | } |
@@ -35,22 +35,22 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return Constraint[] |
37 | 37 | */ |
38 | - public function queryConstraintsForProperty( NumericPropertyId $propertyId ) { |
|
39 | - $dbr = $this->lb->getConnection( ILoadBalancer::DB_REPLICA, [], $this->dbName ); |
|
38 | + public function queryConstraintsForProperty(NumericPropertyId $propertyId) { |
|
39 | + $dbr = $this->lb->getConnection(ILoadBalancer::DB_REPLICA, [], $this->dbName); |
|
40 | 40 | |
41 | 41 | $results = $dbr->newSelectQueryBuilder() |
42 | - ->select( [ |
|
42 | + ->select([ |
|
43 | 43 | 'constraint_type_qid', |
44 | 44 | 'constraint_parameters', |
45 | 45 | 'constraint_guid', |
46 | 46 | 'pid', |
47 | - ] ) |
|
48 | - ->from( 'wbqc_constraints' ) |
|
49 | - ->where( [ 'pid' => $propertyId->getNumericId() ] ) |
|
50 | - ->caller( __METHOD__ ) |
|
47 | + ]) |
|
48 | + ->from('wbqc_constraints') |
|
49 | + ->where(['pid' => $propertyId->getNumericId()]) |
|
50 | + ->caller(__METHOD__) |
|
51 | 51 | ->fetchResultSet(); |
52 | 52 | |
53 | - return $this->convertToConstraints( $results ); |
|
53 | + return $this->convertToConstraints($results); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return Constraint[] |
60 | 60 | */ |
61 | - private function convertToConstraints( IResultWrapper $results ) { |
|
61 | + private function convertToConstraints(IResultWrapper $results) { |
|
62 | 62 | $constraints = []; |
63 | - $logger = LoggerFactory::getInstance( 'WikibaseQualityConstraints' ); |
|
64 | - foreach ( $results as $result ) { |
|
63 | + $logger = LoggerFactory::getInstance('WikibaseQualityConstraints'); |
|
64 | + foreach ($results as $result) { |
|
65 | 65 | $constraintTypeItemId = $result->constraint_type_qid; |
66 | - $constraintParameters = json_decode( $result->constraint_parameters, true ); |
|
66 | + $constraintParameters = json_decode($result->constraint_parameters, true); |
|
67 | 67 | |
68 | - if ( $constraintParameters === null ) { |
|
68 | + if ($constraintParameters === null) { |
|
69 | 69 | // T171295 |
70 | - $logger->warning( 'Constraint {constraintId} has invalid constraint parameters.', [ |
|
70 | + $logger->warning('Constraint {constraintId} has invalid constraint parameters.', [ |
|
71 | 71 | 'method' => __METHOD__, |
72 | 72 | 'constraintId' => $result->constraint_guid, |
73 | 73 | 'constraintParameters' => $result->constraint_parameters, |
74 | - ] ); |
|
75 | - $constraintParameters = [ '@error' => [ /* unknown */ ] ]; |
|
74 | + ]); |
|
75 | + $constraintParameters = ['@error' => [/* unknown */]]; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $constraints[] = new Constraint( |
79 | 79 | $result->constraint_guid, |
80 | - NumericPropertyId::newFromNumber( $result->pid ), |
|
80 | + NumericPropertyId::newFromNumber($result->pid), |
|
81 | 81 | $constraintTypeItemId, |
82 | 82 | $constraintParameters |
83 | 83 | ); |