-
-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1801 from FORTE-WP/temp1
Documentation Class Instantiation
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<documentation title="Class Instantiation"> | ||
<standard> | ||
<![CDATA[ | ||
Instantiation of an object should be done with parenthesis. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: with parenthesis."> | ||
<![CDATA[ | ||
$a = new Foobar<em>()</em>; | ||
]]> | ||
</code> | ||
<code title="Invalid: without parenthesis."> | ||
<![CDATA[ | ||
$a = new Foobar; | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
Don't use spaces between the object name and the open parenthesis when instantiating new object. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: no whitespace between the object name and the parenthesis."> | ||
<![CDATA[ | ||
$a = new Foobar(); | ||
]]> | ||
</code> | ||
<code title="Invalid: a space between the object name and the parenthesis."> | ||
<![CDATA[ | ||
$a = new Foobar<em> </em>(); | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
Assigning the return value of "new" by reference was deprecated in PHP 5.3 and removed in PHP 7.0. New by reference should no longer be used. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: object instantiation without reference."> | ||
<![CDATA[ | ||
$a = <em>new</em> Foobar(); | ||
]]> | ||
</code> | ||
<code title="Invalid: object instantiation by reference."> | ||
<![CDATA[ | ||
$a = <em>& new</em> Foobar(); | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |