3 ms·
PHP has: 1. https://www.php-fig.org/psr/psr-2/ https://www.php-fig.org/psr/psr-2/ - coding style guidelines that are then used in tools like phpcs for automate
by eithed 3y ago
PHP has:
1. https://www.php-fig.org/psr/psr-2/ https://www.php-fig.org/psr/psr-2/ - coding style guidelines that are then used in tools like phpcs for automated linting
2. phpcs allows for defining additional rules that can be used in automated linting - https://gist.github.com/andreyAndrienko/19941c4b621f3212976ae7e47607e864 https://gist.github.com/andreyAndrienko/19941c4b621f3212976a...
3. phpstan used for static analysis of files, allowing for defining architecture rules like: "this method cannot be used" or "this class cannot be used in this folder"
4. phpat (https://www.phpat.dev/examples/ https://www.phpat.dev/examples/) (and architecture plugin in pest - https://pestphp.com/docs/arch-testing https://pestphp.com/docs/arch-testing) allowing for defining architecture rules
- munk-a 3y agoI work on a large PHP project and we've been using a combination of phpcs and a non-machine enforced style guide and the project is quite comprehensible. Some developers have different styles but it's fine. Even gofmt will never force people to adhere more to functional or imperative programming styles and that's a-okay - I love my functional code but I understand that other people comprehend things in different manners and as long as it works I'm not going to go in and edit someone else's approach. Over enthusiastic machine driven style enforcement can get pretty unreadable - do you have a "one arg per line" rule - do you even enforce that in front-end validation where you have thirty parameters? Alternatively do you compromise the strength of your type safety and pack them all into a params[] just so the code is less messy? I remain skeptical that there is a reasonable one-size fits all solution to styling but I'm quite certain that python isn't it if it exists.
- slifin 3y ago"front-end validation where you have thirty parameters" When your hammer is a type system