Skip to content

Commit 73ac58e

Browse files
committed
1 parent 66908f1 commit 73ac58e

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

classes/tests/critical.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class critical {
2727
'variableInterpolation',
2828
'duplicateFunctionParameter',
2929
'reservedNames',
30-
'deprecatedFunctions'
30+
'deprecatedFunctions',
31+
'newOperatorWithReference',
3132
];
3233

3334
/**
@@ -116,5 +117,21 @@ public function _deprecatedFunctions($line) {
116117
}
117118
return false;
118119
}
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+
}
119136
}
120-
?>
137+
?>

0 commit comments

Comments
 (0)