Skip to content

Commit d00ae73

Browse files
committed
🚿
1 parent 0231882 commit d00ae73

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<rule ref="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment"/>
3636

3737
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
38-
<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion"/>
38+
<!--<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion"/>-->
3939
<rule ref="SlevomatCodingStandard.Classes.ForbiddenPublicProperty"/>
4040
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
4141

src/Attributes/ThrowOnInvalidProperty.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,8 @@
2121
#[Attribute(Attribute::TARGET_CLASS)]
2222
final class ThrowOnInvalidProperty{
2323

24-
private readonly bool $throwOnInvalid;
25-
26-
public function __construct(bool $throwOnInvalid){
27-
$this->throwOnInvalid = $throwOnInvalid;
28-
}
29-
30-
public function throwOnInvalid():bool{
31-
return $this->throwOnInvalid;
32-
}
24+
public function __construct(
25+
public readonly bool $throwOnInvalid,
26+
){}
3327

3428
}

src/SettingsContainerAbstract.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ final protected function throwOnInvalidProperty():bool{
153153
if($attributes === []){
154154
return false;
155155
}
156+
/** @var \chillerlan\Settings\Attributes\ThrowOnInvalidProperty $attr */
157+
$attr = $attributes[0]->newInstance();
156158

157-
return $attributes[0]->newInstance()->throwOnInvalid();
159+
return $attr->throwOnInvalid;
158160
}
159161

160162
public function toArray():array{

0 commit comments

Comments
 (0)