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

style: enable get_class_to_class_keyword fixer #9394

Merged

Conversation

paulbalandan
Copy link
Member

Description

utils/vendor/bin/php-cs-fixer describe get_class_to_class_keyword
PHP CS Fixer 3.67.0 Persian Successor by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.15
Description of the `get_class_to_class_keyword` rule.

Replace `get_class` calls on object variables with class keyword syntax.

Fixer applying this rule is RISKY.
Risky if the `get_class` function is overridden.

Fixing examples:
 * Example #1.
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,2 +1,2 @@
    <?php
   -get_class($a);
   +$a::class;
   
   ----------- end diff -----------

 * Example #2.
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,4 +1,4 @@
    <?php
    
    $date = new \DateTimeImmutable();
   -$class = get_class($date);
   +$class = $date::class;
   
   ----------- end diff -----------

Fixer is part of the following rule sets:
* @PHP80Migration:risky with default config
* @PHP82Migration:risky with default config
* @Symfony:risky with default config

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@samsonasik samsonasik merged commit 49df643 into codeigniter4:develop Jan 10, 2025
9 checks passed
@samsonasik
Copy link
Member

Thank you @paulbalandan

@paulbalandan paulbalandan deleted the get-class-to-class-keyword branch January 10, 2025 13:13
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.

4 participants