Skip to content

Commit

Permalink
HHVM removes incomplete comments from the token list
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Jan 18, 2018
1 parent 98f079c commit 06e7b37
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 55 deletions.
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1208,9 +1208,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file baseinstalldir="PHP/CodeSniffer" name="DocCommentAlignmentUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="EmptyCatchCommentUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="EmptyCatchCommentUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.1.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.2.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.3.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.js" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.1.js" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.php" role="test" />
Expand Down
50 changes: 41 additions & 9 deletions src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.1.inc
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
<?php



/**
*
* 0Multi-line short description without full stop
*
*
* asdasd
* long description for file (if any)
* asdasdadada
*
* PHP versio
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to [email protected] so we can mail you a copy immediately.
* @package SquizCMS
* @package ADDITIONAL PACKAGE TAG
* @subpkg not_camelcased
* @author Antônio Carlos Venâncio Júnior <[email protected]>
* @author
* @copyright 1997~1994 The PHP Group
* @copyright 1994-1997 The PHP Group
* @copyright The PHP Group
* @license http://www.php.net/license/3_0.txt
* @summary An unknown summary tag
*
*/


?>
<?php
/**
* File comment.
*
* @package Package
* @subpackage Subpackage
* @author Squiz Pty Ltd <[email protected]>
* @copyright 2010-2014 Squiz Pty Ltd (ABN 77 084 670 600)
*/

echo 'hi';
* This bit here is not qualified as file comment
*
* as it is not after the first open tag
*
*/
?>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
* @subpackage Subpackage
* @author Squiz Pty Ltd <[email protected]>
* @copyright 2010-2014 Squiz Pty Ltd (ABN 77 084 670 600)
*
*/

echo 'hi';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/**
* File comment.
*
* @package Package
* @subpackage Subpackage
* @author Squiz Pty Ltd <[email protected]>
* @copyright 2010-2014 Squiz Pty Ltd (ABN 77 084 670 600)
*
43 changes: 0 additions & 43 deletions src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.inc

This file was deleted.

8 changes: 7 additions & 1 deletion src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FileCommentUnitTest extends AbstractSniffUnitTest
public function getErrorList($testFile='FileCommentUnitTest.inc')
{
switch ($testFile) {
case 'FileCommentUnitTest.inc':
case 'FileCommentUnitTest.1.inc':
case 'FileCommentUnitTest.js':
return [
1 => 1,
Expand All @@ -41,6 +41,12 @@ public function getErrorList($testFile='FileCommentUnitTest.inc')
28 => 2,
32 => 2,
];
case 'FileCommentUnitTest.3.inc':
// HHVM just removes the entire comment token, as if it was never there.
if (defined('HHVM_VERSION') === true) {
return [1 => 1];
}
return [];
default:
return [];
}
Expand Down

0 comments on commit 06e7b37

Please sign in to comment.