I have recently been appointed as a Developer in a project which uses PHP backend. With previous experience in strongly typed languages like C#, it has been tough for me. In C#, it easier to:-
- Find all references
- Better debug experience
- Know what type of object to be expected
and many more...
I know the benefits of a weakly typed language like JavaScript which opens the possibility of a whole lot of things you can do with it. But when you have business logic with business objects, I would rather prefer a strongly typed language.
My real question is if you have something like this:-
public function saveEntity($externalId, $layer, $sign = null, $user= null, $pass = null) {
How am I supposed to know what $layer contains without having to read all of the lines of code before a call to this function? Is there a trick/gotcha in places like these where identifying the type of object is important?