Skip to content
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

[CS] Start to fix excluded ones #1749

Merged
merged 1 commit into from
Mar 12, 2018
Merged

[CS] Start to fix excluded ones #1749

merged 1 commit into from
Mar 12, 2018

Conversation

carusogabriel
Copy link
Contributor

On this one:

  • Remove alias functions, as well forbidden ones
  • Remove assignments in if condition

@@ -186,7 +186,7 @@ public function prepareUpdateData($document)
// @ReferenceOne
} elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
if (isset($new) || $mapping['nullable'] === true) {
$updateData['$set'][$mapping['name']] = (is_null($new) ? null : $this->prepareReferencedDocumentValue($mapping, $new));
$updateData['$set'][$mapping['name']] = ($new === null ? null : $this->prepareReferencedDocumentValue($mapping, $new));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can this be refactory to $new ?: $this->prepareReferencedDocumentValue($mapping, $new)?

Copy link
Member

Choose a reason for hiding this comment

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

No, as it would change the logic: nulls are to be left intact and everything else must go through prepare...

Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

Apart from nitpicks, LGTM 👍

@@ -257,7 +256,7 @@ public function prepareUpsertData($document)
// @ReferenceOne
} elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
if (isset($new) || $mapping['nullable'] === true) {
$updateData['$set'][$mapping['name']] = (is_null($new) ? null : $this->prepareReferencedDocumentValue($mapping, $new));
$updateData['$set'][$mapping['name']] = ($new === null ? null : $this->prepareReferencedDocumentValue($mapping, $new));
Copy link
Member

Choose a reason for hiding this comment

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

Parentheses are unnecessary

@@ -186,7 +185,7 @@ public function prepareUpdateData($document)
// @ReferenceOne
} elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
if (isset($new) || $mapping['nullable'] === true) {
$updateData['$set'][$mapping['name']] = (is_null($new) ? null : $this->prepareReferencedDocumentValue($mapping, $new));
$updateData['$set'][$mapping['name']] = ($new === null ? null : $this->prepareReferencedDocumentValue($mapping, $new));
Copy link
Member

Choose a reason for hiding this comment

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

Parentheses are unnecessary.

- Remove alias functions, as well forbidden ones
- Remove assignments in if condition
@carusogabriel
Copy link
Contributor Author

Conflicts solved, should be RTM 👍

@alcaeus alcaeus merged commit 5e07b23 into doctrine:master Mar 12, 2018
@carusogabriel carusogabriel deleted the cs-fixes-alias-functions branch March 12, 2018 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants