File tree Expand file tree Collapse file tree 6 files changed +30
-5
lines changed Expand file tree Collapse file tree 6 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -620,6 +620,11 @@ public static function nameTokens()
620
620
\T_STRING => \T_STRING ,
621
621
];
622
622
623
+ /*
624
+ * PHP >= 8.0 in combination with PHPCS < 3.5.7 and all PHP versions in combination
625
+ * with PHPCS >= 3.5.7, though when using PHPCS 3.5.7 < 4.0.0, these tokens are
626
+ * not yet in use, i.e. the PHP 8.0 change is "undone" for PHPCS 3.x.
627
+ */
623
628
if (\defined ('T_NAME_QUALIFIED ' ) === true ) {
624
629
$ tokens [\T_NAME_QUALIFIED ] = \T_NAME_QUALIFIED ;
625
630
}
Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSUtils \Tests \Tokens \Collections ;
12
12
13
+ use PHPCSUtils \BackCompat \Helper ;
13
14
use PHPCSUtils \Tokens \Collections ;
14
15
use PHPUnit \Framework \TestCase ;
15
16
@@ -32,11 +33,14 @@ class NameTokensTest extends TestCase
32
33
*/
33
34
public function testNameTokens ()
34
35
{
36
+ $ version = Helper::getVersion ();
35
37
$ expected = [
36
38
\T_STRING => \T_STRING ,
37
39
];
38
40
39
- if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true ) {
41
+ if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true
42
+ || \version_compare ($ version , '3.5.7 ' , '>= ' ) === true
43
+ ) {
40
44
$ expected [\T_NAME_QUALIFIED ] = \T_NAME_QUALIFIED ;
41
45
$ expected [\T_NAME_FULLY_QUALIFIED ] = \T_NAME_FULLY_QUALIFIED ;
42
46
$ expected [\T_NAME_RELATIVE ] = \T_NAME_RELATIVE ;
Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSUtils \Tests \Tokens \Collections ;
12
12
13
+ use PHPCSUtils \BackCompat \Helper ;
13
14
use PHPCSUtils \Tokens \Collections ;
14
15
use PHPUnit \Framework \TestCase ;
15
16
@@ -32,13 +33,16 @@ class NamespacedNameTokensTest extends TestCase
32
33
*/
33
34
public function testNamespacedNameTokens ()
34
35
{
36
+ $ version = Helper::getVersion ();
35
37
$ expected = [
36
38
\T_NS_SEPARATOR => \T_NS_SEPARATOR ,
37
39
\T_NAMESPACE => \T_NAMESPACE ,
38
40
\T_STRING => \T_STRING ,
39
41
];
40
42
41
- if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true ) {
43
+ if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true
44
+ || \version_compare ($ version , '3.5.7 ' , '>= ' ) === true
45
+ ) {
42
46
$ expected [\T_NAME_QUALIFIED ] = \T_NAME_QUALIFIED ;
43
47
$ expected [\T_NAME_FULLY_QUALIFIED ] = \T_NAME_FULLY_QUALIFIED ;
44
48
$ expected [\T_NAME_RELATIVE ] = \T_NAME_RELATIVE ;
Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSUtils \Tests \Tokens \Collections ;
12
12
13
+ use PHPCSUtils \BackCompat \Helper ;
13
14
use PHPCSUtils \Tokens \Collections ;
14
15
use PHPUnit \Framework \TestCase ;
15
16
@@ -32,6 +33,7 @@ class ParameterTypeTokensTest extends TestCase
32
33
*/
33
34
public function testParameterTypeTokens ()
34
35
{
36
+ $ version = Helper::getVersion ();
35
37
$ expected = [
36
38
\T_CALLABLE => \T_CALLABLE ,
37
39
\T_SELF => \T_SELF ,
@@ -44,7 +46,9 @@ public function testParameterTypeTokens()
44
46
\T_STRING => \T_STRING ,
45
47
];
46
48
47
- if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true ) {
49
+ if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true
50
+ || \version_compare ($ version , '3.5.7 ' , '>= ' ) === true
51
+ ) {
48
52
$ expected [\T_NAME_QUALIFIED ] = \T_NAME_QUALIFIED ;
49
53
$ expected [\T_NAME_FULLY_QUALIFIED ] = \T_NAME_FULLY_QUALIFIED ;
50
54
$ expected [\T_NAME_RELATIVE ] = \T_NAME_RELATIVE ;
Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSUtils \Tests \Tokens \Collections ;
12
12
13
+ use PHPCSUtils \BackCompat \Helper ;
13
14
use PHPCSUtils \Tokens \Collections ;
14
15
use PHPUnit \Framework \TestCase ;
15
16
@@ -32,6 +33,7 @@ class PropertyTypeTokensTest extends TestCase
32
33
*/
33
34
public function testPropertyTypeTokens ()
34
35
{
36
+ $ version = Helper::getVersion ();
35
37
$ expected = [
36
38
\T_CALLABLE => \T_CALLABLE ,
37
39
\T_SELF => \T_SELF ,
@@ -44,7 +46,9 @@ public function testPropertyTypeTokens()
44
46
\T_STRING => \T_STRING ,
45
47
];
46
48
47
- if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true ) {
49
+ if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true
50
+ || \version_compare ($ version , '3.5.7 ' , '>= ' ) === true
51
+ ) {
48
52
$ expected [\T_NAME_QUALIFIED ] = \T_NAME_QUALIFIED ;
49
53
$ expected [\T_NAME_FULLY_QUALIFIED ] = \T_NAME_FULLY_QUALIFIED ;
50
54
$ expected [\T_NAME_RELATIVE ] = \T_NAME_RELATIVE ;
Original file line number Diff line number Diff line change 10
10
11
11
namespace PHPCSUtils \Tests \Tokens \Collections ;
12
12
13
+ use PHPCSUtils \BackCompat \Helper ;
13
14
use PHPCSUtils \Tokens \Collections ;
14
15
use PHPUnit \Framework \TestCase ;
15
16
@@ -32,6 +33,7 @@ class ReturnTypeTokensTest extends TestCase
32
33
*/
33
34
public function testReturnTypeTokens ()
34
35
{
36
+ $ version = Helper::getVersion ();
35
37
$ expected = [
36
38
\T_CALLABLE => \T_CALLABLE ,
37
39
\T_SELF => \T_SELF ,
@@ -46,7 +48,9 @@ public function testReturnTypeTokens()
46
48
\T_STRING => \T_STRING ,
47
49
];
48
50
49
- if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true ) {
51
+ if (\version_compare (\PHP_VERSION_ID , '80000 ' , '>= ' ) === true
52
+ || \version_compare ($ version , '3.5.7 ' , '>= ' ) === true
53
+ ) {
50
54
$ expected [\T_NAME_QUALIFIED ] = \T_NAME_QUALIFIED ;
51
55
$ expected [\T_NAME_FULLY_QUALIFIED ] = \T_NAME_FULLY_QUALIFIED ;
52
56
$ expected [\T_NAME_RELATIVE ] = \T_NAME_RELATIVE ;
You can’t perform that action at this time.
0 commit comments