Open klaussilveira opened 10 years ago
:+1: on this.
@klaussilveira indeed we will face the same issue on our side. We released https://github.com/rezzza/TimeTraveler if it can help you but it's for testing purpose only, not to use in production. AOP extension is leaking and have some bugs too BTW.
@klaussilveira can you plz point in doctrine ProxyGenerator lines where you get such type hinting exception? https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Proxy/ProxyGenerator.php
Can you execute this piece of code on your own?
if (\TimecopDateTime instanceof \DateTime) {
echo "TimecopDateTime is an instanceof DateTime\n";
}
@hlegius any clue?
+1, we ran into the same issue. Seems to be around https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Proxy/ProxyGenerator.php#L941 it's returning the \TimecopDateTime instead of our type hinted \DateTime.
I have run into this problem, for me a simple solution was to ask for a DateTimeInterface
instead of a particular type.
+1 on the doctrine proxy generation issue.
The proxy classes are created with method parameter type hints of TimecopDateTime
instead of the expected DateTime
Bone headed work around after doctrine proxy generation:
sed -i -- 's/TimecopDateTime/DateTime/g' /current/release/proxies/*
@veloper @klaussilveira Can you confirm the bug is still valid? I can't reproduce it on newest timecop builds.
@IonBazan - Which pecl version would you like me to test against?
Try to compile from master.
Is this extension still maintained? It would be nice to get some feedback on some of the issues?
Take a look at the following snippet:
When using Reflection's API to check the Type Hint of the params of methods, the
TimecopDateTime
class is found, instead ofDateTime
itself. How can we avoid this behavior? I'm unable to use the timecop extension since it's conflicting with Doctrine's ProxyGenerator.