-
-
Notifications
You must be signed in to change notification settings - Fork 8
Update for new upstream PHPCS 4.x branch #674
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f2ea5c7
GH Actions: update for new upstream 4.x branch
jrfnl d434dcc
BCTokens: sync with PHPCS 4.0 [1] / removed JS tokens
jrfnl 75ec556
BCTokens: sync with PHPCS 4.0 [2] / anon class is function name token
jrfnl bb46cd4
BCTokens: sync with PHPCS 4.0 [3] / closure use is parenthesis owner
jrfnl 0ba978d
BCTokens: sync with PHPCS 4.0 [4] / more parenthesis owners
jrfnl a51914c
BCTokens: sync with PHPCS 4.0 [5] / namespaced name tokens
jrfnl b7ba1b8
UtilityMethodTestCase: make compatible with PHPCS 4.0
jrfnl cad314b
Tests: deal with difference in tokenization of PHP open tag in PHPCS 4.0
jrfnl 57e8980
Parentheses::getOwner(): T_USE is now a parenthesis owner
jrfnl 183b458
BCFile::getMethodParameters(): sync with PHPCS 4.0 / T_USE is parenth…
jrfnl 8471a1c
BCFile::getMemberProperties(): sync with PHPCS 4.0 / remove parse err…
jrfnl a542524
BCFile::getDeclarationName(): sync with PHPCS 4.0 / stop accepting to…
jrfnl dc1f23e
BCFile::findExtendedClassName(): sync with PHPCS 4.0 / handling of na…
jrfnl 2adfb12
BCFile::findImplementedInterfaceNames(): sync with PHPCS 4.0 / handli…
jrfnl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,86 @@ | ||
<?php | ||
/** | ||
* PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers. | ||
* | ||
* @package PHPCSUtils | ||
* @copyright 2019-2020 PHPCSUtils Contributors | ||
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3 | ||
* @link https://github.com/PHPCSStandards/PHPCSUtils | ||
*/ | ||
|
||
namespace PHPCSUtils\Tests\BackCompat\BCTokens; | ||
|
||
use PHP_CodeSniffer\Util\Tokens; | ||
use PHPCSUtils\BackCompat\BCTokens; | ||
use PHPCSUtils\BackCompat\Helper; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Test class. | ||
* | ||
* @covers \PHPCSUtils\BackCompat\BCTokens::assignmentTokens | ||
* | ||
* @group tokens | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
final class AssignmentTokensTest extends TestCase | ||
{ | ||
|
||
/** | ||
* Test the method. | ||
* | ||
* @return void | ||
*/ | ||
public function testAssignmentTokens() | ||
{ | ||
$expected = [ | ||
\T_EQUAL => \T_EQUAL, | ||
\T_AND_EQUAL => \T_AND_EQUAL, | ||
\T_OR_EQUAL => \T_OR_EQUAL, | ||
\T_CONCAT_EQUAL => \T_CONCAT_EQUAL, | ||
\T_DIV_EQUAL => \T_DIV_EQUAL, | ||
\T_MINUS_EQUAL => \T_MINUS_EQUAL, | ||
\T_POW_EQUAL => \T_POW_EQUAL, | ||
\T_MOD_EQUAL => \T_MOD_EQUAL, | ||
\T_MUL_EQUAL => \T_MUL_EQUAL, | ||
\T_PLUS_EQUAL => \T_PLUS_EQUAL, | ||
\T_XOR_EQUAL => \T_XOR_EQUAL, | ||
\T_DOUBLE_ARROW => \T_DOUBLE_ARROW, | ||
\T_SL_EQUAL => \T_SL_EQUAL, | ||
\T_SR_EQUAL => \T_SR_EQUAL, | ||
\T_COALESCE_EQUAL => \T_COALESCE_EQUAL, | ||
]; | ||
|
||
$this->assertSame($expected, BCTokens::assignmentTokens()); | ||
} | ||
|
||
/** | ||
* Test whether the method in BCTokens is still in sync with the latest version of PHPCS. | ||
* | ||
* This group is not run by default and has to be specifically requested to be run. | ||
* | ||
* @group compareWithPHPCS | ||
* | ||
* @return void | ||
*/ | ||
public function testPHPCSAssignmentTokens() | ||
{ | ||
$version = Helper::getVersion(); | ||
|
||
if (\version_compare($version, '3.99.99', '>') === true) { | ||
$this->assertSame(Tokens::$assignmentTokens, BCTokens::assignmentTokens()); | ||
} else { | ||
/* | ||
* Don't fail this test on the difference between PHPCS 4.x and 3.x. | ||
* This test is only run against `dev-master` and `dev-master` is still PHPCS 3.x. | ||
*/ | ||
$expected = Tokens::$assignmentTokens; | ||
unset($expected[\T_ZSR_EQUAL]); | ||
|
||
$result = BCTokens::assignmentTokens(); | ||
|
||
$this->assertSame($expected, $result); | ||
} | ||
} | ||
} |
This file contains hidden or 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,74 @@ | ||
<?php | ||
/** | ||
* PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers. | ||
* | ||
* @package PHPCSUtils | ||
* @copyright 2019-2020 PHPCSUtils Contributors | ||
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3 | ||
* @link https://github.com/PHPCSStandards/PHPCSUtils | ||
*/ | ||
|
||
namespace PHPCSUtils\Tests\BackCompat\BCTokens; | ||
|
||
use PHP_CodeSniffer\Util\Tokens; | ||
use PHPCSUtils\BackCompat\BCTokens; | ||
use PHPCSUtils\BackCompat\Helper; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Test class. | ||
* | ||
* @covers \PHPCSUtils\BackCompat\BCTokens::blockOpeners | ||
* | ||
* @group tokens | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
final class BlockOpenersTest extends TestCase | ||
{ | ||
|
||
/** | ||
* Test the method. | ||
* | ||
* @return void | ||
*/ | ||
public function testBlockOpeners() | ||
{ | ||
$expected = [ | ||
\T_OPEN_CURLY_BRACKET => \T_OPEN_CURLY_BRACKET, | ||
\T_OPEN_SQUARE_BRACKET => \T_OPEN_SQUARE_BRACKET, | ||
\T_OPEN_PARENTHESIS => \T_OPEN_PARENTHESIS, | ||
]; | ||
|
||
$this->assertSame($expected, BCTokens::blockOpeners()); | ||
} | ||
|
||
/** | ||
* Test whether the method in BCTokens is still in sync with the latest version of PHPCS. | ||
* | ||
* This group is not run by default and has to be specifically requested to be run. | ||
* | ||
* @group compareWithPHPCS | ||
* | ||
* @return void | ||
*/ | ||
public function testPHPCSBlockOpeners() | ||
{ | ||
$version = Helper::getVersion(); | ||
|
||
if (\version_compare($version, '3.99.99', '>') === true) { | ||
$this->assertSame(Tokens::$blockOpeners, BCTokens::blockOpeners()); | ||
} else { | ||
/* | ||
* Don't fail this test on the difference between PHPCS 4.x and 3.x. | ||
* This test is only run against `dev-master` and `dev-master` is still PHPCS 3.x. | ||
*/ | ||
$expected = Tokens::$blockOpeners; | ||
unset($expected[\T_OBJECT]); | ||
|
||
$result = BCTokens::blockOpeners(); | ||
|
||
$this->assertSame($expected, $result); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.