File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ class critical {
27
27
'variableInterpolation ' ,
28
28
'duplicateFunctionParameter ' ,
29
29
'reservedNames ' ,
30
- 'deprecatedFunctions '
30
+ 'deprecatedFunctions ' ,
31
+ 'newOperatorWithReference ' ,
31
32
];
32
33
33
34
/**
@@ -116,5 +117,21 @@ public function _deprecatedFunctions($line) {
116
117
}
117
118
return false ;
118
119
}
120
+
121
+ /**
122
+ * New objects cannot be assigned by reference
123
+ *
124
+ * @access public
125
+ * @param string Line to test against.
126
+ * @return boolean Line matches test.
127
+ */
128
+ public function _newOperatorWithReference ($ line ) {
129
+ $ regex = "#&\s?new\s# " ;
130
+
131
+ if (preg_match ($ regex , $ line )) {
132
+ return true ;
133
+ }
134
+ return false ;
135
+ }
119
136
}
120
- ?>
137
+ ?>
Original file line number Diff line number Diff line change @@ -122,4 +122,8 @@ trait numeric { /*...*/ }
122
122
mysql_tablename ();
123
123
mysql_thread_id ();
124
124
mysql_unbuffered_query ();
125
- ?>
125
+
126
+ // New objects cannot be assigned by reference
127
+ class C {}
128
+ $ c =& new C ;
129
+ $ c =&new C ;
You can’t perform that action at this time.
0 commit comments