Archive
Michael MULLER
-
The code contains too many final artifacts in final classes
Unnecessary final modifiers inside final classes should be avoided. Final modifier prevents child classes from overriding a method by prefixing the definition with final.…
-
The code contains too many classes that declare __get() without declaring __set()
When __get() are declared, __set() shoud be declared as well.
-
The code contains too many class names that do not begin with an uppercase letter
Complying with naming conventions make the source code easier to ready and so to maintain. Class names should start with an upper case.
-
Force casts should not be used
Because force casting (as!) does not perform any type safety validations, it is capable of performing dangerous conversions between unrelated types. When the types…
-
Prefer to use an expression body for functions whose body consists of a single expression
Prefer using an expression body for functions with the body consisting of a single expression.
-
Avoid abstract classes without abstract or concrete methods
Abstract classes can have public constructors, and this is required in some particular cases. But a public constructor means that the class can be…
-
Use short variable declarations (:=) for variables with default values
Short variable declarations (:=) should be used if a variable is being set to some value explicitly.
-
Avoid naming unused receivers
If the receiver of a method is unused, do not give it a name. Itβs more readable because itβs clear that the receiver is…
-
Avoid instantiation with new
Use &T{} instead of new(T) when initializing struct references so that it is consistent with the struct initialization.
-
Avoid ‘switch’ with too many ‘case’ statements
When switch statements have large sets of case clauses, it is usually an attempt to map two sets of data. A real map structure…