Skip to content

Commit c9db265

Browse files
committed
Don't implement interfaces extended by another that is also implemented
PHP<7.4 does not allow this. Instead, for clarity, add a DocBlock comment stating which additional interfaces should be implemented that are not explicitly listed in the `implements` section. When our minimum PHP version becomes 7.4 or above, we can revisit this.
1 parent 090d8af commit c9db265

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/CSSList/CSSList.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030
* `RuleSet`s as well as other `CSSList` objects.
3131
*
3232
* It can also contain `Import` and `Charset` objects stemming from at-rules.
33+
*
34+
* Note that `CSSListItem` extends both `Commentable` and `Renderable`,
35+
* so those interfaces must also be implemented by concrete subclasses.
3336
*/
34-
abstract class CSSList implements Commentable, CSSListItem, Renderable
37+
abstract class CSSList implements CSSListItem
3538
{
3639
/**
3740
* @var list<Comment>

src/Property/AtRule.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
use Sabberworm\CSS\CSSList\CSSListItem;
99
use Sabberworm\CSS\Renderable;
1010

11-
interface AtRule extends Commentable, CSSListItem, Renderable
11+
/**
12+
* Note that `CSSListItem` extends both `Commentable` and `Renderable`,
13+
* so concrete classes implementing this interface must also implement those.
14+
*/
15+
interface AtRule extends CSSListItem
1216
{
1317
/**
1418
* Since there are more set rules than block rules,

src/RuleSet/RuleSet.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
*
2323
* If you want to manipulate a `RuleSet`, use the methods `addRule(Rule $rule)`, `getRules()` and `removeRule($rule)`
2424
* (which accepts either a `Rule` or a rule name; optionally suffixed by a dash to remove all related rules).
25+
*
26+
* Note that `CSSListItem` extends both `Commentable` and `Renderable`,
27+
* so those interfaces must also be implemented by concrete subclasses.
2528
*/
26-
abstract class RuleSet implements Commentable, CSSListItem, Renderable
29+
abstract class RuleSet implements CSSListItem
2730
{
2831
/**
2932
* the rules in this rule set, using the property name as the key,

0 commit comments

Comments
 (0)