-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
Add DateInterval properties test #80
Conversation
Please fix that in |
Unfortunately the test in AccessPropertiesRuleTest will always fail because the Broker instance created by AbstractRuleTest does not contain this extension. You need to move it to PhpDefectClassReflectionExtensionTest. |
haha, is it that simple? |
Yep, reflection of native PHP stuff is not always up to date so I'm already solving a few cases in PHPStan codebase. |
@simPod I see you're implementing it :) One tip: You can use multiple |
Good to know. Let me see |
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 found two small issues. Fix them please and squash the commits into one, I will merge it then :) Thanks!
$this->assertTrue($zipArchiveReflection->hasProperty($propertyName)); | ||
$propertyReflection = $zipArchiveReflection->getProperty($propertyName); | ||
$this->assertInstanceOf(PhpDefectPropertyReflection::class, $propertyReflection); | ||
$this->assertSame($zipArchiveReflection, $propertyReflection->getDeclaringClass()); |
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.
Fix this variable name just to $classReflection
$propertyReflection = $zipArchiveReflection->getProperty($propertyName); | ||
$this->assertInstanceOf(PhpDefectPropertyReflection::class, $propertyReflection); | ||
$this->assertSame($zipArchiveReflection, $propertyReflection->getDeclaringClass()); | ||
$this->assertSame($typeDescription, $propertyReflection->getType()->describe()); |
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.
Problem with this line is that when it fails, I have no idea which property is it. Add a third parameter - message with sprintf('%s::$%s', $className, $propertyName)
and test how it looks.
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.
it's amazing
Really nice, thank you! |
So. I noticed it says that properties of DateInterval are undefined. But did I update the test correctly? Who knows... Also, this PR only includes updated test. Honestly, I have no Idea how to fix it.