~ubuntu-branches/ubuntu/wily/php-codesniffer/wily

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-2.3.1/CodeSniffer/Standards/PSR2/Docs/Methods/MethodDeclarationStandard.xml

  • Committer: Package Import Robot
  • Author(s): David Prévot, Greg Sherwood
  • Date: 2015-04-30 18:14:08 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20150430181408-1lpm509oq0mo1mmi
Tags: 2.3.2-1
[ Greg Sherwood ]
Prepare for 2.3.2 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<documentation title="Method Declarations">
2
 
    <standard>
3
 
    <![CDATA[
4
 
    Method names should not be prefixed with an underscore to indicate visibility.  The static keyword, when present, should come after the visibility declaration, and the final and abstract keywords should come before.
5
 
    ]]>
6
 
    </standard>
7
 
    <code_comparison>
8
 
        <code title="Valid: Correct method naming.">
9
 
        <![CDATA[
10
 
class Foo
11
 
{
12
 
    private function <em>bar</em>()
13
 
    {
14
 
    }
15
 
}
16
 
        ]]>
17
 
        </code>
18
 
        <code title="Invalid: An underscore prefix used to indicate visibility.">
19
 
        <![CDATA[
20
 
class Foo
21
 
{
22
 
    private function <em>_bar</em>()
23
 
    {
24
 
    }
25
 
}
26
 
        ]]>
27
 
        </code>
28
 
    </code_comparison>
29
 
    <code_comparison>
30
 
        <code title="Valid: Correct ordering of method prefixes.">
31
 
        <![CDATA[
32
 
class Foo
33
 
{
34
 
    <em>final public static</em> function <em>bar</em>()
35
 
    {
36
 
    }
37
 
}
38
 
        ]]>
39
 
        </code>
40
 
        <code title="Invalid: static keyword used before visibility and final used after.">
41
 
        <![CDATA[
42
 
class Foo
43
 
{
44
 
    <em>static public final</em> function <em>bar</em>()
45
 
    {
46
 
    }
47
 
}
48
 
        ]]>
49
 
        </code>
50
 
    </code_comparison>
51
 
</documentation>