arkitect icon indicating copy to clipboard operation
arkitect copied to clipboard

Fixed "IsAbstract" for interfaces, traits, enums and final classes

Open sebastianstucke87 opened this issue 1 year ago • 1 comments
trafficstars

Fixed \Arkitect\Expression\ForClasses\IsAbstract because:

  • interfaces can not be abstract
  • traits can not be abstract
  • enums can not be abstract
  • final classes can not be abstract

sebastianstucke87 avatar Mar 30 '24 22:03 sebastianstucke87

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.19%. Comparing base (b78ecce) to head (00dd134). Report is 3 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #425   +/-   ##
=========================================
  Coverage     94.19%   94.19%           
- Complexity      582      586    +4     
=========================================
  Files            69       69           
  Lines          1533     1534    +1     
=========================================
+ Hits           1444     1445    +1     
  Misses           89       89           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Mar 30 '24 22:03 codecov-commenter

Hi @sebastianstucke87 can you please fix red checks?

AlessandroMinoccheri avatar May 06 '24 06:05 AlessandroMinoccheri

Note that with this change, IsAbstract will now identify interface, trait, enum and final all as abstract classes.

interfaces can not be abstract

I don't believe a rule is needed for this, because this is something PHP already disallows.

At best, I believe the rule could become...

- if ($theClass->isAbstract() || $theClass->isInterface() || $theClass->isTrait() || $theClass->isEnum()
-            || $theClass->isFinal()) {
+ if ($theClass->isAbstract() && !$theClass->isInterface() && !$theClass->isTrait() && !$theClass->isEnum()
+            && !$theClass->isFinal()) {

... but it should be redundant because if ::isAbstract() is true then all other states must be false.

courtney-miles avatar Aug 05 '24 11:08 courtney-miles