mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 19:51:30 +00:00
updated streamline-setup v2
This commit is contained in:
+16
@@ -72,6 +72,22 @@ final class ConfigDouble extends Config
|
||||
}//end __construct()
|
||||
|
||||
|
||||
/**
|
||||
* Ensures the static properties in the Config class are reset to their default values
|
||||
* when the ConfigDouble is no longer used.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setStaticConfigProperty('overriddenDefaults', []);
|
||||
$this->setStaticConfigProperty('executablePaths', []);
|
||||
$this->setStaticConfigProperty('configData', null);
|
||||
$this->setStaticConfigProperty('configDataFile', null);
|
||||
|
||||
}//end __destruct()
|
||||
|
||||
|
||||
/**
|
||||
* Sets the command line values and optionally prevents a file system search for a custom ruleset.
|
||||
*
|
||||
|
||||
Vendored
+43
-5
@@ -9,9 +9,10 @@
|
||||
|
||||
namespace PHP_CodeSniffer\Tests\Core;
|
||||
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use Exception;
|
||||
use PHP_CodeSniffer\Files\DummyFile;
|
||||
use PHP_CodeSniffer\Files\File;
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use PHP_CodeSniffer\Tests\ConfigDouble;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -57,7 +58,8 @@ abstract class AbstractMethodUnitTest extends TestCase
|
||||
*/
|
||||
public static function initializeFile()
|
||||
{
|
||||
$config = new ConfigDouble();
|
||||
$_SERVER['argv'] = [];
|
||||
$config = new ConfigDouble();
|
||||
// Also set a tab-width to enable testing tab-replaced vs `orig_content`.
|
||||
$config->tabWidth = static::$tabWidth;
|
||||
|
||||
@@ -73,11 +75,38 @@ abstract class AbstractMethodUnitTest extends TestCase
|
||||
$contents .= file_get_contents($pathToTestFile);
|
||||
|
||||
self::$phpcsFile = new DummyFile($contents, $ruleset, $config);
|
||||
self::$phpcsFile->process();
|
||||
self::$phpcsFile->parse();
|
||||
|
||||
}//end initializeFile()
|
||||
|
||||
|
||||
/**
|
||||
* Clean up after finished test by resetting all static properties on the class to their default values.
|
||||
*
|
||||
* Note: This is a PHPUnit cross-version compatible {@see \PHPUnit\Framework\TestCase::tearDownAfterClass()}
|
||||
* method.
|
||||
*
|
||||
* @afterClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function reset()
|
||||
{
|
||||
// Explicitly trigger __destruct() on the ConfigDouble to reset the Config statics.
|
||||
// The explicit method call prevents potential stray test-local references to the $config object
|
||||
// preventing the destructor from running the clean up (which without stray references would be
|
||||
// automagically triggered when `self::$phpcsFile` is reset, but we can't definitively rely on that).
|
||||
if (isset(self::$phpcsFile) === true) {
|
||||
self::$phpcsFile->config->__destruct();
|
||||
}
|
||||
|
||||
self::$fileExtension = 'inc';
|
||||
self::$tabWidth = 4;
|
||||
self::$phpcsFile = null;
|
||||
|
||||
}//end reset()
|
||||
|
||||
|
||||
/**
|
||||
* Get the token pointer for a target token based on a specific comment found on the line before.
|
||||
*
|
||||
@@ -109,6 +138,9 @@ abstract class AbstractMethodUnitTest extends TestCase
|
||||
* @param string $tokenContent Optional. The token content for the target token.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws Exception When the test delimiter comment is not found.
|
||||
* @throws Exception When the test target token is not found.
|
||||
*/
|
||||
public static function getTargetTokenFromFile(File $phpcsFile, $commentString, $tokenType, $tokenContent=null)
|
||||
{
|
||||
@@ -121,6 +153,12 @@ abstract class AbstractMethodUnitTest extends TestCase
|
||||
$commentString
|
||||
);
|
||||
|
||||
if ($comment === false) {
|
||||
throw new Exception(
|
||||
sprintf('Failed to find the test marker: %s in test case file %s', $commentString, $phpcsFile->getFilename())
|
||||
);
|
||||
}
|
||||
|
||||
$tokens = $phpcsFile->getTokens();
|
||||
$end = ($start + 1);
|
||||
|
||||
@@ -147,10 +185,10 @@ abstract class AbstractMethodUnitTest extends TestCase
|
||||
if ($target === false) {
|
||||
$msg = 'Failed to find test target token for comment string: '.$commentString;
|
||||
if ($tokenContent !== null) {
|
||||
$msg .= ' With token content: '.$tokenContent;
|
||||
$msg .= ' with token content: '.$tokenContent;
|
||||
}
|
||||
|
||||
self::assertFalse(true, $msg);
|
||||
throw new Exception($msg);
|
||||
}
|
||||
|
||||
return $target;
|
||||
|
||||
+1
-1
@@ -11,8 +11,8 @@
|
||||
namespace PHP_CodeSniffer\Tests\Core;
|
||||
|
||||
use PHP_CodeSniffer\Tests\FileList;
|
||||
use PHPUnit\TextUI\TestRunner;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\TextUI\TestRunner;
|
||||
|
||||
class AllTests
|
||||
{
|
||||
|
||||
Vendored
+3
-3
@@ -244,7 +244,7 @@ final class ReportWidthTest extends TestCase
|
||||
/**
|
||||
* Test that the report width will be set correctly for various types of input.
|
||||
*
|
||||
* @param mixed $input Input value received.
|
||||
* @param mixed $value Input value received.
|
||||
* @param int $expected Expected report width.
|
||||
*
|
||||
* @dataProvider dataReportWidthInputHandling
|
||||
@@ -252,10 +252,10 @@ final class ReportWidthTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReportWidthInputHandling($input, $expected)
|
||||
public function testReportWidthInputHandling($value, $expected)
|
||||
{
|
||||
$config = new Config();
|
||||
$config->reportWidth = $input;
|
||||
$config->reportWidth = $value;
|
||||
|
||||
$this->assertSame($expected, $config->reportWidth);
|
||||
|
||||
|
||||
Vendored
+200
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
/**
|
||||
* Tests for the \PHP_CodeSniffer\Config --sniffs and --exclude arguments.
|
||||
*
|
||||
* @author Dan Wallis <dan@wallis.nz>
|
||||
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
||||
*/
|
||||
|
||||
namespace PHP_CodeSniffer\Tests\Core\Config;
|
||||
|
||||
use PHP_CodeSniffer\Tests\ConfigDouble;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Tests for the \PHP_CodeSniffer\Config --sniffs and --exclude arguments.
|
||||
*
|
||||
* @covers \PHP_CodeSniffer\Config::processLongArgument
|
||||
*/
|
||||
final class SniffsExcludeArgsTest extends TestCase
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Ensure that the expected error message is returned for invalid arguments.
|
||||
*
|
||||
* @param string $argument 'sniffs' or 'exclude'.
|
||||
* @param string $value List of sniffs to include / exclude.
|
||||
* @param string $message Expected error message text.
|
||||
*
|
||||
* @return void
|
||||
* @dataProvider dataInvalidSniffs
|
||||
*/
|
||||
public function testInvalid($argument, $value, $message)
|
||||
{
|
||||
$exception = 'PHP_CodeSniffer\Exceptions\DeepExitException';
|
||||
|
||||
if (method_exists($this, 'expectException') === true) {
|
||||
// PHPUnit 5+.
|
||||
$this->expectException($exception);
|
||||
$this->expectExceptionMessage($message);
|
||||
} else {
|
||||
// PHPUnit 4.
|
||||
$this->setExpectedException($exception, $message);
|
||||
}
|
||||
|
||||
new ConfigDouble(["--$argument=$value"]);
|
||||
|
||||
}//end testInvalid()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider for testInvalid().
|
||||
*
|
||||
* @see self::testInvalid()
|
||||
* @return array<string, array<string, string>>
|
||||
*/
|
||||
public static function dataInvalidSniffs()
|
||||
{
|
||||
$arguments = [
|
||||
'sniffs',
|
||||
'exclude',
|
||||
];
|
||||
$data = [];
|
||||
|
||||
$messageTemplate = 'ERROR: The specified sniff code "%s" is invalid'.PHP_EOL.PHP_EOL;
|
||||
|
||||
foreach ($arguments as $argument) {
|
||||
// An empty string is not a valid sniff.
|
||||
$data[$argument.'; empty string'] = [
|
||||
'argument' => $argument,
|
||||
'value' => '',
|
||||
'message' => sprintf($messageTemplate, ''),
|
||||
];
|
||||
|
||||
// A standard is not a valid sniff.
|
||||
$data[$argument.'; standard'] = [
|
||||
'argument' => $argument,
|
||||
'value' => 'Standard',
|
||||
'message' => sprintf($messageTemplate, 'Standard'),
|
||||
];
|
||||
|
||||
// A category is not a valid sniff.
|
||||
$data[$argument.'; category'] = [
|
||||
'argument' => $argument,
|
||||
'value' => 'Standard.Category',
|
||||
'message' => sprintf($messageTemplate, 'Standard.Category'),
|
||||
];
|
||||
|
||||
// An error-code is not a valid sniff.
|
||||
$data[$argument.'; error-code'] = [
|
||||
'argument' => $argument,
|
||||
'value' => 'Standard.Category',
|
||||
'message' => sprintf($messageTemplate, 'Standard.Category'),
|
||||
];
|
||||
|
||||
// Only the first error is reported.
|
||||
$data[$argument.'; two errors'] = [
|
||||
'argument' => $argument,
|
||||
'value' => 'StandardOne,StandardTwo',
|
||||
'message' => sprintf($messageTemplate, 'StandardOne'),
|
||||
];
|
||||
$data[$argument.'; valid followed by invalid'] = [
|
||||
'argument' => $argument,
|
||||
'value' => 'StandardOne.Category.Sniff,StandardTwo.Category',
|
||||
'message' => sprintf($messageTemplate, 'StandardTwo.Category'),
|
||||
];
|
||||
}//end foreach
|
||||
|
||||
return $data;
|
||||
|
||||
}//end dataInvalidSniffs()
|
||||
|
||||
|
||||
/**
|
||||
* Ensure that the valid data does not throw an exception, and the value is stored.
|
||||
*
|
||||
* @param string $argument 'sniffs' or 'exclude'.
|
||||
* @param string $value List of sniffs to include or exclude.
|
||||
*
|
||||
* @return void
|
||||
* @dataProvider dataValidSniffs
|
||||
*/
|
||||
public function testValid($argument, $value)
|
||||
{
|
||||
$config = new ConfigDouble(["--$argument=$value"]);
|
||||
|
||||
$this->assertSame(explode(',', $value), $config->$argument);
|
||||
|
||||
}//end testValid()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider for testValid().
|
||||
*
|
||||
* @see self::testValid()
|
||||
* @return array<string, array<string, string>>
|
||||
*/
|
||||
public static function dataValidSniffs()
|
||||
{
|
||||
$arguments = [
|
||||
'sniffs',
|
||||
'exclude',
|
||||
];
|
||||
$data = [];
|
||||
|
||||
foreach ($arguments as $argument) {
|
||||
$data[$argument.'; one valid sniff'] = [
|
||||
'argument' => $argument,
|
||||
'value' => 'Standard.Category.Sniff',
|
||||
];
|
||||
$data[$argument.'; two valid sniffs'] = [
|
||||
'argument' => $argument,
|
||||
'value' => 'StandardOne.Category.Sniff,StandardTwo.Category.Sniff',
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}//end dataValidSniffs()
|
||||
|
||||
|
||||
/**
|
||||
* Ensure that only the first argument is processed and others are ignored.
|
||||
*
|
||||
* @param string $argument 'sniffs' or 'exclude'.
|
||||
*
|
||||
* @return void
|
||||
* @dataProvider dataOnlySetOnce
|
||||
*/
|
||||
public function testOnlySetOnce($argument)
|
||||
{
|
||||
$config = new ConfigDouble(
|
||||
[
|
||||
"--$argument=StandardOne.Category.Sniff",
|
||||
"--$argument=StandardTwo.Category.Sniff",
|
||||
"--$argument=Standard.AnotherCategory.Sniff",
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertSame(['StandardOne.Category.Sniff'], $config->$argument);
|
||||
|
||||
}//end testOnlySetOnce()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider for testOnlySetOnce().
|
||||
*
|
||||
* @return array<string, array<string>>
|
||||
*/
|
||||
public static function dataOnlySetOnce()
|
||||
{
|
||||
return [
|
||||
'sniffs' => ['sniffs'],
|
||||
'exclude' => ['exclude'],
|
||||
];
|
||||
|
||||
}//end dataOnlySetOnce()
|
||||
|
||||
|
||||
}//end class
|
||||
+4
-4
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace PHP_CodeSniffer\Tests\Core;
|
||||
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use PHP_CodeSniffer\Files\DummyFile;
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use PHP_CodeSniffer\Tests\ConfigDouble;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -730,9 +730,9 @@ EOD;
|
||||
{
|
||||
return [
|
||||
'no suppression' => [
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'expectedErrors' => 1,
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'expectedWarnings' => 1,
|
||||
],
|
||||
|
||||
// Process with suppression.
|
||||
|
||||
Vendored
+37
@@ -10,6 +10,7 @@
|
||||
namespace PHP_CodeSniffer\Tests\Core\File;
|
||||
|
||||
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
|
||||
use PHP_CodeSniffer\Util\Tokens;
|
||||
|
||||
/**
|
||||
* Tests for the \PHP_CodeSniffer\Files\File::findEndOfStatement method.
|
||||
@@ -20,6 +21,42 @@ final class FindEndOfStatementTest extends AbstractMethodUnitTest
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Test that end of statement is NEVER before the "current" token.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEndIsNeverLessThanCurrentToken()
|
||||
{
|
||||
$tokens = self::$phpcsFile->getTokens();
|
||||
$errors = [];
|
||||
|
||||
for ($i = 0; $i < self::$phpcsFile->numTokens; $i++) {
|
||||
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$end = self::$phpcsFile->findEndOfStatement($i);
|
||||
|
||||
// Collect all the errors.
|
||||
if ($end < $i) {
|
||||
$errors[] = sprintf(
|
||||
'End of statement for token %1$d (%2$s: %3$s) on line %4$d is %5$d (%6$s), which is less than %1$d',
|
||||
$i,
|
||||
$tokens[$i]['type'],
|
||||
$tokens[$i]['content'],
|
||||
$tokens[$i]['line'],
|
||||
$end,
|
||||
$tokens[$end]['type']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSame([], $errors);
|
||||
|
||||
}//end testEndIsNeverLessThanCurrentToken()
|
||||
|
||||
|
||||
/**
|
||||
* Test a simple assignment.
|
||||
*
|
||||
|
||||
Vendored
+41
-5
@@ -14,7 +14,7 @@ while(true) {}
|
||||
$a = 1;
|
||||
|
||||
/* testClosureAssignment */
|
||||
$a = function($b=false;){};
|
||||
$a = function($b=false){};
|
||||
|
||||
/* testHeredocFunctionArg */
|
||||
myFunction(<<<END
|
||||
@@ -39,8 +39,8 @@ use Vendor\Package\{ClassA as A, ClassB, ClassC as C};
|
||||
|
||||
$a = [
|
||||
/* testArrowFunctionArrayValue */
|
||||
'a' => fn() => return 1,
|
||||
'b' => fn() => return 1,
|
||||
'a' => fn() => 1,
|
||||
'b' => fn() => 1,
|
||||
];
|
||||
|
||||
/* testStaticArrowFunction */
|
||||
@@ -139,11 +139,11 @@ switch ($foo) {
|
||||
/* testInsideCaseStatement */
|
||||
$var = doSomething();
|
||||
/* testInsideCaseBreakStatement */
|
||||
break 2;
|
||||
break 1;
|
||||
|
||||
case 2:
|
||||
/* testInsideCaseContinueStatement */
|
||||
continue 2;
|
||||
continue 1;
|
||||
|
||||
case 3:
|
||||
/* testInsideCaseReturnStatement */
|
||||
@@ -162,3 +162,39 @@ switch ($foo) {
|
||||
/* testInsideDefaultContinueStatement */
|
||||
continue $var;
|
||||
}
|
||||
|
||||
match ($var) {
|
||||
true =>
|
||||
/* test437ClosureDeclaration */
|
||||
function ($var) {
|
||||
/* test437EchoNestedWithinClosureWithinMatch */
|
||||
echo $var, 'text', PHP_EOL;
|
||||
},
|
||||
default => false
|
||||
};
|
||||
|
||||
match ($var) {
|
||||
/* test437NestedLongArrayWithinMatch */
|
||||
'a' => array( 1, 2.5, $var),
|
||||
/* test437NestedFunctionCallWithinMatch */
|
||||
'b' => functionCall( 11, $var, 50.50),
|
||||
/* test437NestedArrowFunctionWithinMatch */
|
||||
'c' => fn($p1, /* test437FnSecondParamWithinMatch */ $p2) => $p1 + $p2,
|
||||
default => false
|
||||
};
|
||||
|
||||
callMe($paramA, match ($var) {
|
||||
/* test437NestedLongArrayWithinNestedMatch */
|
||||
'a' => array( 1, 2.5, $var),
|
||||
/* test437NestedFunctionCallWithinNestedMatch */
|
||||
'b' => functionCall( 11, $var, 50.50),
|
||||
/* test437NestedArrowFunctionWithinNestedMatch */
|
||||
'c' => fn($p1, /* test437FnSecondParamWithinNestedMatch */ $p2) => $p1 + $p2,
|
||||
default => false
|
||||
});
|
||||
|
||||
match ($var) {
|
||||
/* test437NestedShortArrayWithinMatch */
|
||||
'a' => [ 1, 2.5, $var],
|
||||
default => false
|
||||
};
|
||||
|
||||
Vendored
+335
-2
@@ -12,6 +12,7 @@
|
||||
namespace PHP_CodeSniffer\Tests\Core\File;
|
||||
|
||||
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
|
||||
use PHP_CodeSniffer\Util\Tokens;
|
||||
|
||||
/**
|
||||
* Tests for the \PHP_CodeSniffer\Files\File:findStartOfStatement method.
|
||||
@@ -22,6 +23,42 @@ final class FindStartOfStatementTest extends AbstractMethodUnitTest
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Test that start of statement is NEVER beyond the "current" token.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testStartIsNeverMoreThanCurrentToken()
|
||||
{
|
||||
$tokens = self::$phpcsFile->getTokens();
|
||||
$errors = [];
|
||||
|
||||
for ($i = 0; $i < self::$phpcsFile->numTokens; $i++) {
|
||||
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$start = self::$phpcsFile->findStartOfStatement($i);
|
||||
|
||||
// Collect all the errors.
|
||||
if ($start > $i) {
|
||||
$errors[] = sprintf(
|
||||
'Start of statement for token %1$d (%2$s: %3$s) on line %4$d is %5$d (%6$s), which is more than %1$d',
|
||||
$i,
|
||||
$tokens[$i]['type'],
|
||||
$tokens[$i]['content'],
|
||||
$tokens[$i]['line'],
|
||||
$start,
|
||||
$tokens[$start]['type']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSame([], $errors);
|
||||
|
||||
}//end testStartIsNeverMoreThanCurrentToken()
|
||||
|
||||
|
||||
/**
|
||||
* Test a simple assignment.
|
||||
*
|
||||
@@ -92,7 +129,7 @@ final class FindStartOfStatementTest extends AbstractMethodUnitTest
|
||||
$start = $this->getTargetToken('/* testClosureAssignment */', T_CLOSE_CURLY_BRACKET);
|
||||
$found = self::$phpcsFile->findStartOfStatement($start);
|
||||
|
||||
$this->assertSame(($start - 12), $found);
|
||||
$this->assertSame(($start - 11), $found);
|
||||
|
||||
}//end testClosureAssignment()
|
||||
|
||||
@@ -224,7 +261,7 @@ final class FindStartOfStatementTest extends AbstractMethodUnitTest
|
||||
$start = $this->getTargetToken('/* testArrowFunctionArrayValue */', T_COMMA);
|
||||
$found = self::$phpcsFile->findStartOfStatement($start);
|
||||
|
||||
$this->assertSame(($start - 9), $found);
|
||||
$this->assertSame(($start - 7), $found);
|
||||
|
||||
}//end testArrowFunctionArrayValue()
|
||||
|
||||
@@ -637,4 +674,300 @@ final class FindStartOfStatementTest extends AbstractMethodUnitTest
|
||||
}//end dataFindStartInsideSwitchCaseDefaultStatements()
|
||||
|
||||
|
||||
/**
|
||||
* Test finding the start of a statement inside a closed scope nested within a match expressions.
|
||||
*
|
||||
* @param string $testMarker The comment which prefaces the target token in the test file.
|
||||
* @param int|string $target The token to search for after the test marker.
|
||||
* @param int|string $expectedTarget Token code of the expected start of statement stack pointer.
|
||||
*
|
||||
* @link https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/437
|
||||
*
|
||||
* @dataProvider dataFindStartInsideClosedScopeNestedWithinMatch
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindStartInsideClosedScopeNestedWithinMatch($testMarker, $target, $expectedTarget)
|
||||
{
|
||||
$testToken = $this->getTargetToken($testMarker, $target);
|
||||
$expected = $this->getTargetToken($testMarker, $expectedTarget);
|
||||
|
||||
$found = self::$phpcsFile->findStartOfStatement($testToken);
|
||||
|
||||
$this->assertSame($expected, $found);
|
||||
|
||||
}//end testFindStartInsideClosedScopeNestedWithinMatch()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider.
|
||||
*
|
||||
* @return array<string, array<string, int|string>>
|
||||
*/
|
||||
public static function dataFindStartInsideClosedScopeNestedWithinMatch()
|
||||
{
|
||||
return [
|
||||
// These were already working correctly.
|
||||
'Closure function keyword should be start of closure - closure keyword' => [
|
||||
'testMarker' => '/* test437ClosureDeclaration */',
|
||||
'target' => T_CLOSURE,
|
||||
'expectedTarget' => T_CLOSURE,
|
||||
],
|
||||
'Open curly is a statement/expression opener - open curly' => [
|
||||
'testMarker' => '/* test437ClosureDeclaration */',
|
||||
'target' => T_OPEN_CURLY_BRACKET,
|
||||
'expectedTarget' => T_OPEN_CURLY_BRACKET,
|
||||
],
|
||||
|
||||
'Echo should be start for expression - echo keyword' => [
|
||||
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
|
||||
'target' => T_ECHO,
|
||||
'expectedTarget' => T_ECHO,
|
||||
],
|
||||
'Echo should be start for expression - variable' => [
|
||||
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_ECHO,
|
||||
],
|
||||
'Echo should be start for expression - comma' => [
|
||||
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
|
||||
'target' => T_COMMA,
|
||||
'expectedTarget' => T_ECHO,
|
||||
],
|
||||
|
||||
// These were not working correctly and would previously return the close curly of the match expression.
|
||||
'First token after comma in echo expression should be start for expression - text string' => [
|
||||
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
|
||||
'target' => T_CONSTANT_ENCAPSED_STRING,
|
||||
'expectedTarget' => T_CONSTANT_ENCAPSED_STRING,
|
||||
],
|
||||
'First token after comma in echo expression - PHP_EOL constant' => [
|
||||
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
|
||||
'target' => T_STRING,
|
||||
'expectedTarget' => T_STRING,
|
||||
],
|
||||
'First token after comma in echo expression - semicolon' => [
|
||||
'testMarker' => '/* test437EchoNestedWithinClosureWithinMatch */',
|
||||
'target' => T_SEMICOLON,
|
||||
'expectedTarget' => T_STRING,
|
||||
],
|
||||
];
|
||||
|
||||
}//end dataFindStartInsideClosedScopeNestedWithinMatch()
|
||||
|
||||
|
||||
/**
|
||||
* Test finding the start of a statement for a token within a set of parentheses within a match expressions.
|
||||
*
|
||||
* @param string $testMarker The comment which prefaces the target token in the test file.
|
||||
* @param int|string $target The token to search for after the test marker.
|
||||
* @param int|string $expectedTarget Token code of the expected start of statement stack pointer.
|
||||
*
|
||||
* @link https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/437
|
||||
*
|
||||
* @dataProvider dataFindStartInsideParenthesesNestedWithinMatch
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindStartInsideParenthesesNestedWithinMatch($testMarker, $target, $expectedTarget)
|
||||
{
|
||||
$testToken = $this->getTargetToken($testMarker, $target);
|
||||
$expected = $this->getTargetToken($testMarker, $expectedTarget);
|
||||
|
||||
$found = self::$phpcsFile->findStartOfStatement($testToken);
|
||||
|
||||
$this->assertSame($expected, $found);
|
||||
|
||||
}//end testFindStartInsideParenthesesNestedWithinMatch()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider.
|
||||
*
|
||||
* @return array<string, array<string, int|string>>
|
||||
*/
|
||||
public static function dataFindStartInsideParenthesesNestedWithinMatch()
|
||||
{
|
||||
return [
|
||||
'Array item itself should be start for first array item' => [
|
||||
'testMarker' => '/* test437NestedLongArrayWithinMatch */',
|
||||
'target' => T_LNUMBER,
|
||||
'expectedTarget' => T_LNUMBER,
|
||||
],
|
||||
'Array item itself should be start for second array item' => [
|
||||
'testMarker' => '/* test437NestedLongArrayWithinMatch */',
|
||||
'target' => T_DNUMBER,
|
||||
'expectedTarget' => T_DNUMBER,
|
||||
],
|
||||
'Array item itself should be start for third array item' => [
|
||||
'testMarker' => '/* test437NestedLongArrayWithinMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
|
||||
'Parameter itself should be start for first param passed to function call' => [
|
||||
'testMarker' => '/* test437NestedFunctionCallWithinMatch */',
|
||||
'target' => T_LNUMBER,
|
||||
'expectedTarget' => T_LNUMBER,
|
||||
],
|
||||
'Parameter itself should be start for second param passed to function call' => [
|
||||
'testMarker' => '/* test437NestedFunctionCallWithinMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
'Parameter itself should be start for third param passed to function call' => [
|
||||
'testMarker' => '/* test437NestedFunctionCallWithinMatch */',
|
||||
'target' => T_DNUMBER,
|
||||
'expectedTarget' => T_DNUMBER,
|
||||
],
|
||||
|
||||
'Parameter itself should be start for first param declared in arrow function' => [
|
||||
'testMarker' => '/* test437NestedArrowFunctionWithinMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
'Parameter itself should be start for second param declared in arrow function' => [
|
||||
'testMarker' => '/* test437FnSecondParamWithinMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
];
|
||||
|
||||
}//end dataFindStartInsideParenthesesNestedWithinMatch()
|
||||
|
||||
|
||||
/**
|
||||
* Test finding the start of a statement for a token within a set of parentheses within a match expressions,
|
||||
* which itself is nested within parentheses.
|
||||
*
|
||||
* @param string $testMarker The comment which prefaces the target token in the test file.
|
||||
* @param int|string $target The token to search for after the test marker.
|
||||
* @param int|string $expectedTarget Token code of the expected start of statement stack pointer.
|
||||
*
|
||||
* @link https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/437
|
||||
*
|
||||
* @dataProvider dataFindStartInsideParenthesesNestedWithinNestedMatch
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindStartInsideParenthesesNestedWithinNestedMatch($testMarker, $target, $expectedTarget)
|
||||
{
|
||||
$testToken = $this->getTargetToken($testMarker, $target);
|
||||
$expected = $this->getTargetToken($testMarker, $expectedTarget);
|
||||
|
||||
$found = self::$phpcsFile->findStartOfStatement($testToken);
|
||||
|
||||
$this->assertSame($expected, $found);
|
||||
|
||||
}//end testFindStartInsideParenthesesNestedWithinNestedMatch()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider.
|
||||
*
|
||||
* @return array<string, array<string, int|string>>
|
||||
*/
|
||||
public static function dataFindStartInsideParenthesesNestedWithinNestedMatch()
|
||||
{
|
||||
return [
|
||||
'Array item itself should be start for first array item' => [
|
||||
'testMarker' => '/* test437NestedLongArrayWithinNestedMatch */',
|
||||
'target' => T_LNUMBER,
|
||||
'expectedTarget' => T_LNUMBER,
|
||||
],
|
||||
'Array item itself should be start for second array item' => [
|
||||
'testMarker' => '/* test437NestedLongArrayWithinNestedMatch */',
|
||||
'target' => T_DNUMBER,
|
||||
'expectedTarget' => T_DNUMBER,
|
||||
],
|
||||
'Array item itself should be start for third array item' => [
|
||||
'testMarker' => '/* test437NestedLongArrayWithinNestedMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
|
||||
'Parameter itself should be start for first param passed to function call' => [
|
||||
'testMarker' => '/* test437NestedFunctionCallWithinNestedMatch */',
|
||||
'target' => T_LNUMBER,
|
||||
'expectedTarget' => T_LNUMBER,
|
||||
],
|
||||
'Parameter itself should be start for second param passed to function call' => [
|
||||
'testMarker' => '/* test437NestedFunctionCallWithinNestedMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
'Parameter itself should be start for third param passed to function call' => [
|
||||
'testMarker' => '/* test437NestedFunctionCallWithinNestedMatch */',
|
||||
'target' => T_DNUMBER,
|
||||
'expectedTarget' => T_DNUMBER,
|
||||
],
|
||||
|
||||
'Parameter itself should be start for first param declared in arrow function' => [
|
||||
'testMarker' => '/* test437NestedArrowFunctionWithinNestedMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
'Parameter itself should be start for second param declared in arrow function' => [
|
||||
'testMarker' => '/* test437FnSecondParamWithinNestedMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
];
|
||||
|
||||
}//end dataFindStartInsideParenthesesNestedWithinNestedMatch()
|
||||
|
||||
|
||||
/**
|
||||
* Test finding the start of a statement for a token within a short array within a match expressions.
|
||||
*
|
||||
* @param string $testMarker The comment which prefaces the target token in the test file.
|
||||
* @param int|string $target The token to search for after the test marker.
|
||||
* @param int|string $expectedTarget Token code of the expected start of statement stack pointer.
|
||||
*
|
||||
* @link https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/437
|
||||
*
|
||||
* @dataProvider dataFindStartInsideShortArrayNestedWithinMatch
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindStartInsideShortArrayNestedWithinMatch($testMarker, $target, $expectedTarget)
|
||||
{
|
||||
$testToken = $this->getTargetToken($testMarker, $target);
|
||||
$expected = $this->getTargetToken($testMarker, $expectedTarget);
|
||||
|
||||
$found = self::$phpcsFile->findStartOfStatement($testToken);
|
||||
|
||||
$this->assertSame($expected, $found);
|
||||
|
||||
}//end testFindStartInsideShortArrayNestedWithinMatch()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider.
|
||||
*
|
||||
* @return array<string, array<string, int|string>>
|
||||
*/
|
||||
public static function dataFindStartInsideShortArrayNestedWithinMatch()
|
||||
{
|
||||
return [
|
||||
'Array item itself should be start for first array item' => [
|
||||
'testMarker' => '/* test437NestedShortArrayWithinMatch */',
|
||||
'target' => T_LNUMBER,
|
||||
'expectedTarget' => T_LNUMBER,
|
||||
],
|
||||
'Array item itself should be start for second array item' => [
|
||||
'testMarker' => '/* test437NestedShortArrayWithinMatch */',
|
||||
'target' => T_DNUMBER,
|
||||
'expectedTarget' => T_DNUMBER,
|
||||
],
|
||||
'Array item itself should be start for third array item' => [
|
||||
'testMarker' => '/* test437NestedShortArrayWithinMatch */',
|
||||
'target' => T_VARIABLE,
|
||||
'expectedTarget' => T_VARIABLE,
|
||||
],
|
||||
];
|
||||
|
||||
}//end dataFindStartInsideShortArrayNestedWithinMatch()
|
||||
|
||||
|
||||
}//end class
|
||||
|
||||
Vendored
+15
@@ -339,3 +339,18 @@ class WhitespaceAndCommentsInTypes {
|
||||
/* testIntersectionTypeWithWhitespaceAndComment */
|
||||
public \Foo /*comment*/ & Bar $hasWhitespaceAndComment;
|
||||
}
|
||||
|
||||
trait DNFTypes {
|
||||
/* testPHP82DNFTypeStatic */
|
||||
public static (Foo&\Bar)|bool $propA;
|
||||
|
||||
/* testPHP82DNFTypeReadonlyA */
|
||||
protected readonly float|(Partially\Qualified&Traversable) $propB;
|
||||
|
||||
/* testPHP82DNFTypeReadonlyB */
|
||||
private readonly (namespace\Foo&Bar)|string $propC;
|
||||
|
||||
/* testPHP82DNFTypeIllegalNullable */
|
||||
// Intentional fatal error - nullable operator cannot be combined with DNF.
|
||||
var ?(A&\Pck\B)|bool $propD;
|
||||
}
|
||||
|
||||
Vendored
+55
-3
@@ -1075,6 +1075,58 @@ final class GetMemberPropertiesTest extends AbstractMethodUnitTest
|
||||
],
|
||||
],
|
||||
|
||||
'php8.2-dnf-with-static' => [
|
||||
'identifier' => '/* testPHP82DNFTypeStatic */',
|
||||
'expected' => [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => true,
|
||||
'is_static' => true,
|
||||
'is_readonly' => false,
|
||||
'type' => '(Foo&\Bar)|bool',
|
||||
'type_token' => -9,
|
||||
'type_end_token' => -2,
|
||||
'nullable_type' => false,
|
||||
],
|
||||
],
|
||||
'php8.2-dnf-with-readonly-1' => [
|
||||
'identifier' => '/* testPHP82DNFTypeReadonlyA */',
|
||||
'expected' => [
|
||||
'scope' => 'protected',
|
||||
'scope_specified' => true,
|
||||
'is_static' => false,
|
||||
'is_readonly' => true,
|
||||
'type' => 'float|(Partially\Qualified&Traversable)',
|
||||
'type_token' => -10,
|
||||
'type_end_token' => -2,
|
||||
'nullable_type' => false,
|
||||
],
|
||||
],
|
||||
'php8.2-dnf-with-readonly-2' => [
|
||||
'identifier' => '/* testPHP82DNFTypeReadonlyB */',
|
||||
'expected' => [
|
||||
'scope' => 'private',
|
||||
'scope_specified' => true,
|
||||
'is_static' => false,
|
||||
'is_readonly' => true,
|
||||
'type' => '(namespace\Foo&Bar)|string',
|
||||
'type_token' => -10,
|
||||
'type_end_token' => -2,
|
||||
'nullable_type' => false,
|
||||
],
|
||||
],
|
||||
'php8.2-dnf-with-illegal-nullable' => [
|
||||
'identifier' => '/* testPHP82DNFTypeIllegalNullable */',
|
||||
'expected' => [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'is_static' => false,
|
||||
'is_readonly' => false,
|
||||
'type' => '?(A&\Pck\B)|bool',
|
||||
'type_token' => -11,
|
||||
'type_end_token' => -2,
|
||||
'nullable_type' => true,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
}//end dataGetMemberProperties()
|
||||
@@ -1094,7 +1146,7 @@ final class GetMemberPropertiesTest extends AbstractMethodUnitTest
|
||||
$this->expectRunTimeException('$stackPtr is not a class member var');
|
||||
|
||||
$variable = $this->getTargetToken($identifier, T_VARIABLE);
|
||||
$result = self::$phpcsFile->getMemberProperties($variable);
|
||||
self::$phpcsFile->getMemberProperties($variable);
|
||||
|
||||
}//end testNotClassPropertyException()
|
||||
|
||||
@@ -1130,8 +1182,8 @@ final class GetMemberPropertiesTest extends AbstractMethodUnitTest
|
||||
{
|
||||
$this->expectRunTimeException('$stackPtr must be of type T_VARIABLE');
|
||||
|
||||
$next = $this->getTargetToken('/* testNotAVariable */', T_RETURN);
|
||||
$result = self::$phpcsFile->getMemberProperties($next);
|
||||
$next = $this->getTargetToken('/* testNotAVariable */', T_RETURN);
|
||||
self::$phpcsFile->getMemberProperties($next);
|
||||
|
||||
}//end testNotAVariableException()
|
||||
|
||||
|
||||
Vendored
+17
@@ -280,6 +280,23 @@ function newInInitializers(
|
||||
\Package\TypeB $newToo = new \Package\TypeB(10, 'string'),
|
||||
) {}
|
||||
|
||||
/* testPHP82DNFTypes */
|
||||
function dnfTypes(
|
||||
#[MyAttribute]
|
||||
false|(Foo&Bar)|true $obj1,
|
||||
(\Boo&\Pck\Bar)|(Boo&Baz) $obj2 = new Boo()
|
||||
) {}
|
||||
|
||||
/* testPHP82DNFTypesWithSpreadOperatorAndReference */
|
||||
function dnfInGlobalFunctionWithSpreadAndReference((Countable&MeMe)|iterable &$paramA, true|(Foo&Bar) ...$paramB) {}
|
||||
|
||||
/* testPHP82DNFTypesIllegalNullable */
|
||||
// Intentional fatal error - nullable operator cannot be combined with DNF.
|
||||
$dnf_closure = function (? ( MyClassA & /*comment*/ \Package\MyClassB & \Package\MyClassC ) $var): void {};
|
||||
|
||||
/* testPHP82DNFTypesInArrow */
|
||||
$dnf_arrow = fn((Hi&Ho)|FALSE &...$range): string => $a;
|
||||
|
||||
/* testFunctionCallFnPHPCS353-354 */
|
||||
$value = $obj->fn(true);
|
||||
|
||||
|
||||
Vendored
+156
-1
@@ -2450,7 +2450,7 @@ final class GetMethodParametersTest extends AbstractMethodUnitTest
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP8 intersection type declaration when the variable
|
||||
* Verify recognition of PHP8.1 intersection type declaration when the variable
|
||||
* has either a spread operator or a reference.
|
||||
*
|
||||
* @return void
|
||||
@@ -2702,6 +2702,161 @@ final class GetMethodParametersTest extends AbstractMethodUnitTest
|
||||
}//end testPHP81NewInInitializers()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of 8.2 DNF parameter type declarations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypes()
|
||||
{
|
||||
// Offsets are relative to the T_FUNCTION token.
|
||||
$expected = [];
|
||||
$expected[0] = [
|
||||
'token' => 21,
|
||||
'name' => '$obj1',
|
||||
'content' => '#[MyAttribute]
|
||||
false|(Foo&Bar)|true $obj1',
|
||||
'has_attributes' => true,
|
||||
'pass_by_reference' => false,
|
||||
'reference_token' => false,
|
||||
'variable_length' => false,
|
||||
'variadic_token' => false,
|
||||
'type_hint' => 'false|(Foo&Bar)|true',
|
||||
'type_hint_token' => 11,
|
||||
'type_hint_end_token' => 19,
|
||||
'nullable_type' => false,
|
||||
'comma_token' => 22,
|
||||
];
|
||||
$expected[1] = [
|
||||
'token' => 41,
|
||||
'name' => '$obj2',
|
||||
'content' => '(\Boo&\Pck\Bar)|(Boo&Baz) $obj2 = new Boo()',
|
||||
'default' => 'new Boo()',
|
||||
'default_token' => 45,
|
||||
'default_equal_token' => 43,
|
||||
'has_attributes' => false,
|
||||
'pass_by_reference' => false,
|
||||
'reference_token' => false,
|
||||
'variable_length' => false,
|
||||
'variadic_token' => false,
|
||||
'type_hint' => '(\Boo&\Pck\Bar)|(Boo&Baz)',
|
||||
'type_hint_token' => 25,
|
||||
'type_hint_end_token' => 39,
|
||||
'nullable_type' => false,
|
||||
'comma_token' => false,
|
||||
];
|
||||
|
||||
$this->getMethodParametersTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypes()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF parameter type declarations when the variable
|
||||
* has either a spread operator or a reference.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypesWithSpreadOperatorAndReference()
|
||||
{
|
||||
// Offsets are relative to the T_FUNCTION token.
|
||||
$expected = [];
|
||||
$expected[0] = [
|
||||
'token' => 13,
|
||||
'name' => '$paramA',
|
||||
'content' => '(Countable&MeMe)|iterable &$paramA',
|
||||
'has_attributes' => false,
|
||||
'pass_by_reference' => true,
|
||||
'reference_token' => 12,
|
||||
'variable_length' => false,
|
||||
'variadic_token' => false,
|
||||
'type_hint' => '(Countable&MeMe)|iterable',
|
||||
'type_hint_token' => 4,
|
||||
'type_hint_end_token' => 10,
|
||||
'nullable_type' => false,
|
||||
'comma_token' => 14,
|
||||
];
|
||||
$expected[1] = [
|
||||
'token' => 25,
|
||||
'name' => '$paramB',
|
||||
'content' => 'true|(Foo&Bar) ...$paramB',
|
||||
'has_attributes' => false,
|
||||
'pass_by_reference' => false,
|
||||
'reference_token' => false,
|
||||
'variable_length' => true,
|
||||
'variadic_token' => 24,
|
||||
'type_hint' => 'true|(Foo&Bar)',
|
||||
'type_hint_token' => 16,
|
||||
'type_hint_end_token' => 22,
|
||||
'nullable_type' => false,
|
||||
'comma_token' => false,
|
||||
];
|
||||
|
||||
$this->getMethodParametersTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypesWithSpreadOperatorAndReference()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF parameter type declarations using the nullability operator (not allowed).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypesIllegalNullable()
|
||||
{
|
||||
// Offsets are relative to the T_FUNCTION token.
|
||||
$expected = [];
|
||||
$expected[0] = [
|
||||
'token' => 27,
|
||||
'name' => '$var',
|
||||
'content' => '? ( MyClassA & /*comment*/ \Package\MyClassB & \Package\MyClassC ) $var',
|
||||
'has_attributes' => false,
|
||||
'pass_by_reference' => false,
|
||||
'reference_token' => false,
|
||||
'variable_length' => false,
|
||||
'variadic_token' => false,
|
||||
'type_hint' => '?(MyClassA&\Package\MyClassB&\Package\MyClassC)',
|
||||
'type_hint_token' => 5,
|
||||
'type_hint_end_token' => 25,
|
||||
'nullable_type' => true,
|
||||
'comma_token' => false,
|
||||
];
|
||||
|
||||
$this->getMethodParametersTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypesIllegalNullable()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF parameter type declarations in an arrow function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypesInArrow()
|
||||
{
|
||||
// Offsets are relative to the T_FUNCTION token.
|
||||
$expected = [];
|
||||
$expected[0] = [
|
||||
'token' => 12,
|
||||
'name' => '$range',
|
||||
'content' => '(Hi&Ho)|FALSE &...$range',
|
||||
'has_attributes' => false,
|
||||
'pass_by_reference' => true,
|
||||
'reference_token' => 10,
|
||||
'variable_length' => true,
|
||||
'variadic_token' => 11,
|
||||
'type_hint' => '(Hi&Ho)|FALSE',
|
||||
'type_hint_token' => 2,
|
||||
'type_hint_end_token' => 8,
|
||||
'nullable_type' => false,
|
||||
'comma_token' => false,
|
||||
];
|
||||
|
||||
$this->getMethodParametersTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypesInArrow()
|
||||
|
||||
|
||||
/**
|
||||
* Verify handling of a closure.
|
||||
*
|
||||
|
||||
Vendored
+31
@@ -170,6 +170,25 @@ function pseudoTypeTrue(): ?true {}
|
||||
// Intentional fatal error - Type contains both true and false, bool should be used instead, but that's not the concern of the method.
|
||||
function pseudoTypeFalseAndTrue(): true|false {}
|
||||
|
||||
/* testPHP82DNFType */
|
||||
function hasDNFType() : bool|(Foo&Bar)|string {}
|
||||
|
||||
abstract class AbstractClass {
|
||||
/* testPHP82DNFTypeAbstractMethod */
|
||||
abstract protected function abstractMethodDNFType() : float|(Foo&Bar);
|
||||
}
|
||||
|
||||
/* testPHP82DNFTypeIllegalNullable */
|
||||
// Intentional fatal error - nullable operator cannot be combined with DNF.
|
||||
function illegalNullableDNF(): ?(A&\Pck\B)|bool {}
|
||||
|
||||
/* testPHP82DNFTypeClosure */
|
||||
$closure = function() : object|(namespace\Foo&Countable) {};
|
||||
|
||||
/* testPHP82DNFTypeFn */
|
||||
// Intentional fatal error - void type cannot be combined with DNF.
|
||||
$arrow = fn() : null|(Partially\Qualified&Traversable)|void => do_something();
|
||||
|
||||
/* testNotAFunction */
|
||||
return true;
|
||||
|
||||
@@ -190,6 +209,18 @@ $value = $obj->fn(true);
|
||||
/* testFunctionDeclarationNestedInTernaryPHPCS2975 */
|
||||
return (!$a ? [ new class { public function b(): c {} } ] : []);
|
||||
|
||||
/* testClosureWithUseNoReturnType */
|
||||
$closure = function () use($a) /*comment*/ {};
|
||||
|
||||
/* testClosureWithUseNoReturnTypeIllegalUseProp */
|
||||
$closure = function () use ($this->prop){};
|
||||
|
||||
/* testClosureWithUseWithReturnType */
|
||||
$closure = function () use /*comment*/ ($a): Type {};
|
||||
|
||||
/* testClosureWithUseMultiParamWithReturnType */
|
||||
$closure = function () use ($a, &$b, $c, $d, $e, $f, $g): ?array {};
|
||||
|
||||
/* testArrowFunctionLiveCoding */
|
||||
// Intentional parse error. This has to be the last test in the file.
|
||||
$fn = fn
|
||||
|
||||
Vendored
+235
@@ -1187,6 +1187,136 @@ final class GetMethodPropertiesTest extends AbstractMethodUnitTest
|
||||
}//end testPHP82PseudoTypeFalseAndTrue()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF return type declaration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFType()
|
||||
{
|
||||
// Offsets are relative to the T_FUNCTION token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => 'bool|(Foo&Bar)|string',
|
||||
'return_type_token' => 8,
|
||||
'return_type_end_token' => 16,
|
||||
'nullable_return_type' => false,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFType()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF return type declaration on an abstract method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypeAbstractMethod()
|
||||
{
|
||||
// Offsets are relative to the T_FUNCTION token.
|
||||
$expected = [
|
||||
'scope' => 'protected',
|
||||
'scope_specified' => true,
|
||||
'return_type' => 'float|(Foo&Bar)',
|
||||
'return_type_token' => 8,
|
||||
'return_type_end_token' => 14,
|
||||
'nullable_return_type' => false,
|
||||
'is_abstract' => true,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => false,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypeAbstractMethod()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF return type declaration with illegal nullability.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypeIllegalNullable()
|
||||
{
|
||||
// Offsets are relative to the T_FUNCTION token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => '?(A&\Pck\B)|bool',
|
||||
'return_type_token' => 8,
|
||||
'return_type_end_token' => 17,
|
||||
'nullable_return_type' => true,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypeIllegalNullable()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF return type declaration on a closure.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypeClosure()
|
||||
{
|
||||
// Offsets are relative to the T_CLOSURE token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => 'object|(namespace\Foo&Countable)',
|
||||
'return_type_token' => 6,
|
||||
'return_type_end_token' => 14,
|
||||
'nullable_return_type' => false,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypeClosure()
|
||||
|
||||
|
||||
/**
|
||||
* Verify recognition of PHP 8.2 DNF return type declaration on an arrow function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPHP82DNFTypeFn()
|
||||
{
|
||||
// Offsets are relative to the T_FN token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => 'null|(Partially\Qualified&Traversable)|void',
|
||||
'return_type_token' => 6,
|
||||
'return_type_end_token' => 16,
|
||||
'nullable_return_type' => false,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testPHP82DNFTypeFn()
|
||||
|
||||
|
||||
/**
|
||||
* Test for incorrect tokenization of array return type declarations in PHPCS < 2.8.0.
|
||||
*
|
||||
@@ -1297,6 +1427,111 @@ final class GetMethodPropertiesTest extends AbstractMethodUnitTest
|
||||
}//end testFunctionDeclarationNestedInTernaryPHPCS2975()
|
||||
|
||||
|
||||
/**
|
||||
* Test handling of closure declarations with a use variable import without a return type declaration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClosureWithUseNoReturnType()
|
||||
{
|
||||
// Offsets are relative to the T_CLOSURE token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => '',
|
||||
'return_type_token' => false,
|
||||
'return_type_end_token' => false,
|
||||
'nullable_return_type' => false,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testClosureWithUseNoReturnType()
|
||||
|
||||
|
||||
/**
|
||||
* Test handling of closure declarations with an illegal use variable for a property import (not allowed in PHP)
|
||||
* without a return type declaration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClosureWithUseNoReturnTypeIllegalUseProp()
|
||||
{
|
||||
// Offsets are relative to the T_CLOSURE token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => '',
|
||||
'return_type_token' => false,
|
||||
'return_type_end_token' => false,
|
||||
'nullable_return_type' => false,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testClosureWithUseNoReturnTypeIllegalUseProp()
|
||||
|
||||
|
||||
/**
|
||||
* Test handling of closure declarations with a use variable import with a return type declaration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClosureWithUseWithReturnType()
|
||||
{
|
||||
// Offsets are relative to the T_CLOSURE token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => 'Type',
|
||||
'return_type_token' => 14,
|
||||
'return_type_end_token' => 14,
|
||||
'nullable_return_type' => false,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testClosureWithUseWithReturnType()
|
||||
|
||||
|
||||
/**
|
||||
* Test handling of closure declarations with a use variable import with a return type declaration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClosureWithUseMultiParamWithReturnType()
|
||||
{
|
||||
// Offsets are relative to the T_CLOSURE token.
|
||||
$expected = [
|
||||
'scope' => 'public',
|
||||
'scope_specified' => false,
|
||||
'return_type' => '?array',
|
||||
'return_type_token' => 32,
|
||||
'return_type_end_token' => 32,
|
||||
'nullable_return_type' => true,
|
||||
'is_abstract' => false,
|
||||
'is_final' => false,
|
||||
'is_static' => false,
|
||||
'has_body' => true,
|
||||
];
|
||||
|
||||
$this->getMethodPropertiesTestHelper('/* '.__FUNCTION__.' */', $expected);
|
||||
|
||||
}//end testClosureWithUseMultiParamWithReturnType()
|
||||
|
||||
|
||||
/**
|
||||
* Test helper.
|
||||
*
|
||||
|
||||
Vendored
+2
-2
@@ -106,7 +106,7 @@ final class GetTokensAsStringTest extends AbstractMethodUnitTest
|
||||
* @param int $length Token length to get.
|
||||
* @param string $expected The expected function return value.
|
||||
*
|
||||
* @dataProvider dataGetTokensAsString()
|
||||
* @dataProvider dataGetTokensAsString
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -281,7 +281,7 @@ final class GetTokensAsStringTest extends AbstractMethodUnitTest
|
||||
* @param int $length Token length to get.
|
||||
* @param string $expected The expected function return value.
|
||||
*
|
||||
* @dataProvider dataGetOrigContent()
|
||||
* @dataProvider dataGetOrigContent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
+7
-1
@@ -169,7 +169,7 @@ functionCall( $something , &new Foobar() );
|
||||
$closure = function() use (&$var){};
|
||||
|
||||
/* testUseByReferenceWithCommentFirstParam */
|
||||
$closure = function() use /*comment*/ (&$this->value){};
|
||||
$closure = function() use /*comment*/ (&$value){};
|
||||
|
||||
/* testUseByReferenceWithCommentSecondParam */
|
||||
$closure = function() use /*comment*/ ($varA, &$varB){};
|
||||
@@ -201,6 +201,12 @@ $closure = function &($param) use ($value) {};
|
||||
/* testBitwiseAndArrowFunctionInDefault */
|
||||
$fn = fn( $one = E_NOTICE & E_STRICT) => 1;
|
||||
|
||||
/* testIntersectionIsNotReference */
|
||||
function intersect(Foo&Bar $param) {}
|
||||
|
||||
/* testDNFTypeIsNotReference */
|
||||
$fn = fn((Foo&\Bar)|null /* testParamPassByReference */ &$param) => $param;
|
||||
|
||||
/* testTokenizerIssue1284PHPCSlt280A */
|
||||
if ($foo) {}
|
||||
[&$a, /* testTokenizerIssue1284PHPCSlt280B */ &$b] = $c;
|
||||
|
||||
+43
-5
@@ -23,29 +23,63 @@ final class IsReferenceTest extends AbstractMethodUnitTest
|
||||
/**
|
||||
* Test that false is returned when a non-"bitwise and" token is passed.
|
||||
*
|
||||
* @param string $testMarker Comment which precedes the test case.
|
||||
* @param array<int|string> $targetTokens Type of tokens to look for.
|
||||
*
|
||||
* @dataProvider dataNotBitwiseAndToken
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNotBitwiseAndToken()
|
||||
public function testNotBitwiseAndToken($testMarker, $targetTokens)
|
||||
{
|
||||
$target = $this->getTargetToken('/* testBitwiseAndA */', T_STRING);
|
||||
$targetTokens[] = T_BITWISE_AND;
|
||||
|
||||
$target = $this->getTargetToken($testMarker, $targetTokens);
|
||||
$this->assertFalse(self::$phpcsFile->isReference($target));
|
||||
|
||||
}//end testNotBitwiseAndToken()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider.
|
||||
*
|
||||
* @see testNotBitwiseAndToken()
|
||||
*
|
||||
* @return array<string, array<string, string|array<int|string>>>
|
||||
*/
|
||||
public static function dataNotBitwiseAndToken()
|
||||
{
|
||||
return [
|
||||
'Not ampersand token at all' => [
|
||||
'testMarker' => '/* testBitwiseAndA */',
|
||||
'targetTokens' => [T_STRING],
|
||||
],
|
||||
'ampersand in intersection type' => [
|
||||
'testMarker' => '/* testIntersectionIsNotReference */',
|
||||
'targetTokens' => [T_TYPE_INTERSECTION],
|
||||
],
|
||||
'ampersand in DNF type' => [
|
||||
'testMarker' => '/* testDNFTypeIsNotReference */',
|
||||
'targetTokens' => [T_TYPE_INTERSECTION],
|
||||
],
|
||||
];
|
||||
|
||||
}//end dataNotBitwiseAndToken()
|
||||
|
||||
|
||||
/**
|
||||
* Test correctly identifying whether a "bitwise and" token is a reference or not.
|
||||
*
|
||||
* @param string $identifier Comment which precedes the test case.
|
||||
* @param string $testMarker Comment which precedes the test case.
|
||||
* @param bool $expected Expected function output.
|
||||
*
|
||||
* @dataProvider dataIsReference
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIsReference($identifier, $expected)
|
||||
public function testIsReference($testMarker, $expected)
|
||||
{
|
||||
$bitwiseAnd = $this->getTargetToken($identifier, T_BITWISE_AND);
|
||||
$bitwiseAnd = $this->getTargetToken($testMarker, T_BITWISE_AND);
|
||||
$result = self::$phpcsFile->isReference($bitwiseAnd);
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
@@ -338,6 +372,10 @@ final class IsReferenceTest extends AbstractMethodUnitTest
|
||||
'testMarker' => '/* testBitwiseAndArrowFunctionInDefault */',
|
||||
'expected' => false,
|
||||
],
|
||||
'reference: param pass by ref in arrow function' => [
|
||||
'testMarker' => '/* testParamPassByReference */',
|
||||
'expected' => true,
|
||||
],
|
||||
'issue-1284-short-list-directly-after-close-curly-control-structure' => [
|
||||
'testMarker' => '/* testTokenizerIssue1284PHPCSlt280A */',
|
||||
'expected' => true,
|
||||
|
||||
docker/streamline-src/vendor/squizlabs/php_codesniffer/tests/Core/Filters/AbstractFilterTestCase.php
Vendored
+25
-2
@@ -51,6 +51,29 @@ abstract class AbstractFilterTestCase extends TestCase
|
||||
}//end initializeConfigAndRuleset()
|
||||
|
||||
|
||||
/**
|
||||
* Clean up after finished test by resetting all static properties on the Config class to their default values.
|
||||
*
|
||||
* Note: This is a PHPUnit cross-version compatible {@see \PHPUnit\Framework\TestCase::tearDownAfterClass()}
|
||||
* method.
|
||||
*
|
||||
* @afterClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function reset()
|
||||
{
|
||||
// Explicitly trigger __destruct() on the ConfigDouble to reset the Config statics.
|
||||
// The explicit method call prevents potential stray test-local references to the $config object
|
||||
// preventing the destructor from running the clean up (which without stray references would be
|
||||
// automagically triggered when `self::$phpcsFile` is reset, but we can't definitively rely on that).
|
||||
if (isset(self::$config) === true) {
|
||||
self::$config->__destruct();
|
||||
}
|
||||
|
||||
}//end reset()
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to retrieve a mock object for a Filter class.
|
||||
*
|
||||
@@ -184,8 +207,8 @@ abstract class AbstractFilterTestCase extends TestCase
|
||||
$basedir.'/src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php',
|
||||
$basedir.'/src/Standards/Squiz/Tests',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc.fixed',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php',
|
||||
|
||||
Vendored
+3
-3
@@ -175,8 +175,8 @@ final class GitModifiedTest extends AbstractFilterTestCase
|
||||
'.yamllint.yml',
|
||||
'autoload.php',
|
||||
'src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc.fixed',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php',
|
||||
@@ -191,7 +191,7 @@ final class GitModifiedTest extends AbstractFilterTestCase
|
||||
$basedir.'/src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php',
|
||||
$basedir.'/src/Standards/Squiz/Tests',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php',
|
||||
],
|
||||
|
||||
Vendored
+3
-3
@@ -175,8 +175,8 @@ final class GitStagedTest extends AbstractFilterTestCase
|
||||
'.yamllint.yml',
|
||||
'autoload.php',
|
||||
'src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc.fixed',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed',
|
||||
'src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php',
|
||||
@@ -191,7 +191,7 @@ final class GitStagedTest extends AbstractFilterTestCase
|
||||
$basedir.'/src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php',
|
||||
$basedir.'/src/Standards/Squiz/Tests',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.1.inc',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.js',
|
||||
$basedir.'/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php',
|
||||
],
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-BlankLinesAtEnd.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -5,7 +5,3 @@
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-BlankLinesAtStart.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -1,6 +1,3 @@
|
||||
-
|
||||
-
|
||||
-
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-LineAdded.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
+// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-LineRemoved.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -4,5 +4,4 @@
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
- echo 'And this line is not';
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
echo 'And this line is not';
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-NoTrailingWhitespace.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
-// Comment with 2 spaces trailing whitespace.
|
||||
+// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-TabsToSpaces.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -3,5 +3,5 @@
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
- echo 'This line is tab indented';
|
||||
+ echo 'This line is tab indented';
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-VarNameChanged.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
-$rav = FALSE;
|
||||
+$var = FALSE;
|
||||
|
||||
-if ($rav) {
|
||||
+if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$rav = FALSE;
|
||||
|
||||
if ($rav) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-WhiteSpaceAtEnd.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
-}
|
||||
+}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
--- tests/Core/Fixer/Fixtures/GenerateDiffTest-WhiteSpaceAtStart.inc
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -1,4 +1,4 @@
|
||||
- <?php
|
||||
+<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// Comment with 2 spaces trailing whitespace.
|
||||
$var = FALSE;
|
||||
|
||||
if ($var) {
|
||||
echo 'This line is tab indented';
|
||||
}
|
||||
Vendored
+227
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* Tests for diff generation.
|
||||
*
|
||||
* @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl>
|
||||
* @copyright 2024 Juliette Reinders Folmer. All rights reserved.
|
||||
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
||||
*/
|
||||
|
||||
namespace PHP_CodeSniffer\Tests\Core\Fixer;
|
||||
|
||||
use PHP_CodeSniffer\Files\LocalFile;
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use PHP_CodeSniffer\Tests\ConfigDouble;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Tests for diff generation.
|
||||
*
|
||||
* Note: these tests are specifically about the Fixer::generateDiff() method and do not
|
||||
* test running the fixer itself, nor generating a diff based on a fixer run.
|
||||
*
|
||||
* @covers PHP_CodeSniffer\Fixer::generateDiff
|
||||
* @group Windows
|
||||
*/
|
||||
final class GenerateDiffTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* A \PHP_CodeSniffer\Files\File object to compare the files against.
|
||||
*
|
||||
* @var \PHP_CodeSniffer\Files\LocalFile
|
||||
*/
|
||||
private static $phpcsFile;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize an \PHP_CodeSniffer\Files\File object with code.
|
||||
*
|
||||
* Things to take note of in the code snippet used for these tests:
|
||||
* - Line endings are \n.
|
||||
* - Tab indent.
|
||||
* - Trailing whitespace.
|
||||
*
|
||||
* Also note that the Config object is deliberately created without a `tabWidth` setting to
|
||||
* prevent doing tab replacement when parsing the file. This is to allow for testing a
|
||||
* diff with tabs vs spaces (which wouldn't yield a diff if tabs had already been replaced).
|
||||
*
|
||||
* @beforeClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function initializeFile()
|
||||
{
|
||||
$config = new ConfigDouble();
|
||||
$ruleset = new Ruleset($config);
|
||||
|
||||
self::$phpcsFile = new LocalFile(__DIR__.'/Fixtures/GenerateDiffTest.inc', $ruleset, $config);
|
||||
self::$phpcsFile->parse();
|
||||
self::$phpcsFile->fixer->startFile(self::$phpcsFile);
|
||||
|
||||
}//end initializeFile()
|
||||
|
||||
|
||||
/**
|
||||
* Test generating a diff on the file object itself.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGenerateDiffNoFile()
|
||||
{
|
||||
$diff = self::$phpcsFile->fixer->generateDiff(null, false);
|
||||
|
||||
$this->assertSame('', $diff);
|
||||
|
||||
}//end testGenerateDiffNoFile()
|
||||
|
||||
|
||||
/**
|
||||
* Test generating a diff between a PHPCS File object and a file on disk.
|
||||
*
|
||||
* @param string $filePath The path to the file to compare the File object against.
|
||||
*
|
||||
* @dataProvider dataGenerateDiff
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGenerateDiff($filePath)
|
||||
{
|
||||
$diff = self::$phpcsFile->fixer->generateDiff($filePath, false);
|
||||
|
||||
// Allow for the tests to pass on Windows too.
|
||||
$diff = str_replace('--- tests\Core\Fixer/', '--- tests/Core/Fixer/', $diff);
|
||||
|
||||
$expectedDiffFile = str_replace('.inc', '.diff', $filePath);
|
||||
|
||||
$this->assertStringEqualsFile($expectedDiffFile, $diff);
|
||||
|
||||
}//end testGenerateDiff()
|
||||
|
||||
|
||||
/**
|
||||
* Data provider.
|
||||
*
|
||||
* @see testGenerateDiff()
|
||||
*
|
||||
* @return array<string, array<string, string>>
|
||||
*/
|
||||
public static function dataGenerateDiff()
|
||||
{
|
||||
return [
|
||||
'no difference' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-NoDiff.inc',
|
||||
],
|
||||
'line removed' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-LineRemoved.inc',
|
||||
],
|
||||
'line added' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-LineAdded.inc',
|
||||
],
|
||||
'var name changed' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-VarNameChanged.inc',
|
||||
],
|
||||
'trailing whitespace removed' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-NoTrailingWhitespace.inc',
|
||||
],
|
||||
'tab replaced with spaces' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-TabsToSpaces.inc',
|
||||
],
|
||||
'blank lines at start of file' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-BlankLinesAtStart.inc',
|
||||
],
|
||||
'whitespace diff at start of file' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-WhiteSpaceAtStart.inc',
|
||||
],
|
||||
'blank lines at end of file' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-BlankLinesAtEnd.inc',
|
||||
],
|
||||
'whitespace diff at end of file' => [
|
||||
'filePath' => __DIR__.'/Fixtures/GenerateDiffTest-WhiteSpaceAtEnd.inc',
|
||||
],
|
||||
];
|
||||
|
||||
}//end dataGenerateDiff()
|
||||
|
||||
|
||||
/**
|
||||
* Test generating a diff between a PHPCS File object and a file on disk and colourizing the output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGenerateDiffColoured()
|
||||
{
|
||||
$expected = "\033[31m--- tests/Core/Fixer/Fixtures/GenerateDiffTest-VarNameChanged.inc\033[0m".PHP_EOL;
|
||||
$expected .= "\033[32m+++ PHP_CodeSniffer\033[0m".PHP_EOL;
|
||||
$expected .= '@@ -1,7 +1,7 @@'.PHP_EOL;
|
||||
$expected .= ' <?php'.PHP_EOL;
|
||||
$expected .= ' // Comment with 2 spaces trailing whitespace. '.PHP_EOL;
|
||||
$expected .= "\033[31m".'-$rav = FALSE;'."\033[0m".PHP_EOL;
|
||||
$expected .= "\033[32m".'+$var = FALSE;'."\033[0m".PHP_EOL;
|
||||
$expected .= ' '.PHP_EOL;
|
||||
$expected .= "\033[31m".'-if ($rav) {'."\033[0m".PHP_EOL;
|
||||
$expected .= "\033[32m".'+if ($var) {'."\033[0m".PHP_EOL;
|
||||
$expected .= ' echo \'This line is tab indented\';'.PHP_EOL;
|
||||
$expected .= ' }';
|
||||
|
||||
$filePath = __DIR__.'/Fixtures/GenerateDiffTest-VarNameChanged.inc';
|
||||
$diff = self::$phpcsFile->fixer->generateDiff($filePath);
|
||||
|
||||
// Allow for the tests to pass on Windows too.
|
||||
$diff = str_replace('--- tests\Core\Fixer/', '--- tests/Core/Fixer/', $diff);
|
||||
|
||||
$this->assertSame($expected, $diff);
|
||||
|
||||
}//end testGenerateDiffColoured()
|
||||
|
||||
|
||||
/**
|
||||
* Test generating a diff between a PHPCS File object using *nix line endings and a file on disk
|
||||
* using Windows line endings.
|
||||
*
|
||||
* The point of this test is to verify that all lines are marked as having a difference.
|
||||
* The actual lines endings used in the diff shown to the end-user are not relevant for this
|
||||
* test.
|
||||
* As the "diff" command is finicky with what type of line endings are used when the only
|
||||
* difference on a line is the line ending, the test normalizes the line endings of the
|
||||
* received diff before testing it.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGenerateDiffDifferentLineEndings()
|
||||
{
|
||||
// By the looks of it, if the only diff between two files is line endings, the
|
||||
// diff generated by the *nix "diff" command will always contain *nix line endings.
|
||||
$expected = '--- tests/Core/Fixer/Fixtures/GenerateDiffTest-WindowsLineEndings.inc'."\n";
|
||||
$expected .= '+++ PHP_CodeSniffer'."\n";
|
||||
$expected .= '@@ -1,7 +1,7 @@'."\n";
|
||||
$expected .= '-<?php'."\n";
|
||||
$expected .= '-// Comment with 2 spaces trailing whitespace. '."\n";
|
||||
$expected .= '-$var = FALSE;'."\n";
|
||||
$expected .= '-'."\n";
|
||||
$expected .= '-if ($var) {'."\n";
|
||||
$expected .= '- echo \'This line is tab indented\';'."\n";
|
||||
$expected .= '-}'."\n";
|
||||
$expected .= '+<?php'."\n";
|
||||
$expected .= '+// Comment with 2 spaces trailing whitespace. '."\n";
|
||||
$expected .= '+$var = FALSE;'."\n";
|
||||
$expected .= '+'."\n";
|
||||
$expected .= '+if ($var) {'."\n";
|
||||
$expected .= '+ echo \'This line is tab indented\';'."\n";
|
||||
$expected .= '+}'."\n";
|
||||
|
||||
$filePath = __DIR__.'/Fixtures/GenerateDiffTest-WindowsLineEndings.inc';
|
||||
$diff = self::$phpcsFile->fixer->generateDiff($filePath, false);
|
||||
|
||||
// Allow for the tests to pass on Windows too.
|
||||
$diff = str_replace('--- tests\Core\Fixer/', '--- tests/Core/Fixer/', $diff);
|
||||
|
||||
// Normalize line endings of the diff.
|
||||
$diff = preg_replace('`\R`', "\n", $diff);
|
||||
|
||||
$this->assertSame($expected, $diff);
|
||||
|
||||
}//end testGenerateDiffDifferentLineEndings()
|
||||
|
||||
|
||||
}//end class
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="GeneratorTest" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
|
||||
|
||||
<config name="installed_paths" value="./tests/Core/Generators/Fixtures/"/>
|
||||
|
||||
<rule ref="StandardWithDocs">
|
||||
<exclude name="StandardWithDocs.Structure.NoDocumentationElement"/>
|
||||
</rule>
|
||||
|
||||
</ruleset>
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Code-Comparison,-blank-lines" />
|
||||
<h2>Code Comparison, blank lines</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Checking handling of blank lines.</td>
|
||||
<td class="code-comparison-title">Invalid: Checking handling of blank lines.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// First line of the code sample is</br>// deliberately empty.</br></br>// We also have a blank line in the middle.</br></br>// And a blank line at the end.</td>
|
||||
<td class="code-comparison-code">// First line of the code sample is</br>// deliberately empty.</br></br>// We also have a blank line in the middle.</br></br>// And a blank line at the end.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Code Comparison, blank lines
|
||||
|
||||
This is a standard block.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Checking handling of blank lines.</th>
|
||||
<th>Invalid: Checking handling of blank lines.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// First line of the code sample is
|
||||
// deliberately empty.
|
||||
|
||||
// We also have a blank line in the middle.
|
||||
|
||||
// And a blank line at the end.
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// First line of the code sample is
|
||||
// deliberately empty.
|
||||
|
||||
// We also have a blank line in the middle.
|
||||
|
||||
// And a blank line at the end.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
---------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE COMPARISON, BLANK LINES |
|
||||
---------------------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Checking handling of blank lines. | Invalid: Checking handling of blank lines. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // First line of the code sample is | // First line of the code sample is |
|
||||
| // deliberately empty. | // deliberately empty. |
|
||||
| | |
|
||||
| // We also have a blank line in the middle. | // We also have a blank line in the middle. |
|
||||
| | |
|
||||
| // And a blank line at the end. | // And a blank line at the end. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Code-Comparison,-block-length" />
|
||||
<h2>Code Comparison, block length</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: code sample A has more lines than B.</td>
|
||||
<td class="code-comparison-title">Invalid: shorter.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// This code sample has more lines</br>// than the "invalid" one.</br><span class="code-comparison-highlight">$one</span> = 10;</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">$a</span> = 10;</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: shorter.</td>
|
||||
<td class="code-comparison-title">Invalid: code sample B has more lines than A.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">echo</span> $foo;</td>
|
||||
<td class="code-comparison-code">// This code sample has more lines</br>// than the "valid" one.</br><span class="code-comparison-highlight">print</span> $foo;</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Code Comparison, block length
|
||||
|
||||
This is a standard block.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: code sample A has more lines than B.</th>
|
||||
<th>Invalid: shorter.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// This code sample has more lines
|
||||
// than the "invalid" one.
|
||||
$one = 10;
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
$a = 10;
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: shorter.</th>
|
||||
<th>Invalid: code sample B has more lines than A.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
echo $foo;
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// This code sample has more lines
|
||||
// than the "valid" one.
|
||||
print $foo;
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
|
||||
----------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE COMPARISON, BLOCK LENGTH |
|
||||
----------------------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: code sample A has more lines than B. | Invalid: shorter. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // This code sample has more lines | $a = 10; |
|
||||
| // than the "invalid" one. | |
|
||||
| $one = 10; | |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: shorter. | Invalid: code sample B has more lines than A. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| echo $foo; | // This code sample has more lines |
|
||||
| | // than the "valid" one. |
|
||||
| | print $foo; |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Code-Comparison,-char-encoding" />
|
||||
<h2>Code Comparison, char encoding</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Vestibulum et orci condimentum.</td>
|
||||
<td class="code-comparison-title">Invalid: Donec in nisl ut tortor convallis interdum.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><?php</br></br>// The above PHP tag is specifically testing</br>// handling of that in generated HTML doc.</br></br>// Now let's also check the handling of</br>// comparison operators in code samples...</br>$a = $b < $c;</br>$d = $e > $f;</br>$g = $h <= $i;</br>$j = $k >= $l;</br>$m = $n <=> $o;</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight"><?php</span></br></br>// The above PHP tag is specifically testing</br>// handling of that in generated HTML doc.</br></br>// Now let's also check the handling of</br>// comparison operators in code samples</br>// in combination with "em" tags.</br>$a = $b <span class="code-comparison-highlight"><</span> $c;</br>$d = $e > $f;</br>$g = <span class="code-comparison-highlight">$h <= $i</span>;</br>$j = $k >= $l;</br>$m = $n <span class="code-comparison-highlight"><=></span> $o;</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Code Comparison, char encoding
|
||||
|
||||
This is a standard block.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Vestibulum et orci condimentum.</th>
|
||||
<th>Invalid: Donec in nisl ut tortor convallis interdum.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
// The above PHP tag is specifically testing
|
||||
// handling of that in generated HTML doc.
|
||||
|
||||
// Now let's also check the handling of
|
||||
// comparison operators in code samples...
|
||||
$a = $b < $c;
|
||||
$d = $e > $f;
|
||||
$g = $h <= $i;
|
||||
$j = $k >= $l;
|
||||
$m = $n <=> $o;
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
// The above PHP tag is specifically testing
|
||||
// handling of that in generated HTML doc.
|
||||
|
||||
// Now let's also check the handling of
|
||||
// comparison operators in code samples
|
||||
// in combination with "em" tags.
|
||||
$a = $b < $c;
|
||||
$d = $e > $f;
|
||||
$g = $h <= $i;
|
||||
$j = $k >= $l;
|
||||
$m = $n <=> $o;
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
|
||||
-----------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE COMPARISON, CHAR ENCODING |
|
||||
-----------------------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Vestibulum et orci condimentum. | Invalid: Donec in nisl ut tortor convallis |
|
||||
| | interdum. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| <?php | <?php |
|
||||
| | |
|
||||
| // The above PHP tag is specifically testing | // The above PHP tag is specifically testing |
|
||||
| // handling of that in generated HTML doc. | // handling of that in generated HTML doc. |
|
||||
| | |
|
||||
| // Now let's also check the handling of | // Now let's also check the handling of |
|
||||
| // comparison operators in code samples... | // comparison operators in code samples |
|
||||
| $a = $b < $c; | // in combination with "em" tags. |
|
||||
| $d = $e > $f; | $a = $b < $c; |
|
||||
| $g = $h <= $i; | $d = $e > $f; |
|
||||
| $j = $k >= $l; | $g = $h <= $i; |
|
||||
| $m = $n <=> $o; | $j = $k >= $l; |
|
||||
| | $m = $n <=> $o; |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Code-Comparison,-line-length" />
|
||||
<h2>Code Comparison, line length</h2>
|
||||
<p class="text">Ensure there is no PHP "Warning: str_repeat(): Second argument has to be greater than or equal to 0".<br/>
|
||||
Ref: squizlabs/PHP_CodeSniffer#2522</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: contains line which is too long.</td>
|
||||
<td class="code-comparison-title">Invalid: contains line which is too long.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">class Foo extends Bar implements <span class="code-comparison-highlight">Countable</span>, Serializable</br>{</br>}</td>
|
||||
<td class="code-comparison-code">class Foo extends Bar</br>{</br> public static function <span class="code-comparison-highlight">foobar</span>($param1, $param2) {}</br>}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Code Comparison, line length
|
||||
|
||||
Ensure there is no PHP "Warning: str_repeat(): Second argument has to be greater than or equal to 0".
|
||||
Ref: squizlabs/PHP_CodeSniffer#2522
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: contains line which is too long.</th>
|
||||
<th>Invalid: contains line which is too long.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
class Foo extends Bar implements Countable, Serializable
|
||||
{
|
||||
}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
class Foo extends Bar
|
||||
{
|
||||
public static function foobar($param1, $param2) {}
|
||||
}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
---------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE COMPARISON, LINE LENGTH |
|
||||
---------------------------------------------------------------
|
||||
|
||||
Ensure there is no PHP "Warning: str_repeat(): Second argument has to be greater than or equal to
|
||||
0".
|
||||
Ref: squizlabs/PHP_CodeSniffer#2522
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: contains line which is too long. | Invalid: contains line which is too long. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| class Foo extends Bar implements Countable, Serializable| class Foo extends Bar |
|
||||
| { | { |
|
||||
| } | public static function foobar($param1, $param2) {}|
|
||||
| | } |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Code-Title,-line-wrapping" />
|
||||
<h2>Code Title, line wrapping</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: exactly 45 character long description.</td>
|
||||
<td class="code-comparison-title">Invalid: exactly 45 char long description---.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: exactly 46 character long description-.</td>
|
||||
<td class="code-comparison-title">Invalid: exactly 46 character long description</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: exactly 47 character long description--.</td>
|
||||
<td class="code-comparison-title">Invalid: exactly 47 character long description.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: this description is longer than 46 characters and will wrap.</td>
|
||||
<td class="code-comparison-title">Invalid: this description is longer than 46 characters and will wrap.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Code Title, line wrapping
|
||||
|
||||
This is a standard block.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: exactly 45 character long description.</th>
|
||||
<th>Invalid: exactly 45 char long description---.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: exactly 46 character long description-.</th>
|
||||
<th>Invalid: exactly 46 character long description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: exactly 47 character long description--.</th>
|
||||
<th>Invalid: exactly 47 character long description.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: this description is longer than 46 characters and will wrap.</th>
|
||||
<th>Invalid: this description is longer than 46 characters and will wrap.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
|
||||
------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE TITLE, LINE WRAPPING |
|
||||
------------------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: exactly 45 character long description. | Invalid: exactly 45 char long description---. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // Dummy. | // Dummy. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: exactly 46 character long description-. | Invalid: exactly 46 character long description |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // Dummy. | // Dummy. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: exactly 47 character long | Invalid: exactly 47 character long |
|
||||
| description--. | description. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // Dummy. | // Dummy. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: this description is longer than 46 | Invalid: this description is longer than 46 |
|
||||
| characters and will wrap. | characters and will wrap. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // Dummy. | // Dummy. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Code-Title,-whitespace-handling" />
|
||||
<h2>Code Title, whitespace handling</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: spaces at start of description.</td>
|
||||
<td class="code-comparison-title">Invalid: spaces at end making line > 46 chars.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: spaces at start + end of description.</td>
|
||||
<td class="code-comparison-title">Invalid: spaces ' ' in description.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">// Note: description above without the</br>// trailing whitespace fits in 46 chars.</td>
|
||||
<td class="code-comparison-code">// Dummy.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Code Title, whitespace handling
|
||||
|
||||
This is a standard block.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: spaces at start of description.</th>
|
||||
<th>Invalid: spaces at end making line > 46 chars.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: spaces at start + end of description.</th>
|
||||
<th>Invalid: spaces ' ' in description.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
// Note: description above without the
|
||||
// trailing whitespace fits in 46 chars.
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
// Dummy.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE TITLE, WHITESPACE HANDLING |
|
||||
------------------------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: spaces at start of description. | Invalid: spaces at end making line > 46 chars. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // Dummy. | // Dummy. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: spaces at start + end of description. | Invalid: spaces ' ' in description. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| // Note: description above without the | // Dummy. |
|
||||
| // trailing whitespace fits in 46 chars. | |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="lowercase-title" />
|
||||
<h2>lowercase title</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## lowercase title
|
||||
|
||||
This is a standard block.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
--------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: LOWERCASE TITLE |
|
||||
--------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="This-is-a-very-very-very-very-very-very-very-very-very-very-very-long-title" />
|
||||
<h2>This is a very very very very very very very very very very very long title</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## This is a very very very very very very very very very very very long title
|
||||
|
||||
This is a standard block.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
--------------------------------------------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: THIS IS A VERY VERY VERY VERY VERY VERY VERY VERY VERY VERY VERY LONG TITLE |
|
||||
--------------------------------------------------------------------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="One-Standard-Block,-No-Code" />
|
||||
<h2>One Standard Block, No Code</h2>
|
||||
<p class="text">Documentation contains one standard block and no code comparison.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## One Standard Block, No Code
|
||||
|
||||
Documentation contains one standard block and no code comparison.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
--------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: ONE STANDARD BLOCK, NO CODE |
|
||||
--------------------------------------------------------------
|
||||
|
||||
Documentation contains one standard block and no code comparison.
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Standard-Element,-blank-line-handling" />
|
||||
<h2>Standard Element, blank line handling</h2>
|
||||
<p class="text">There is a blank line at the start of this standard.</p>
|
||||
<p class="text">And the above blank line is also deliberate to test part of the logic.</p>
|
||||
<p class="text">Let's also end on a blank line to test that too.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Standard Element, blank line handling
|
||||
|
||||
There is a blank line at the start of this standard.
|
||||
|
||||
And the above blank line is also deliberate to test part of the logic.
|
||||
|
||||
Let's also end on a blank line to test that too.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
|
||||
------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: STANDARD ELEMENT, BLANK LINE HANDLING |
|
||||
------------------------------------------------------------------------
|
||||
|
||||
There is a blank line at the start of this standard.
|
||||
|
||||
And the above blank line is also deliberate to test part of the logic.
|
||||
|
||||
Let's also end on a blank line to test that too.
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Standard-Element,-handling-of-HTML-tags" />
|
||||
<h2>Standard Element, handling of HTML tags</h2>
|
||||
<p class="text">The use of <em>tags</em> in standard descriptions is allowed and their handling should be <em>safeguarded</em>.<br/>
|
||||
Other tags, like <a href="example.com">link</a>, <b>bold</bold>, <script></script> are not allowed and will be encoded for display when the HTML or Markdown report is used.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Standard Element, handling of HTML tags
|
||||
|
||||
The use of *tags* in standard descriptions is allowed and their handling should be *safeguarded*.
|
||||
Other tags, like <a href="example.com">link</a>, <b>bold</bold>, <script></script> are not allowed and will be encoded for display when the HTML or Markdown report is used.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: STANDARD ELEMENT, HANDLING OF HTML TAGS |
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
The use of *tags* in standard descriptions is allowed and their handling should be *safeguarded*.
|
||||
Other tags, like <a href="example.com">link</a>, <b>bold</bold>, <script></script> are not allowed
|
||||
and will be encoded for display when the HTML or Markdown report is used.
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Standard-Element,-indentation-should-be-ignored" />
|
||||
<h2>Standard Element, indentation should be ignored</h2>
|
||||
<p class="text">This line has no indentation.<br/>
|
||||
This line has 4 spaces indentation.<br/>
|
||||
This line has 8 spaces indentation.<br/>
|
||||
This line has 4 spaces indentation.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Standard Element, indentation should be ignored
|
||||
|
||||
This line has no indentation.
|
||||
This line has 4 spaces indentation.
|
||||
This line has 8 spaces indentation.
|
||||
This line has 4 spaces indentation.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: STANDARD ELEMENT, INDENTATION SHOULD BE IGNORED |
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
This line has no indentation.
|
||||
This line has 4 spaces indentation.
|
||||
This line has 8 spaces indentation.
|
||||
This line has 4 spaces indentation.
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Standard-Element,-line-wrapping-handling" />
|
||||
<h2>Standard Element, line wrapping handling</h2>
|
||||
<p class="text">This line has to be exactly 99 chars to test part of the logic.------------------------------------<br/>
|
||||
And this line has to be exactly 100 chars.----------------------------------------------------------<br/>
|
||||
And here we have a line which should start wrapping as it is longer than 100 chars. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pellentesque iaculis enim quis hendrerit. Morbi ultrices in odio pharetra commodo.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Standard Element, line wrapping handling
|
||||
|
||||
This line has to be exactly 99 chars to test part of the logic.------------------------------------
|
||||
And this line has to be exactly 100 chars.----------------------------------------------------------
|
||||
And here we have a line which should start wrapping as it is longer than 100 chars. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pellentesque iaculis enim quis hendrerit. Morbi ultrices in odio pharetra commodo.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: STANDARD ELEMENT, LINE WRAPPING HANDLING |
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
This line has to be exactly 99 chars to test part of the logic.------------------------------------
|
||||
And this line has to be exactly 100 chars.----------------------------------------------------------
|
||||
And here we have a line which should start wrapping as it is longer than 100 chars. Lorem ipsum
|
||||
dolor sit amet, consectetur adipiscing elit. Aenean pellentesque iaculis enim quis hendrerit. Morbi
|
||||
ultrices in odio pharetra commodo.
|
||||
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<h2>Table of Contents</h2>
|
||||
<ul class="toc">
|
||||
<li><a href="#No-Content">No Content</a></li>
|
||||
<li><a href="#Code-Comparison-Only,-Missing-Standard-Block">Code Comparison Only, Missing Standard Block</a></li>
|
||||
<li><a href="#One-Standard-Block,-Code-Comparison">One Standard Block, Code Comparison</a></li>
|
||||
<li><a href="#One-Standard-Block,-No-Code">One Standard Block, No Code</a></li>
|
||||
<li><a href="#One-Standard-Block,-Two-Code-Comparisons">One Standard Block, Two Code Comparisons</a></li>
|
||||
<li><a href="#Two-Standard-Blocks,-No-Code">Two Standard Blocks, No Code</a></li>
|
||||
<li><a href="#Two-Standard-Blocks,-One-Code-Comparison">Two Standard Blocks, One Code Comparison</a></li>
|
||||
<li><a href="#Two-Standard-Blocks,-Three-Code-Comparisons">Two Standard Blocks, Three Code Comparisons</a></li>
|
||||
</ul>
|
||||
<a name="No-Content" />
|
||||
<h2>No Content</h2>
|
||||
<a name="Code-Comparison-Only,-Missing-Standard-Block" />
|
||||
<h2>Code Comparison Only, Missing Standard Block</h2>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Lorem ipsum dolor sit amet.</td>
|
||||
<td class="code-comparison-title">Invalid: Maecenas non rutrum dolor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Code</span> {}</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Comparison</span> {}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a name="One-Standard-Block,-Code-Comparison" />
|
||||
<h2>One Standard Block, Code Comparison</h2>
|
||||
<p class="text">Documentation contains one standard block and one code comparison.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Lorem ipsum dolor sit amet.</td>
|
||||
<td class="code-comparison-title">Invalid: Maecenas non rutrum dolor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Code</span> {}</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Comparison</span> {}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a name="One-Standard-Block,-No-Code" />
|
||||
<h2>One Standard Block, No Code</h2>
|
||||
<p class="text">Documentation contains one standard block and no code comparison.</p>
|
||||
<a name="One-Standard-Block,-Two-Code-Comparisons" />
|
||||
<h2>One Standard Block, Two Code Comparisons</h2>
|
||||
<p class="text">Documentation contains one standard block and two code comparisons.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Etiam commodo magna at vestibulum blandit.</td>
|
||||
<td class="code-comparison-title">Invalid: Vivamus lacinia ante velit.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Code</span> {}</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Comparison</span> {}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Pellentesque nisi neque.</td>
|
||||
<td class="code-comparison-title">Invalid: Mauris dictum metus quis maximus pharetra.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">$one</span> = 10;</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">$a</span> = 10;</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a name="Two-Standard-Blocks,-No-Code" />
|
||||
<h2>Two Standard Blocks, No Code</h2>
|
||||
<p class="text">This is standard block one.</p>
|
||||
<p class="text">This is standard block two.</p>
|
||||
<a name="Two-Standard-Blocks,-One-Code-Comparison" />
|
||||
<h2>Two Standard Blocks, One Code Comparison</h2>
|
||||
<p class="text">This is standard block one.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Vestibulum et orci condimentum.</td>
|
||||
<td class="code-comparison-title">Invalid: Donec in nisl ut tortor convallis interdum.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">class <span class="code-comparison-highlight">Code</span> {}</td>
|
||||
<td class="code-comparison-code">class <span class="code-comparison-highlight">Comparison</span> {}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="text">This is standard block two.</p>
|
||||
<a name="Two-Standard-Blocks,-Three-Code-Comparisons" />
|
||||
<h2>Two Standard Blocks, Three Code Comparisons</h2>
|
||||
<p class="text">This is standard block one.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Vestibulum et orci condimentum.</td>
|
||||
<td class="code-comparison-title">Invalid: Donec in nisl ut tortor convallis interdum.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Code</span> {}</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">class Comparison</span> {}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="text">This is standard block two.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Pellentesque nisi neque.</td>
|
||||
<td class="code-comparison-title">Invalid: Mauris dictum metus quis maximus pharetra.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">$one</span> = 10;</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">$a</span> = 10;</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Quisque sagittis nisi vitae.</td>
|
||||
<td class="code-comparison-title">Invalid: Morbi ac libero vitae lorem.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">echo</span> $foo;</td>
|
||||
<td class="code-comparison-code"><span class="code-comparison-highlight">print</span> $foo;</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## No Content
|
||||
|
||||
|
||||
## Code Comparison Only, Missing Standard Block
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Lorem ipsum dolor sit amet.</th>
|
||||
<th>Invalid: Maecenas non rutrum dolor.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
class Code {}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
class Comparison {}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## One Standard Block, Code Comparison
|
||||
|
||||
Documentation contains one standard block and one code comparison.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Lorem ipsum dolor sit amet.</th>
|
||||
<th>Invalid: Maecenas non rutrum dolor.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
class Code {}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
class Comparison {}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## One Standard Block, No Code
|
||||
|
||||
Documentation contains one standard block and no code comparison.
|
||||
|
||||
## One Standard Block, Two Code Comparisons
|
||||
|
||||
Documentation contains one standard block and two code comparisons.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Etiam commodo magna at vestibulum blandit.</th>
|
||||
<th>Invalid: Vivamus lacinia ante velit.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
class Code {}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
class Comparison {}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Pellentesque nisi neque.</th>
|
||||
<th>Invalid: Mauris dictum metus quis maximus pharetra.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
$one = 10;
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
$a = 10;
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Two Standard Blocks, No Code
|
||||
|
||||
This is standard block one.
|
||||
This is standard block two.
|
||||
|
||||
## Two Standard Blocks, One Code Comparison
|
||||
|
||||
This is standard block one.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Vestibulum et orci condimentum.</th>
|
||||
<th>Invalid: Donec in nisl ut tortor convallis interdum.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
class Code {}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
class Comparison {}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
This is standard block two.
|
||||
|
||||
## Two Standard Blocks, Three Code Comparisons
|
||||
|
||||
This is standard block one.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Vestibulum et orci condimentum.</th>
|
||||
<th>Invalid: Donec in nisl ut tortor convallis interdum.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
class Code {}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
class Comparison {}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
This is standard block two.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Pellentesque nisi neque.</th>
|
||||
<th>Invalid: Mauris dictum metus quis maximus pharetra.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
$one = 10;
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
$a = 10;
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Quisque sagittis nisi vitae.</th>
|
||||
<th>Invalid: Morbi ac libero vitae lorem.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
echo $foo;
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
print $foo;
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
|
||||
---------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: NO CONTENT |
|
||||
---------------------------------------------
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE COMPARISON ONLY, MISSING STANDARD BLOCK |
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Lorem ipsum dolor sit amet. | Invalid: Maecenas non rutrum dolor. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| class Code {} | class Comparison {} |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: ONE STANDARD BLOCK, CODE COMPARISON |
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Documentation contains one standard block and one code comparison.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Lorem ipsum dolor sit amet. | Invalid: Maecenas non rutrum dolor. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| class Code {} | class Comparison {} |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
--------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: ONE STANDARD BLOCK, NO CODE |
|
||||
--------------------------------------------------------------
|
||||
|
||||
Documentation contains one standard block and no code comparison.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: ONE STANDARD BLOCK, TWO CODE COMPARISONS |
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Documentation contains one standard block and two code comparisons.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Etiam commodo magna at vestibulum | Invalid: Vivamus lacinia ante velit. |
|
||||
| blandit. | |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| class Code {} | class Comparison {} |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Pellentesque nisi neque. | Invalid: Mauris dictum metus quis maximus |
|
||||
| | pharetra. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| $one = 10; | $a = 10; |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
---------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: TWO STANDARD BLOCKS, NO CODE |
|
||||
---------------------------------------------------------------
|
||||
|
||||
This is standard block one.
|
||||
|
||||
This is standard block two.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: TWO STANDARD BLOCKS, ONE CODE COMPARISON |
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
This is standard block one.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Vestibulum et orci condimentum. | Invalid: Donec in nisl ut tortor convallis |
|
||||
| | interdum. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| class Code {} | class Comparison {} |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
This is standard block two.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: TWO STANDARD BLOCKS, THREE CODE COMPARISONS |
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
This is standard block one.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Vestibulum et orci condimentum. | Invalid: Donec in nisl ut tortor convallis |
|
||||
| | interdum. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| class Code {} | class Comparison {} |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
This is standard block two.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Pellentesque nisi neque. | Invalid: Mauris dictum metus quis maximus |
|
||||
| | pharetra. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| $one = 10; | $a = 10; |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Quisque sagittis nisi vitae. | Invalid: Morbi ac libero vitae lorem. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| echo $foo; | print $foo; |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Code-element-at-wrong-level" />
|
||||
<h2>Code element at wrong level</h2>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Code element at wrong level
|
||||
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
|
||||
--------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: CODE ELEMENT AT WRONG LEVEL |
|
||||
--------------------------------------------------------------
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="One-element-correct,-one-element-wrong-level" />
|
||||
<h2>One element correct, one element wrong level</h2>
|
||||
<p class="text">This is a standard block at the correct level.</p>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## One element correct, one element wrong level
|
||||
|
||||
This is a standard block at the correct level.
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: ONE ELEMENT CORRECT, ONE ELEMENT WRONG LEVEL |
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This is a standard block at the correct level.
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Superfluous-code-element" />
|
||||
<h2>Superfluous code element</h2>
|
||||
<p class="text">This is a standard block.</p>
|
||||
<table class="code-comparison">
|
||||
<tr>
|
||||
<td class="code-comparison-title">Valid: Checking handling of blank lines.</td>
|
||||
<td class="code-comparison-title">Invalid: Checking handling of blank lines.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="code-comparison-code">$valid = true;</td>
|
||||
<td class="code-comparison-code">$invalid = true;</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Superfluous code element
|
||||
|
||||
This is a standard block.
|
||||
<table>
|
||||
<tr>
|
||||
<th>Valid: Checking handling of blank lines.</th>
|
||||
<th>Invalid: Checking handling of blank lines.</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
$valid = true;
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
$invalid = true;
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
-----------------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: SUPERFLUOUS CODE ELEMENT |
|
||||
-----------------------------------------------------------
|
||||
|
||||
This is a standard block.
|
||||
|
||||
----------------------------------------- CODE COMPARISON ------------------------------------------
|
||||
| Valid: Checking handling of blank lines. | Invalid: Checking handling of blank lines. |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
| $valid = true; | $invalid = true; |
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GeneratorTest Coding Standards</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #666666;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
background-color: #E6E7E8;
|
||||
padding: 20px;
|
||||
border: 1px solid #BBBBBB;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #00A5E3;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.code-comparison {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-comparison td {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.code-comparison-title, .code-comparison-code {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
width: 50%;
|
||||
background-color: #F1F1F1;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.code-comparison-code {
|
||||
font-family: Courier;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.code-comparison-highlight {
|
||||
background-color: #DDF1F7;
|
||||
border: 1px solid #00A5E3;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.tag-line {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tag-line a {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>GeneratorTest Coding Standards</h1>
|
||||
<a name="Unknown-element" />
|
||||
<h2>Unknown element</h2>
|
||||
<div class="tag-line">Documentation generated on #REDACTED# by <a href="https://github.com/PHPCSStandards/PHP_CodeSniffer">PHP_CodeSniffer #VERSION#</a></div>
|
||||
</body>
|
||||
</html>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
# GeneratorTest Coding Standard
|
||||
|
||||
## Unknown element
|
||||
|
||||
|
||||
Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
|
||||
--------------------------------------------------
|
||||
| GENERATORTEST CODING STANDARD: UNKNOWN ELEMENT |
|
||||
--------------------------------------------------
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user