-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from andrewnicols/constantsDocumentedCheck
Add sniff to detect missing docs for constants
- Loading branch information
Showing
4 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/imported_constants.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace MoodleHQ\MoodleCS\moodle\Tests\Sniffs\PHPUnit; | ||
|
||
use these\dont\actually\need\to\point\to\anything; | ||
use function ns\fun_1; | ||
use function ns\fun_2 as alias; | ||
use const ns\CONST_1; | ||
use const ns\CONST_2 as ALIAS; | ||
|
||
use { | ||
function ns\fun_3, | ||
const ns\const_3 | ||
}; | ||
|
||
const UNDOCUMENTED_CONST = 1; | ||
|
||
/** @var bool A documented bool */ | ||
const DOCUMENTED_BOOL = true; | ||
|
||
/** | ||
* Another documented constant which does things. | ||
* | ||
* @var int | ||
*/ | ||
const DOCUMENTED_INT = 1; | ||
|
||
/** | ||
* Example class. | ||
*/ | ||
class example_class { | ||
const UNDOCUMENTED_CONST = 1; | ||
|
||
/** @var bool A documented bool */ | ||
const DOCUMENTED_BOOL = true; | ||
|
||
/** | ||
* Another documented constant which does things. | ||
* | ||
* @var int | ||
*/ | ||
const DOCUMENTED_INT = 1; | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/typed_constants.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace MoodleHQ\MoodleCS\moodle\Tests\Sniffs\PHPUnit; | ||
|
||
use these\dont\actually\need\to\point\to\anything; | ||
use function ns\fun_1; | ||
use function ns\fun_2 as alias; | ||
use const ns\CONST_1; | ||
use const ns\CONST_2 as ALIAS; | ||
|
||
use { | ||
function ns\fun_3, | ||
const ns\const_3 | ||
}; | ||
|
||
const UNDOCUMENTED_CONST = 1; | ||
|
||
/** @var bool A documented bool */ | ||
const DOCUMENTED_BOOL = true; | ||
|
||
/** | ||
* Another documented constant which does things. | ||
* | ||
* @var int | ||
*/ | ||
const DOCUMENTED_INT = 1; | ||
|
||
/** | ||
* Example class. | ||
*/ | ||
class example_class { | ||
const int UNDOCUMENTED_CONST = 1; | ||
|
||
/** @var bool A documented bool */ | ||
const bool DOCUMENTED_BOOL = true; | ||
|
||
/** | ||
* Another documented constant which does things. | ||
* | ||
* @var int | ||
*/ | ||
const int DOCUMENTED_INT = 1; | ||
|
||
} |