8000 Use Null Coalesce Operator by carusogabriel · Pull Request #2934 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use Null Coalesce Operator #2934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2017
Merged

Use Null Coalesce Operator #2934

merged 1 commit into from
Dec 9, 2017

Conversation

carusogabriel
Copy link
Contributor

No description provided.

@@ -121,7 +121,7 @@ public function __construct(array $params, Driver $driver, Configuration $config
$params['slaves'][$slaveKey]['driver'] = $params['driver'];
}

$this->keepSlave = isset($params['keepSlave']) ? (bool) $params['keepSlave'] : false;
$this->keepSlave = (bool) $params['keepSlave'] ?? false;
Copy link
Member
@morozov morozov Dec 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. The (bool) casting has higher precedence than ??:

$params = [];
$keepSlave = (bool) $params['keepSlave'] ?? false;

// Notice: Undefined index: keepSlave

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So isset should be keep it here?

Copy link
Contributor
@stloyd stloyd Dec 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$keepSlave = (bool) ($params['keepSlave'] ?? false);

@Ocramius Ocramius self-assigned this Dec 9, 2017
@Ocramius Ocramius added this to the 2.7.0 milestone Dec 9, 2017
@Ocramius Ocramius merged commit 2742cd1 into doctrine:master Dec 9, 2017
@Ocramius
Copy link
Member
Ocramius commented Dec 9, 2017

🚢 thanks @carusogabriel!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0