Skip to content
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

DX: use numeric_literal_separator #6766

Merged
merged 2 commits into from
Jan 30, 2023
Merged

Conversation

keradus
Copy link
Member

@keradus keradus commented Jan 29, 2023

ref #6761

@coveralls
Copy link

coveralls commented Jan 29, 2023

Pull Request Test Coverage Report for Build 4038978590

  • 61 of 64 (95.31%) changed or added relevant lines in 41 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.944%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/AbstractPhpdocToTypeDeclarationFixer.php 0 1 0.0%
src/Fixer/NamespaceNotation/CleanNamespaceFixer.php 1 2 50.0%
src/Tokenizer/Tokens.php 1 2 50.0%
Totals Coverage Status
Change from base Build 4037042600: 0.0%
Covered Lines: 22618
Relevant Lines: 24335

💛 - Coveralls

@keradus keradus merged commit fd5d093 into PHP-CS-Fixer:master Jan 30, 2023
@keradus keradus deleted the dx_numbers branch January 30, 2023 20:59
@kubawerlos
Copy link
Contributor

@keradus any plans to follow up with some auto review check no new code will be inconsistent.

Something like 👇🏼 in ProjectCodeTest.php, maybe?

    /**
     * @dataProvider provideSrcClassCases
     * @dataProvider provideTestClassCases
     */
    public function testUsingLiteralSeparator(string $className): void
    {
        $tokens = Tokens::fromCode(file_get_contents((new \ReflectionClass($className))->getFileName()));

        foreach ($tokens->findGivenKind(T_LNUMBER) as $token) {
            if ((int) str_replace('_', '', $token->getContent()) < 5_00_00 || 5 !== preg_match_all('/\d/', $token->getContent())) {
                static::assertMatchesRegularExpression('/^[^_]+$/', $token->getContent());

                continue;
            }

            static::assertMatchesRegularExpression(
                '/^\d{1}_\d{2}_\d{2}$/',
                $token->getContent(),
                sprintf('PHP_VERSION_ID incorrectly formatted in %s (must be like %s)', $className, 8_20_00)
            );
        }
    }

@keradus
Copy link
Member Author

keradus commented Jan 31, 2023

I would be very open for it, but wont be able to put effort for it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants