You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I am wondering why does \Doctrine\Common\Collections\Expr\ExpressionVisitor::dispatch restricts $expr to be instance of predefined classes.
Doesn't it violate key principles of visitor pattern which leverage polymorphism and double dispatch in order to avoid such hard-coding of instanceof checks.
Moreover, this method seems useless to me as we can (and should) call visit directly in the client code. If not, then what is the reason of Expression interface and implementations of visit method if those are not used at all?
The text was updated successfully, but these errors were encountered:
Hello. I am wondering why does
\Doctrine\Common\Collections\Expr\ExpressionVisitor::dispatch
restricts$expr
to be instance of predefined classes.Doesn't it violate key principles of visitor pattern which leverage polymorphism and double dispatch in order to avoid such hard-coding of
instanceof
checks.CMIIW, foregoing code can be replaced with single line like this:
Moreover, this method seems useless to me as we can (and should) call
visit
directly in the client code. If not, then what is the reason ofExpression
interface and implementations ofvisit
method if those are not used at all?The text was updated successfully, but these errors were encountered: