Hi, > > Hey Marcio, > >> >> Hi >> >> > >> > Re casting - In the previous thread the following concern was presented >> > and I don’t know enough about that area to respond effectively: "I'd >> > endorse avoiding object-to-<scalar> casts via cast operations: they are a >> > good source of bugs. My rationale for the discouragement of magic cast >> > methods is explained with some code examples at >> > https://github.com/ShittySoft/symfony-live-berlin-2018-doctrine-tutorial/pull/3#issuecomment-460441229” >> > >> >> Frankly this is something subject to personal opinions and will change >> over time according to community shifts. >> > > Not sure what's "subject to personal opinions" in the objective bug exposed > in the snippet above? >
So there is a bug in a contrived code snippet therefore casting is a universal bad practice? It's at least a huge stretch. Some might say your bad practice was actually using `null` ;) > Greets, > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php