Skip to content

Commit 1606892

Browse files
committed
Support exponentiation operator
1 parent a2a594a commit 1606892

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
66
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
77
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
8-
![Tests](https://img.shields.io/badge/tests-3736-brightgreen.svg)
8+
![Tests](https://img.shields.io/badge/tests-3737-brightgreen.svg)
99
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
1010

1111
[![CI status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml/badge.svg)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml)

src/Fixer/TypedClassConstantFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
final class TypedClassConstantFixer extends AbstractFixer
2323
{
24-
private const INTEGER_KINDS = [\T_LNUMBER, '+', '-', '*', '(', ')', \T_SL, \T_SR];
24+
private const INTEGER_KINDS = [\T_LNUMBER, '+', '-', '*', '(', ')', \T_POW, \T_SL, \T_SR];
2525
private const FLOAT_KINDS = [\T_DNUMBER, ...self::INTEGER_KINDS, '/'];
2626
private const STRING_KINDS = [\T_CONSTANT_ENCAPSED_STRING, '.', \T_LNUMBER, \T_DNUMBER];
2727

tests/Fixer/TypedClassConstantFixerTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,17 @@ public static function provideFixCases(): iterable
8080
'<?php class Foo { public const BAR = 1000 * (701 + 22); }',
8181
];
8282

83-
yield 'integer shift left operator' => [
83+
yield 'integer with exponentiation operator' => [
84+
'<?php class Foo { public const int BAR = 2 ** 10; }',
85+
'<?php class Foo { public const BAR = 2 ** 10; }',
86+
];
87+
88+
yield 'integer with shift left operator' => [
8489
'<?php class Foo { public const int BAR = 1 << 16; }',
8590
'<?php class Foo { public const BAR = 1 << 16; }',
8691
];
8792

88-
yield 'integer shift right operator' => [
93+
yield 'integer with shift right operator' => [
8994
'<?php class Foo { public const int BAR = 1024 >> 1; }',
9095
'<?php class Foo { public const BAR = 1024 >> 1; }',
9196
];

0 commit comments

Comments
 (0)