Whenever someone asks me why PHP is more "agile" than Java, I tell them that in PHP you can break most of the rules your comp sci course told you about and get away with it. Of course this means that you need PHP developers to constantly clean up their code. To paraphrase Jani: "Everytime you open a file you leave it a bit cleaner than it was before." This one is a fundamental mind set any good PHP programmer needs. Without it we will quickly feel all the pain our wise comp sci prof's wanted to spare us by telling all these rules that "shall never be broken".
One of these rules is that "thou shalt not change the signature of a method when you inherit in a way that breaks the 'is a' relationship". What that means is that you cannot redefine the signature in such a way that the child signature makes it incompatible with the parent, like removing a parameter. With careful planning one would never have to break this rule and as a result one would live happy in the land of OO. However careful planning is expensive and time consuming. More importantly more often than not you do not care about this 'is a' relationship, but sometimes you do.
As such it seems perfectly fit for an E_STRICT warning. This way the paranoid with a lot of time on their hands will never break this rule (at least not unknowingly), while the rest of us can focus on getting the job done. Even for "the rest of us" checking our code against E_STRICT will be helpful, so that we can at least know quickly where we are bending the rules of common wisdom.
But its not an E_STRICT if you run PHP6. Its an E_FATAL! The same might even be the case if PHP 5.3 comes along, but this change will hopefully never happen. That would be like turning undeclared variables into an E_FATAL. It would be the end of the world as we know it.
Read me lips: "Not forcing OO purity is a feature not a bug!"
Please, lets get the sense back here. Lets not make things that are not fatal an E_FATAL. Lets use E_STRICT for the pedantic, lets add a E_DEPRECATED for all things deprecated. Lets not kill what makes PHP more agile than those other languages that think they know what I should be spending my time on.
As much as I prefer strict typing over loose typing, I have to agree here... that's one of PHP's strengths. It let's you start small and have something going sooner that you would in a strict typed language. If you then CHOOSE to move to where you ACT like you're in a strictly typed language, then you start coding differently, but the language is not ENFORCING this. It a choice, made by you. Choice is good.
I couldn't agree more. Many people try to claim that PHP is not a OOP language so it is not as good as many others. I ask: Why does a language need to be a pure OOP one? OOP support is a value in some cases. Procedural programming support is a value too in some other cases. it is not only about techniques but also taste and efficiency. Developers can find and get benefits from those 2 values in an agile language: PHP
Let;s not make another Java out of php !
Software Developers Company
Indeed. I appreciate the E_STRICT notifications as it encourages me to make my code cleaner, but this is clearly a "you probably don't want to do that" kind of error, not a "this will destroy everything" kind of error. E_FATAL should only be reserved for the latter.
Oh my god you whining bastards! Object inheritance is something that you should be allowed to break? Give me a break! If you expect to write an application and start screwing with method signatures you should be hung drawn and quartered for it, this is not a minor issue, please, be realistic. And hey, you are also the people who still use PHP4 right?
Hear hear on the "thou shall not make another Java".
I like PHP for being open, and its allowance for outside the box thinking and simplicity of use. I'd rather not head down the road of requiring strictness by making such things fatal.
Loose typing is exactly why most of us will continue to use PHP over Ruby as well, lets not forget that one.