Browse Source

DX: remove Utils::calculateBitmask

Dariusz Ruminski 3 years ago
parent
commit
22ee543730
2 changed files with 0 additions and 52 deletions
  1. 0 18
      src/Utils.php
  2. 0 34
      tests/UtilsTest.php

+ 0 - 18
src/Utils.php

@@ -26,24 +26,6 @@ use PhpCsFixer\Tokenizer\Token;
  */
 final class Utils
 {
-    /**
-     * Calculate a bitmask for given constant names.
-     *
-     * @param string[] $options constant names
-     */
-    public static function calculateBitmask(array $options): int
-    {
-        $bitmask = 0;
-
-        foreach ($options as $optionName) {
-            if (\defined($optionName)) {
-                $bitmask |= \constant($optionName);
-            }
-        }
-
-        return $bitmask;
-    }
-
     /**
      * Converts a camel cased string to a snake cased string.
      */

+ 0 - 34
tests/UtilsTest.php

@@ -260,40 +260,6 @@ final class UtilsTest extends TestCase
         ];
     }
 
-    /**
-     * @dataProvider provideCalculateBitmaskCases
-     */
-    public function testCalculateBitmask(int $expected, array $options): void
-    {
-        static::assertSame($expected, Utils::calculateBitmask($options));
-    }
-
-    public function provideCalculateBitmaskCases()
-    {
-        return [
-            [
-                JSON_HEX_TAG | JSON_HEX_QUOT,
-                ['JSON_HEX_TAG', 'JSON_HEX_QUOT'],
-            ],
-            [
-                JSON_HEX_TAG | JSON_HEX_QUOT,
-                ['JSON_HEX_TAG', 'JSON_HEX_QUOT', 'NON_EXISTENT_CONST'],
-            ],
-            [
-                JSON_HEX_TAG,
-                ['JSON_HEX_TAG'],
-            ],
-            [
-                JSON_HEX_TAG | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_HEX_APOS,
-                ['JSON_HEX_TAG', 'JSON_HEX_QUOT', 'JSON_HEX_AMP', 'JSON_HEX_APOS'],
-            ],
-            [
-                0,
-                [],
-            ],
-        ];
-    }
-
     /**
      * @group legacy
      */