Skip to content

Commit

Permalink
Housekeeping: CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Jun 6, 2020
1 parent efebadb commit 3f549d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
21 changes: 13 additions & 8 deletions lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

namespace Doctrine\DBAL\Connections;

use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Driver;
use function sprintf;
use function trigger_error;
use const E_USER_DEPRECATED;

class MasterSlaveConnection extends PrimaryReplicaConnection
{
/**
Expand Down Expand Up @@ -41,12 +48,10 @@ public function __construct(array $params, Driver $driver, ?Configuration $confi

/**
* Checks if the connection is currently towards the primary or not.
*
* @return bool
*/
public function isConnectedToMaster() : bool
{
$this->deprecated("isConnectedtoMaster()", "isConnectedToPrimary()");
$this->deprecated('isConnectedtoMaster()', 'isConnectedToPrimary()');

return $this->isConnectedToPrimary();
}
Expand All @@ -58,14 +63,14 @@ public function isConnectedToMaster() : bool
*/
public function connect($connectionName = null)
{
if ($connectionName === "master") {
$connectionName = "primary";
if ($connectionName === 'master') {
$connectionName = 'primary';

$this->deprecated('connect("master")', 'connect("primary")');
}

if ($connectionName === "slave") {
$connectionName = "replica";
if ($connectionName === 'slave') {
$connectionName = 'replica';

$this->deprecated('connect("slave")', 'connect("replica")');
}
Expand All @@ -77,7 +82,7 @@ private function deprecated(string $thing, string $instead) : void
{
@trigger_error(
sprintf(
"%s is deprecated since doctrine/dbal 2.10 and will be removed in 3.0, use %s instead.",
'%s is deprecated since doctrine/dbal 2.10 and will be removed in 3.0, use %s instead.',
$thing,
$instead
),
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Connections/PrimaryReplicaConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function connect($connectionName = null)
$forcePrimaryAsReplica = false;

if ($this->getTransactionNestingLevel() > 0) {
$connectionName = 'primary';
$connectionName = 'primary';
$forcePrimaryAsReplica = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testInheritCharsetFromPrimary() : void
];

foreach ($charsets as $charset) {
$params = $this->createPrimaryReplicaConnectionParams();
$params = $this->createPrimaryReplicaConnectionParams();
$params['primary']['charset'] = $charset;

foreach ($params['replica'] as $index => $replicaParams) {
Expand Down

0 comments on commit 3f549d0

Please sign in to comment.