Skip to content

Commit 06e7b37

Browse files
committed
HHVM removes incomplete comments from the token list
1 parent 98f079c commit 06e7b37

File tree

6 files changed

+61
-55
lines changed

6 files changed

+61
-55
lines changed

package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
12081208
<file baseinstalldir="PHP/CodeSniffer" name="DocCommentAlignmentUnitTest.php" role="test" />
12091209
<file baseinstalldir="PHP/CodeSniffer" name="EmptyCatchCommentUnitTest.inc" role="test" />
12101210
<file baseinstalldir="PHP/CodeSniffer" name="EmptyCatchCommentUnitTest.php" role="test" />
1211-
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.inc" role="test" />
12121211
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.1.inc" role="test" />
12131212
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.2.inc" role="test" />
1213+
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.3.inc" role="test" />
12141214
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.js" role="test" />
12151215
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.1.js" role="test" />
12161216
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.php" role="test" />
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,43 @@
11
<?php
2+
3+
4+
5+
/**
6+
*
7+
* 0Multi-line short description without full stop
8+
*
9+
*
10+
* asdasd
11+
* long description for file (if any)
12+
* asdasdadada
13+
*
14+
* PHP versio
15+
*
16+
* LICENSE: This source file is subject to version 3.0 of the PHP license
17+
* that is available through the world-wide-web at the following URI:
18+
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
19+
* the PHP License and are unable to obtain it through the web, please
20+
* send a note to [email protected] so we can mail you a copy immediately.
21+
* @package SquizCMS
22+
* @package ADDITIONAL PACKAGE TAG
23+
* @subpkg not_camelcased
24+
* @author Antônio Carlos Venâncio Júnior <[email protected]>
25+
* @author
26+
* @copyright 1997~1994 The PHP Group
27+
* @copyright 1994-1997 The PHP Group
28+
* @copyright The PHP Group
29+
* @license http://www.php.net/license/3_0.txt
30+
* @summary An unknown summary tag
31+
*
32+
*/
33+
34+
35+
?>
36+
<?php
237
/**
3-
* File comment.
4-
*
5-
* @package Package
6-
* @subpackage Subpackage
7-
* @author Squiz Pty Ltd <[email protected]>
8-
* @copyright 2010-2014 Squiz Pty Ltd (ABN 77 084 670 600)
9-
*/
10-
11-
echo 'hi';
38+
* This bit here is not qualified as file comment
39+
*
40+
* as it is not after the first open tag
41+
*
42+
*/
43+
?>

src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.2.inc

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
* @subpackage Subpackage
77
* @author Squiz Pty Ltd <[email protected]>
88
* @copyright 2010-2014 Squiz Pty Ltd (ABN 77 084 670 600)
9-
*
9+
*/
10+
11+
echo 'hi';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/**
3+
* File comment.
4+
*
5+
* @package Package
6+
* @subpackage Subpackage
7+
* @author Squiz Pty Ltd <[email protected]>
8+
* @copyright 2010-2014 Squiz Pty Ltd (ABN 77 084 670 600)
9+
*

src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.inc

-43
This file was deleted.

src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FileCommentUnitTest extends AbstractSniffUnitTest
2828
public function getErrorList($testFile='FileCommentUnitTest.inc')
2929
{
3030
switch ($testFile) {
31-
case 'FileCommentUnitTest.inc':
31+
case 'FileCommentUnitTest.1.inc':
3232
case 'FileCommentUnitTest.js':
3333
return [
3434
1 => 1,
@@ -41,6 +41,12 @@ public function getErrorList($testFile='FileCommentUnitTest.inc')
4141
28 => 2,
4242
32 => 2,
4343
];
44+
case 'FileCommentUnitTest.3.inc':
45+
// HHVM just removes the entire comment token, as if it was never there.
46+
if (defined('HHVM_VERSION') === true) {
47+
return [1 => 1];
48+
}
49+
return [];
4450
default:
4551
return [];
4652
}

0 commit comments

Comments
 (0)