So far I can be sure that the only type of comments in code is legal, needed…
Despite other arguments against using constants in test, there is one more.
You can not make a constant private, even though you don’t use it in the rest of the codebase, if the constant is being used in the tests.
Consider a method:
public function doSomethingWithOrder(Order $order): Order{ // ...}
It takes an Order and returns an Order. In my opinion this method can be moved Order model itself.
I’ve got an abstract class, with a needed method, which I want to reuse
Reuse the method in the rest of the system in most appropriate way
Sometimes we have to deal with properties, which can be null
null
/** * @var string|null */private $description;
It’s fine, IDE will generate a getter for us
public function…
There is a common opinion that OOP patterns reduce complexity of code and project in general.
To me it was sort of obvious, before I spoke to a frontend guy, who hates OOP and does some functional programming. He said that he hates all…
I like to use constant literals in tests instead of constants itself.
Encapsulation picks up where abstraction leaves off. Abstraction says, “You’re allowed to look at an object at a high level of detail.” Encapsulation says, “Furthermore, you aren’t allowed to look at an object at any other level of detail.” — Code Complete
A lot of books/articles say about taking ownership.
The boy-scout rule says about leaving the place cleaner than it used to be.
But what is the scope of ownership? If I am changing a method in a class, am I responsible for all the class? How cam…