-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fixes custom type comment regex #2905
Fixes custom type comment regex #2905
Conversation
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.
Some small changes, thanks for your contribution
@@ -1146,4 +1146,27 @@ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys() | |||
$this->assertArrayHasKey('explicit_fk1_idx', $indexes); | |||
$this->assertArrayHasKey('idx_3d6c147fdc58d6c', $indexes); | |||
} | |||
|
|||
public function testExtractDoctrineTypeFromComment() |
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.
Please add : void
$currentType = 'current type'; | ||
|
||
$result = $this->_sm->extractDoctrineTypeFromComment('(DC2Type:type.should.return)', $currentType); | ||
self::assertEquals('type.should.return', $result); |
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.
assertSame()
is more appropriated here
{ | ||
$currentType = 'current type'; | ||
|
||
$result = $this->_sm->extractDoctrineTypeFromComment('(DC2Type:type.should.return)', $currentType); |
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.
Could you use a data provider for this test? It would become much simpler 😄
Done @lcobucci |
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.
Nice job, just some more small things 😄
} | ||
|
||
/** | ||
* @return array |
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.
Please drop this
/** | ||
* @dataProvider commentsProvider | ||
* | ||
* @param string $comment |
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.
Please drop the @param
and @return
annotations
* @param string $currentType | ||
* @return void | ||
*/ | ||
public function testExtractDoctrineTypeFromComment($comment, $expected, $currentType) : void |
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.
Please add the type declarations for the parameters
{ | ||
$currentType = 'current type'; | ||
|
||
return array( |
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.
Please use short-array syntax
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.
Please define the indexes of the array with a short description of what the set of parameters is about, in order to improve PHPUnit's messages. Like:
return [
'invalid custom type comments' => ['should.return.current.type', $currentType, $currentType],
'valid custom type with dots' => ['(DC2Type:type.should.return)', 'type.should.return', $currentType],
];
Done @lcobucci |
1b4e7f5
to
22844d3
Compare
@jeremy-smith-maco merged (with some minor changes - specially to also give credit to @PedroTroller) and backported. Thanks for your contribution! |
This is the same fix as #2679 which fixes the issue #2596 but this PR has tests for the change.