Skip to content

Commit 9bb2ed5

Browse files
committed
Cannot override being final for abstract classes
1 parent 274e766 commit 9bb2ed5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/Reflection/ClassReflection.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ public function acceptsNamedArguments(): bool
12831283

12841284
public function hasFinalByKeywordOverride(): bool
12851285
{
1286-
return $this->isClass() && $this->finalByKeywordOverride !== null;
1286+
return $this->finalByKeywordOverride !== null;
12871287
}
12881288

12891289
public function isFinalByKeyword(): bool
@@ -1292,7 +1292,7 @@ public function isFinalByKeyword(): bool
12921292
return true;
12931293
}
12941294

1295-
if ($this->isClass() && $this->finalByKeywordOverride !== null) {
1295+
if ($this->finalByKeywordOverride !== null) {
12961296
return $this->finalByKeywordOverride;
12971297
}
12981298

@@ -1600,6 +1600,12 @@ public function asFinal(): self
16001600
if ($this->finalByKeywordOverride === true) {
16011601
return $this;
16021602
}
1603+
if (!$this->isClass()) {
1604+
return $this;
1605+
}
1606+
if ($this->isAbstract()) {
1607+
return $this;
1608+
}
16031609

16041610
return new self(
16051611
$this->reflectionProvider,

0 commit comments

Comments
 (0)