Skip to content

[WIP] PHPCS 3.5.0: refactor utility methods and add additional utility methods #2456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
737ab94
New `Tests\Core\AbstractMethodUnitTest` class
jrfnl Dec 4, 2018
e4e2426
Implement use of the new AbstractMethodUnitTest class
jrfnl Dec 4, 2018
ef4eb8b
Tests\Core\AbstractMethodUnitTest: add new getTargetToken() method
jrfnl Dec 4, 2018
3782f2a
Implement use of the new AbstractMethodUnitTest::getTargetToken() method
jrfnl Dec 4, 2018
344e8a1
GetMethodParametersTest: remove even more duplicate code
jrfnl Dec 4, 2018
3531007
GetMethodPropertiesTest: remove even more duplicate code
jrfnl Dec 4, 2018
9ba64b6
Tests\Core\AllTests: simplify creation of the test suite
jrfnl Feb 28, 2019
5528e4a
Use Exceptions consistently
jrfnl Jan 7, 2019
b5663f2
Refactor: add new Util\Sniffs\Conditions class
jrfnl Feb 28, 2019
539ed0b
Refactor/Conditions: add unit tests for existing methods
jrfnl Feb 28, 2019
28a6a03
Refactor/Conditions: change over uses of the getCondition() method
jrfnl Feb 28, 2019
4c7b77c
Refactor/Conditions: change over uses of the hasCondition() method
jrfnl Feb 28, 2019
d4e6989
Refactor/Conditions: refactor Conditions::getCondition() method to be…
jrfnl Feb 28, 2019
4f1c938
Refactor/Conditions: add getFirstCondition() and getLastCondition() m…
jrfnl Feb 28, 2019
99588e1
Refactor/Conditions: implement use of new getLastCondition() method
jrfnl Feb 28, 2019
06828bb
Generic.CodeAnalysis.UnusedFunctionParameter: improve accuracy / bug fix
jrfnl Feb 28, 2019
c885427
Refactor/Conditions: add four additional utility methods to Util\Snif…
jrfnl Feb 28, 2019
e200182
Refactor/Conditions: implement use of the new utility methods in File…
jrfnl Feb 28, 2019
f25be78
Refactor/Conditions: implement use of the new utility methods in the …
jrfnl Mar 3, 2019
917b994
Squiz/MemberVarScope: account for faulty unit tests
jrfnl Mar 3, 2019
3a80d8c
Squiz/MemberVarSpacing: fix faulty unit tests
jrfnl Mar 3, 2019
f910f30
Zend/ValidVariableName: fix faulty unit test
jrfnl Mar 3, 2019
a037c33
Refactor/Conditions: further implement use of the Util\Sniffs\Conditi…
jrfnl Mar 3, 2019
279b256
Refactor: add new Util\Sniffs\Parentheses class
jrfnl Mar 17, 2019
48dd61e
Refactor/Parentheses: implement use of the new utility methods in Uti…
jrfnl Mar 17, 2019
7d48332
Refactor/Parentheses: implement use of the new utility methods in Fil…
jrfnl Mar 18, 2019
fe95698
Refactor/Parentheses: implement getOwner() in the AbstractArraySniff …
jrfnl Mar 17, 2019
0d33de0
Refactor/Parentheses: implement isOwnerIn() in Squiz/NonExecutableCode
jrfnl Mar 17, 2019
c455d05
Refactor/Parentheses: implement hasOwner() in Generic/DisallowMultipl…
jrfnl Mar 17, 2019
0c8c113
Refactor/Parentheses: implement hasOwner() in Generic/MultipleStateme…
jrfnl Mar 17, 2019
f8bf701
Refactor/Parentheses: implement hasOwner() in PEAR/IncludingFile
jrfnl Mar 17, 2019
a79dec3
Refactor/Parentheses: implement hasOwner() in Squiz/PostStatementComment
jrfnl Mar 17, 2019
50ba8ed
Refactor/Parentheses: implement hasOwner() in Squiz/DisallowBooleanSt…
jrfnl Mar 17, 2019
ce68f6a
Refactor/Parentheses: implement lastOwnerIn() in Generic/EmptyPHPStat…
jrfnl Mar 17, 2019
99f1d24
Refactor/Parentheses: implement lastOwnerIn() in Squiz/OperatorBracket
jrfnl Mar 17, 2019
08e288c
Refactor/Parentheses: implement lastOwnerIn() in Squiz/DisallowCompar…
jrfnl Mar 17, 2019
9885e9d
Squiz/DisallowComparisonAssignment: various bug fixes
jrfnl Mar 17, 2019
f4d52cd
Refactor/Parentheses: implement lastOwnerIn() in Squiz/OperatorSpacing
jrfnl Mar 17, 2019
6206697
Refactor/Parentheses: implement getLastOpener() in Generic/ScopeIndent
jrfnl Mar 18, 2019
ffdce7f
Refactor/Parentheses: implement getLastCloser() in Generic/CallTimePa…
jrfnl Mar 17, 2019
853a674
Refactor/Parentheses: implement getLastCloser() in Generic/FunctionCa…
jrfnl Mar 17, 2019
33f2370
Refactor/Parentheses: implement getLastCloser() in Squiz/ArrayDeclara…
jrfnl Mar 18, 2019
e08c842
Refactor/Parentheses: implement getLastCloser() in Squiz/InlineIfDecl…
jrfnl Mar 17, 2019
703ded4
Refactor/Parentheses: implement getLastOwner() in Squiz/SemicolonSpacing
jrfnl Mar 17, 2019
86ad1e7
Refactor/Parentheses: implement new utility functions in MySource/Cre…
jrfnl Mar 17, 2019
845fa85
Refactor/Parentheses: implement new utility functions in Squiz/Disall…
jrfnl Mar 17, 2019
5ab3a72
Refactor: add new Util\Sniffs\ObjectDeclarations class
jrfnl Mar 3, 2019
3f0cd62
Refactor/ObjectDeclarations: add unit tests for the getClassPropertie…
jrfnl Mar 3, 2019
2d013ca
Refactor/ObjectDeclarations: fix bug in getClassProperties() method
jrfnl Mar 3, 2019
386e53c
Refactor/ObjectDeclarations: change over uses of the moved methods
jrfnl Mar 3, 2019
707d14a
Refactor/ObjectDeclarations: refactor findExtendedClassName/findExten…
jrfnl Mar 3, 2019
0e13554
Refactor/ObjectDeclarations: add findExtendedInterfaceNames() method
jrfnl Mar 3, 2019
f6f9ab9
Refactor: add new Util\Sniffs\FunctionDeclarations class
jrfnl Mar 3, 2019
3695e26
Refactor/FunctionDeclarations: add unit tests for the exceptions thrown
jrfnl Mar 3, 2019
7f5a151
Refactor/FunctionDeclarations/GetParameters: add additional unit tests
jrfnl Mar 3, 2019
3c8725f
Refactor/FunctionDeclarations: change over uses of the moved getParam…
jrfnl Mar 3, 2019
7229cf0
Refactor/FunctionDeclarations: change over uses of the moved getPrope…
jrfnl Mar 3, 2019
637c077
Refactor/FunctionDeclarations: move $magicMethods, $methodsDoubleUnde…
jrfnl Mar 3, 2019
6e25d88
Refactor/FunctionDeclarations: add eight new reserved name related ut…
jrfnl Mar 3, 2019
66cea8b
Refactor/FunctionDeclarations: implement in Generic.NamingConventions…
jrfnl Mar 3, 2019
6fb6c7a
Refactor/FunctionDeclarations: implement in PEAR.NamingConventions.Va…
jrfnl Mar 3, 2019
53a7c53
Refactor/FunctionDeclarations: implement in Squiz.Functions.GlobalFun…
jrfnl Mar 3, 2019
88ffcd0
Refactor: add new Util\Sniffs\Variables class
jrfnl Mar 4, 2019
404c604
Refactor/Variables: minor code simplification in the getMemberPropert…
jrfnl Mar 17, 2019
c2536a0
Refactor/Variables: fix minor parse error in getMemberProperties() un…
jrfnl Mar 11, 2019
f0690f5
Refactor/Variables: change over uses of the moved getMemberProperties…
jrfnl Mar 4, 2019
cbbd57a
Refactor/Variables: move $phpReservedVars
jrfnl Mar 4, 2019
2814f35
Refactor/Variables: enhance the list of PHP reserved variable names
jrfnl Mar 4, 2019
630ea01
Refactor/Variables: add new PHP reserved name related utility methods
jrfnl Mar 4, 2019
364fa46
Refactor/Variables: implement isPHPReservedVarName() in Squiz/Zend/Va…
jrfnl Mar 4, 2019
6381fd3
Refactor/Variables: add new isForeachAs() utility method
jrfnl Mar 4, 2019
0b2e290
Refactor: add new Util\Sniffs\UseStatements class
jrfnl Mar 4, 2019
dc3d419
Refactor/UseStatements: implement isImportUse() in PSR2.Namespaces.Us…
jrfnl Mar 4, 2019
6719022
Refactor: add new Util\Sniffs\Namespaces class
jrfnl Mar 5, 2019
906c64c
Refactor/Namespaces: implement getDeclaredName() in Generic/Duplicate…
jrfnl Mar 5, 2019
c25c751
Generic/DuplicateClassName: bug fix / namespace declaration ending in…
jrfnl Mar 5, 2019
5250055
Refactor/Namespaces: implement isDeclaration() in Generic/LanguageCon…
jrfnl Mar 5, 2019
4d6dae8
Refactor/Namespaces: implement determineNamespace() in PSR1/ClassDecl…
jrfnl Mar 5, 2019
6fa866f
Refactor/Namespaces: implement isDeclaration() in PSR1/SideEffects / …
jrfnl Mar 5, 2019
5153c67
PSR1/SideEffects: bug fix / treat scoped namespace declarations the s…
jrfnl Mar 5, 2019
a6c3415
PSR1/SideEffects: bug fix / ignore closures
jrfnl Mar 5, 2019
798eadd
Refactor/Namespaces: implement isDeclaration() in PSR2/NamespaceDecla…
jrfnl Mar 5, 2019
03351ef
PSR2/NamespaceDeclaration: bug fix / scoped namespace declarations + …
jrfnl Mar 5, 2019
27d4c5e
Refactor/Namespaces: implement in PSR2/UseDeclaration / bug fix
jrfnl Mar 5, 2019
d51b1da
Refactor/Namespaces: implement determineNamespace() in Squiz/SelfMemb…
jrfnl Mar 5, 2019
3f97738
Squiz/SelfMemberReference: bug fix / don't fix namepaced relative ref…
jrfnl Mar 5, 2019
cd63426
Refactor: add new Util\Sniffs\TokenIs class
jrfnl Mar 9, 2019
c078fcd
Refactor/TokenIs: fix minor parse errors in isReference() unit test c…
jrfnl Mar 11, 2019
97350a3
Refactor/TokenIs: add additional test for isReference()
jrfnl Mar 9, 2019
84c5e67
Refactor/TokenIs: change over uses of the isReference() method
jrfnl Mar 9, 2019
55d69ac
Refactor/TokenIs: add new isShortList() utility method
jrfnl Mar 9, 2019
1f21ce5
Refactor/TokenIs: implement use of isShortList() in AbstractArraySniff
jrfnl Mar 9, 2019
795b87b
Refactor/TokenIs: implement use of isShortList() in Squiz/ArrayDeclar…
jrfnl Mar 9, 2019
790165b
Refactor/TokenIs: implement isShortList() in Generic/DisallowShortArr…
jrfnl Mar 9, 2019
9e324d9
Generic.Formatting.MultipleStatementAlignment: add unit test with sho…
jrfnl Mar 9, 2019
f9a84c2
New `Generic.Lists.DisallowShortListSyntax` sniff
jrfnl Mar 9, 2019
da91694
New `Generic.Lists.DisallowLongListSyntax` sniff
jrfnl Mar 9, 2019
3167110
Refactor/TokenIs: add new isUnaryPlusMinus() utility method
jrfnl Mar 9, 2019
d365644
Refactor/TokenIs: implement isUnaryPlusMinus() in Squiz/OperatorSpaci…
jrfnl Mar 9, 2019
82366db
Refactor/TokenIs: implement isUnaryPlusMinus() in Squiz/OperatorBrack…
jrfnl Mar 9, 2019
5cbd153
Squiz/OperatorBracket: make the `SpacingAfterSign` error fixable
jrfnl Mar 9, 2019
090c3c7
Refactor: add new Util\Sniffs\PassedParameters class
jrfnl Mar 18, 2019
d255827
4. Attempt to support close curly and parenthesis
jrfnl Mar 18, 2019
3761f44
Refactor/PassedParameters: add new getDoubleArrowPosition() utility m…
jrfnl Mar 18, 2019
d4cea74
Refactor/PassedParameters: implement in AbstractArraySniff
jrfnl Mar 18, 2019
1e80b27
Refactor: add new Util\Sniffs\TextStrings class
jrfnl Mar 19, 2019
ae190da
Refactor/TextStrings: implement stripQuotes() in the Util\Sniffs\Vari…
jrfnl Mar 19, 2019
e5b1e6e
Refactor: add new Util\Sniffs\Orthography class
jrfnl Mar 19, 2019
0f06c56
Refactor/Orthography: implement use of the new isFirstCharCapitalized…
jrfnl Mar 19, 2019
70fce2c
Refactor/Orthography: implement use of the new isFirstCharLowercase()…
jrfnl Mar 19, 2019
a3d5e31
Refactor/Orthography: implement use of the new isLastCharPunctuation(…
jrfnl Mar 19, 2019
af556b5
Squiz/BlockComment: bug fix - allow capitalization check to work with…
jrfnl Mar 19, 2019
ab4c53b
Generic/DocComment: bug fix - allow capitalization check to work with…
jrfnl Mar 19, 2019
bf741cd
Refactor: move IsCamelCapsTest file
jrfnl Mar 18, 2019
92dbad0
Refactor: add new Util\Sniffs\ConstructNames class
jrfnl Mar 18, 2019
1f482bb
Refactor/ConstructNames: add unit tests for the getDeclarationName() …
jrfnl Mar 19, 2019
66dd026
Refactor/ConstructNames: various improvements to the getDeclarationNa…
jrfnl Mar 19, 2019
cfabb16
Refactor/ConstructNames: implement getDeclarationName() in Squiz/Vali…
jrfnl Mar 19, 2019
fff8578
Refactor/ConstructNames: change over uses of the getDeclarationName()…
jrfnl Mar 19, 2019
05c5696
Refactor/ConstructNames: update example class documentation for Abstr…
jrfnl Mar 19, 2019
e0d5387
Refactor/ConstructNames: change over uses of the isCamelCaps() method
jrfnl Mar 19, 2019
f5a9239
Refactor/ConstructNames: change over uses of the isUnderscoreName() m…
jrfnl Mar 19, 2019
f62685c
Refactor/ConstructNames: add number related transformation helper met…
jrfnl Mar 19, 2019
7561a83
Refactor/ConstructNames: add lowerConsecutiveCaps() transformation he…
jrfnl Mar 19, 2019
bccdf8b
Refactor: add new Util\Sniffs\Comments class
jrfnl Mar 22, 2019
e3dddfd
Refactor/Comments: add unit tests for the suggestType() method
jrfnl Mar 22, 2019
7826f9d
Refactor/Comments: various simplifications/fixes for the suggestType(…
jrfnl Mar 22, 2019
0867f3e
Refactor/Comments: lower the cyclomatic complexity of the suggestType…
jrfnl Mar 22, 2019
1af6087
Refactor/Comments: change over uses of the suggestType() method
jrfnl Mar 22, 2019
94fe309
Refactor/Comments: change over uses of the $allowedTypes property
jrfnl Mar 22, 2019
77a191d
Refactor/Comments: adjust $allowedTypes and suggestType() to allow fo…
jrfnl Mar 22, 2019
3b5ea3b
Refactor/Comments: allow for more types and allow for custom $allowed…
jrfnl Mar 22, 2019
06955c5
Refactor/Comments: allow for array<> style types in suggestType()
jrfnl Mar 22, 2019
1309395
Refactor/Comments: add support for PSR-5 union/intersect types via ne…
jrfnl Mar 22, 2019
14502dc
Squiz/FunctionComment: account for improved functioning of suggestType()
jrfnl Mar 22, 2019
d772138
CS: fix up violations in the PHPCS native code which are now detected…
jrfnl Mar 22, 2019
1384633
Refactor/Comments: add support for nullable types in suggestType() an…
jrfnl Mar 22, 2019
6d0482a
Squiz/FunctionComment: make long/short param/return type preference c…
jrfnl Mar 22, 2019
7bef8c0
Squiz/VariableComment: make long/short var type preference configurable
jrfnl Mar 22, 2019
0add04f
Refactor/Comments: implement `suggestTypeString()` in Squiz/VariableC…
jrfnl Mar 22, 2019
8d57220
CS: fix up violations in the PHPCS native code which are now detected…
jrfnl Mar 22, 2019
40f766b
Refactor/Comments: implement `suggestTypeString()` in Squiz/FunctionC…
jrfnl Mar 22, 2019
6144bcb
Refactor/Comments: implement `suggestTypeString()` in Squiz/FunctionC…
jrfnl Mar 22, 2019
c138683
Refactor/Comments: add two new utility methods for inline comments
jrfnl Mar 22, 2019
42691c5
Refactor/Comments: implement findEndOfComment() in Squiz.Commenting.I…
jrfnl Mar 22, 2019
5defb7e
Refactor/Comments: implement findEndOfComment() in Squiz.Commenting.B…
jrfnl Mar 22, 2019
ab84392
Refactor/Comments: implement findEndOfComment() in Squiz.PHP.Commente…
jrfnl Mar 22, 2019
1e956ab
Refactor/Comments: add five new docblock finding utility methods
jrfnl Mar 22, 2019
58ff8c6
Refactor/Comments: implement findOOStructureComment() in PEAR/ClassCo…
jrfnl Mar 23, 2019
c7a482c
Refactor/Comments: implement findOOStructureComment() in Squiz/ClassC…
jrfnl Mar 23, 2019
0cf02e7
Refactor/Comments: implement findPropertyComment() in Squiz/VariableC…
jrfnl Mar 23, 2019
8bdc633
Refactor/Comments: implement findFunctionComment() in PEAR/Squiz/Func…
jrfnl Mar 23, 2019
ef45190
Refactor/Comments: implement findFunctionComment() in Squiz/FunctionC…
jrfnl Mar 23, 2019
18911b1
Refactor/Comments: implement findFunctionComment() in MySource/Functi…
jrfnl Mar 23, 2019
f23ba73
Refactor/Comments: implement findFunctionComment() in MySource/AjaxNu…
jrfnl Mar 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
381 changes: 341 additions & 40 deletions package.xml

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class Config
/**
* Command line values that the user has supplied directly.
*
* @var array<string, TRUE>
* @var array<string, true>
*/
private static $overriddenDefaults = [];

Expand Down Expand Up @@ -584,6 +584,7 @@ public function restoreDefaults()
* @param int $pos The position of the argument on the command line.
*
* @return void
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
*/
public function processShortArgument($arg, $pos)
{
Expand Down Expand Up @@ -688,6 +689,7 @@ public function processShortArgument($arg, $pos)
* @param int $pos The position of the argument on the command line.
*
* @return void
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
*/
public function processLongArgument($arg, $pos)
{
Expand Down Expand Up @@ -1249,6 +1251,7 @@ public function processLongArgument($arg, $pos)
* @param int $pos The position of the argument on the command line.
*
* @return void
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
*/
public function processUnknownArgument($arg, $pos)
{
Expand All @@ -1274,6 +1277,7 @@ public function processUnknownArgument($arg, $pos)
* @param string $path The path to the file to add.
*
* @return void
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
*/
public function processFilePath($path)
{
Expand Down Expand Up @@ -1558,7 +1562,7 @@ public static function getExecutablePath($name)
*
* @return bool
* @see getConfigData()
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the config file can not be written.
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the config file can not be written.
*/
public static function setConfigData($key, $value, $temp=false)
{
Expand Down Expand Up @@ -1639,6 +1643,7 @@ public static function setConfigData($key, $value, $temp=false)
*
* @return array<string, string>
* @see getConfigData()
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the config file could not be read.
*/
public static function getAllConfigData()
{
Expand Down
Loading