You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: guides/v2.2/coding-standards/technical-guidelines.md
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,9 @@ Use [RFC2119] to interpret keywords like:
48
48
49
49
2.1. Object decomposition MUST follow the [SOLID principles].
50
50
51
-
2.2. Object MUST be ready for use after instantiation. No additional public initialization methods are allowed.
51
+
2.2. Object instantiation
52
+
53
+
2.2.1. An object MUST be ready for use after instantiation. No additional public initialization methods are allowed.
52
54
53
55
{% collapsible Examples: %}
54
56
@@ -93,6 +95,11 @@ class Config
93
95
94
96
---
95
97
98
+
2.2.2. Factories SHOULD be used for object instantiation instead of `new` keyword. An object SHOULD be replaceable for testing or extensibility purposes.
99
+
Exception: [DTOs](https://en.wikipedia.org/wiki/Data_transfer_object). There is no behavior in DTOs, so there is no reason for its replaceability.
100
+
Tests can create real DTOs for stubs.
101
+
Data interfaces, Exceptions and `Zend_Db_Expr` are examples of DTOs.
102
+
96
103
{:start="2.3"}
97
104
2.3. Class constructor can have only dependency assignment operations and/or argument validation operations. No other operations are allowed.
0 commit comments