PHP 8.2.31
Preview: InlineCommentUnitTest.inc Size: 2.98 KB
/opt/cpanel/ea-wappspector/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/InlineCommentUnitTest.inc

<?php
// Some code goes here.
$code = 'hello';

// This comment contains # multiple
// hash signs (#).
$code = 'hello';

/*
 * Here is a small function comment.
 */
function test()
{
    // Some code goes here.
    $code = 'hello';

    # This comment is banned.
    $code = 'hello';

}//end test()

/*
    A longer comment goes here.
    It spans multiple lines.
*/

# This is a long comment
# that is banned.



// some code goes here!

// This comment contains # multiple
// hash signs (#) but no
// full stop
$code = 'hello';

/*
 * Here is a small function comment
 */
function test()
{
    // Some code goes here

}//end test()

/*
    A longer comment goes here.
    It spans multiple lines!!
    Or does it?
*/

// 0This is a simple multi-line
// comment!
$code = 'hello';

//This is not valid.
$code = 'hello';

//  Neither is this!
$code = 'hello';

//
$code = 'hello';

/** Neither is this! **/
$code = 'hello';

class MyClass
{
    /**
     * Represents a left orientation for the widget.
     *
     * @var   integer
     * @since 4.0.0
     */
    const LEFT = 1;
}

/**
 * Comment should be ignored.
 *
 */
final class MyClass
{
    /**
     * Comment should be ignored.
     *
     */
    final public function test() {}
}

// 这是一条测试评论
//     -> One
//         -> One.One
//     -> Two

/*
    Here is some inline example code:
        -> One
            -> One.One
        -> Two
*/

/**
 * Comment should be ignored in PHP 5.4.
 *
 */
trait MyTrait {

}

$foo = 'foo'; // Var set to foo.

echo $foo;

//	Comment here.
echo $foo;

/**
 * Comments about the include
 */
include_once($blah);

// some comment without capital or full stop
echo $foo; // An unrelated comment.

// An unrelated comment.
echo $foo; // some comment without capital or full stop

class Foo
{
    // This is fine.

    /**
     * Spacing is ignored above.
     */
    function bar(){}
}

if ($foo) {
}//end if
// Another comment here.
$foo++;

if ($foo) {
}//end if
// another comment here.
$foo++;

/**
 * Comment should be ignored, even though there is an attribute between the docblock and the class declaration.
 */

#[AttributeA]

final class MyClass
{
    /**
     * Comment should be ignored, even though there is an attribute between the docblock and the function declaration
     */
    #[AttributeA]
    #[AttributeB]
    final public function test() {}
}

/**
 * Comment should be ignored.
 *
 */
enum MyEnum {

}

/**
 * Comment should be ignored.
 *
 */
readonly class MyClass
{
    /**
     * Comment should be ignored.
     *
     */
    readonly $property = 10;
}

#️⃣ Apparently the emoji keycap number sign (hash) also works and turns this into a comment.
echo 'hello!';

/*
 * N.B.: The below test line must be the last test in the file.
 * Testing that a new line after an inline comment when it's the last non-whitespace
 * token in a file, does *not* throw an error as this would conflict with the common
 * "new line required at end of file" rule.
 */

// For this test line having an empty line below it, is fine.

Directory Contents

Dirs: 0 × Files: 60

Name Size Perms Modified Actions
4.93 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
4.92 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.54 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.53 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.54 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.85 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.92 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
176 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
178 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
216 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
247 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
396 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
441 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.54 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.29 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.29 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.22 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.22 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.46 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
865 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.45 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
982 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1022 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
970 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1010 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
204 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
199 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
192 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
36 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
37 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
267 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
279 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
193 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
265 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
276 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.09 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
10.87 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.63 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
19.92 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
19.98 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
5.07 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.98 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.96 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.96 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.94 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.42 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
17.25 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
17.42 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
7.00 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
7.05 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.76 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
579 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
582 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
53 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.35 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.36 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.99 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
7.57 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
7.59 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
2.05 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).