-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist #28962
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,9 @@ | |
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet; | ||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassSetValue; | ||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassTypeErrorInsideCall; | ||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestSingularAndPluralProps; | ||
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object; | ||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TypeHinted; | ||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestSingularAndPluralProps; | ||
|
||
class PropertyAccessorTest extends TestCase | ||
{ | ||
|
@@ -694,10 +694,10 @@ public function testWriteToPluralPropertyWhileSingularOneExists() | |
$object = new TestSingularAndPluralProps(); | ||
|
||
if ($this->propertyAccessor->isWritable($object, 'emails')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of having this if, I would have and maybe we should even write without guarding the call at all (so that if the property is not writable, we get the detailed error message in the failure) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
6D40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I don't call isWritable - then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe this would be better?
|
||
$this->propertyAccessor->setValue($object, 'emails', ['test@email.com']); | ||
$this->propertyAccessor->setValue($object, 'emails', array('test@email.com')); | ||
} | ||
|
||
self::assertEquals(['test@email.com'], $object->getEmails()); | ||
self::assertEquals(array('test@email.com'), $object->getEmails()); | ||
self::assertNull($object->getEmail()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the PR.
If the issue exists on 3.4, can you please rebase+retarget your PR for branch 3.4?
This will require writing it using PHP5.5 compatible code (that's why I'm commenting on this line :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas I made my changes php5 compatible in a new php5 branch.
How do I rebase the branch of this PR with the php5 branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe close this PR and submit a new one would be the easiest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sent my changes in another PR #28966
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas but still in general, what is the correct git flow for this situation? That is, rebase and squash my changes in order to prepare for PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase the branch (without creating a new one) using
git rebase -i
then retarget using the "Edit" above