-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Add expressionLanguage to ExpressionValidator constructor #16161
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
Conversation
enumag
commented
Oct 7, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | |
License | MIT |
Doc PR |
d604110
to
81130b3
Compare
@@ -38,17 +38,22 @@ class ExpressionValidator extends ConstraintValidator | |||
private $expressionLanguage; | |||
|
|||
/** | |||
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5 | |||
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5 | |||
* @param ExpressionLanguage $expressionLanguage |
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.
missing |null
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, fixed.
81130b3
to
aa9757c
Compare
@@ -38,17 +38,22 @@ class ExpressionValidator extends ConstraintValidator | |||
private $expressionLanguage; | |||
|
|||
/** | |||
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5 | |||
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5 |
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.
the comment Optional as of Symfony 2.5
does not bring any value and should be removed IMO. when looking at the phpdoc, we don't really care about which version made it optional. Someone wanting to know this will look at the changelog or the git history
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.
Done.
aa9757c
to
ce1d197
Compare
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5 | ||
* | ||
* @throws UnexpectedTypeException If the property accessor is invalid | ||
* @param PropertyAccessorInterface|null $propertyAccessor |
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.
Then I suggest removing the doc block, it provides no value, pure repetition of the signature
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.
agreed
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.
True.
ce1d197
to
b3deb5b
Compare
We may have a test that expects the UnexpectedTypeException. If yes, it should be removed (I didn't check for it). |
@nicolas-grekas If there is such test Travis is going to fail so I'll just wait for that. |
👍 |
IMO, we should have a test ensuring that the ExpressionLanguage passed as argument is actually used, to avoid regressions |
@stof Sounds reasonable (although there is no such test for propertyAccessor argument). I'm just not sure how to write it - I'd use Mockery for such tests, but symfony doesn't use it. Can you point me to a similar test in symfony? |
@enumag there are lots of tests in Symfony using PHPUnit mocks. look for any usage of |
@stof Can you give me some advice how to run symfony tests locally? The guide from http://symfony.com/doc/current/contributing/code/tests.html doesn't work at all. I run
The only thing that sorf of worked was this. It let me know about some parse errors I've made and then failed:
I'm on Windows 7 and I installed msysgit with unix tools. |
@enumag can you please post the full output so that we can figure out what's wrong with the tests? |
I've checked the output and there is nothing that points to the cause. However it seems there is some kind of problem with arguments escaping. When I hack |
Can't figure out the arguments escaping problem but I now know why some of the tests were failing for me. The reason is autocrlf setting in git. My default is
You should add a .gitattributes file to fix this. There are still some other tests failing. In case of Validator see this:
|
Arguments escaping problem is caused by https://bugs.php.net/bug.php?id=49139. Adding additional double quotes into both proc_open calls in https://github.com/symfony/symfony/blob/2.8/phpunit fixed my problem. The second suggested workaround with bypass_shell option only works for one of the calls. |
9e41727
to
64bb03e
Compare
64bb03e
to
4ad1e20
Compare
@stof I've added the requested test. Not sure if this is the correct way to write such test though. |
Thank you @enumag. |
…tor constructor (enumag) This PR was merged into the 2.8 branch. Discussion ---------- [Validator] Add expressionLanguage to ExpressionValidator constructor | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 4ad1e20 [Validator] Add expressionLanguage to ExpressionValidator constructor