4 ms·
Maybe I'm crazy, but I often include small helper classes in the same file as a larger class, though I guess it's mostly because PHP can't do inner or nested cl
by armored_mammal 14y ago
Maybe I'm crazy, but I often include small helper classes in the same file as a larger class, though I guess it's mostly because PHP can't do inner or nested classes, which are useful here and there.
I have to agree, though, that in PHP there's an avoidance of top-level function declarations. The project I work on tends to use wrapper classes with static methods instead of defining top-namespace level functions, and I think it's a little bit better for organization. Possibly I think this because in the 'old' days of PHP (when it was something I wouldn't touch with a 10 foot pole so help me God or Devil) they were everywhere, often redefined needlessly in multiple spots, and inserted at random in spaghetti code files, and so now the more competent PHP devs have a strong aversion to loose functions, even outside of whether they've got a true 'object oriented' thing going on.