Skip to content

Commit

Permalink
Merge pull request #154 from PHPCSStandards/feature/various-docs-fixes
Browse files Browse the repository at this point in the history
Docs: various fixes & improve type specificity
  • Loading branch information
jrfnl authored Sep 9, 2024
2 parents 77a01e7 + 684db66 commit fc4f321
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
9 changes: 5 additions & 4 deletions PHPCSDebug/Sniffs/Debug/TokenListSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TokenListSniff implements Sniff
/**
* A list of tokenizers this sniff supports.
*
* @var array
* @var array<string>
*/
public $supportedTokenizers = [
'PHP',
Expand All @@ -41,7 +41,7 @@ class TokenListSniff implements Sniff
*
* This prevents issues with "undefined index" notices in case of rare tokenizer issues.
*
* @var array
* @var array<string, int|string|array<int, int|string>>
*/
private $tokenDefaults = [
'type' => '?',
Expand All @@ -57,7 +57,7 @@ class TokenListSniff implements Sniff
/**
* Returns an array of tokens this test wants to listen for.
*
* @return array
* @return array<int|string>
*/
public function register()
{
Expand All @@ -74,7 +74,8 @@ public function register()
* @param int $stackPtr The position of the current
* token in the stack.
*
* @return void
* @return int|void Integer stack pointer to skip forward or void to continue
* normal file processing.
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
2 changes: 1 addition & 1 deletion PHPCSDebug/Tests/Debug/TokenListCssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class TokenListCssTest extends UtilityMethodTestCase
/**
* Set the name of a sniff to pass to PHPCS to limit the run (and force it to record errors).
*
* @var array
* @var array<string>
*/
protected static $selectedSniff = ['PHPCSDebug.Debug.TokenList'];

Expand Down
2 changes: 1 addition & 1 deletion PHPCSDebug/Tests/Debug/TokenListJsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class TokenListJsTest extends UtilityMethodTestCase
/**
* Set the name of a sniff to pass to PHPCS to limit the run (and force it to record errors).
*
* @var array
* @var array<string>
*/
protected static $selectedSniff = ['PHPCSDebug.Debug.TokenList'];

Expand Down
2 changes: 1 addition & 1 deletion PHPCSDebug/Tests/Debug/TokenListUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class TokenListUnitTest extends UtilityMethodTestCase
/**
* Set the name of a sniff to pass to PHPCS to limit the run (and force it to record errors).
*
* @var array
* @var array<string>
*/
protected static $selectedSniff = ['PHPCSDebug.Debug.TokenList'];

Expand Down
20 changes: 10 additions & 10 deletions Scripts/CheckSniffCompleteness.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CheckSniffCompleteness
* To disable showing progress, pass `--no-progress` on the command line
* when calling the script.
*
* @var boolean
* @var bool
*/
protected $showProgress = true;

Expand All @@ -43,7 +43,7 @@ class CheckSniffCompleteness
* To enable "quiet" mode, pass `-q` on the command line when calling
* the script.
*
* @var boolean
* @var bool
*/
protected $quietMode = false;

Expand All @@ -52,7 +52,7 @@ class CheckSniffCompleteness
*
* This will be automatically detected if not set from the command-line.
*
* @var boolean
* @var bool
*/
protected $showColored;

Expand All @@ -66,7 +66,7 @@ class CheckSniffCompleteness
/**
* The target directories to examine.
*
* @var array
* @var array<string>
*/
protected $targetDirs = [];

Expand All @@ -80,7 +80,7 @@ class CheckSniffCompleteness
/**
* Directories to exclude from the scan.
*
* @var array
* @var array<string>
*/
protected $excludedDirs = [
'vendor',
Expand All @@ -89,14 +89,14 @@ class CheckSniffCompleteness
/**
* List of all files in the repo.
*
* @var array
* @var array<string, int> Key is a file name, value irrelevant.
*/
protected $allFiles = [];

/**
* List of all sniff files in the repo.
*
* @var array
* @var array<string>
*/
protected $allSniffs = [];

Expand All @@ -105,7 +105,7 @@ class CheckSniffCompleteness
*
* Keys are the strings to search for, values the replacement values.
*
* @var array
* @var array<string, string>
*/
private $sniffToDoc = [
'/Sniffs/' => '/Docs/',
Expand All @@ -117,7 +117,7 @@ class CheckSniffCompleteness
*
* Keys are the strings to search for, values the replacement values.
*
* @var array
* @var array<string, string>
*/
private $sniffToUnitTest = [
'/Sniffs/' => '/Tests/',
Expand All @@ -127,7 +127,7 @@ class CheckSniffCompleteness
/**
* Possible test case file extensions.
*
* @var array
* @var array<string>
*/
private $testCaseExtensions = [
'.inc',
Expand Down
8 changes: 4 additions & 4 deletions Scripts/FileList.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class FileList
protected $rootPath;

/**
* Recursive directory iterator.
* Regex iterator.
*
* @var \DirectoryIterator
* @var \RegexIterator
*/
protected $fileIterator;

Expand Down Expand Up @@ -85,7 +85,7 @@ public function __construct($directory, $rootPath = '', $filter = '')
/**
* Retrieve the filtered file list iterator.
*
* @return array
* @return \RegexIterator
*/
public function getIterator()
{
Expand All @@ -95,7 +95,7 @@ public function getIterator()
/**
* Retrieve the filtered file list as an array.
*
* @return array
* @return array<string>
*/
public function getList()
{
Expand Down
4 changes: 2 additions & 2 deletions Tests/DocsXsd/DocsXsdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testXsdValidationPassedWithValidXml($fixtureFile)
/**
* Data provider for valid test cases.
*
* @return array
* @return array<string, array<string, string>>
*/
public function dataValidXsd()
{
Expand Down Expand Up @@ -108,7 +108,7 @@ public function testXsdValidationFailsForInvalidXml($fixtureFile, $expectedStdOu
/**
* Data provider for invalid test cases.
*
* @return array
* @return array<string, array<string, string>>
*/
public function dataInvalidXsd()
{
Expand Down
8 changes: 4 additions & 4 deletions Tests/IOTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ abstract class IOTestCase extends XTestCase
* Note: if the command itself already contains a "working directory" argument,
* this parameter will normally not need to be passed.
*
* @return array Format:
* 'exitcode' int The exit code from the command.
* 'stdout' string The output send to stdout.
* 'stderr' string The output send to stderr.
* @return array<string, int|string> Format:
* 'exitcode' int The exit code from the command.
* 'stdout' string The output send to stdout.
* 'stderr' string The output send to stderr.
*
* @throws \RuntimeException When the passed arguments do not comply.
* @throws \RuntimeException When no resource could be obtained to execute the command.
Expand Down

0 comments on commit fc4f321

Please sign in to comment.