You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-34Lines changed: 45 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -45,31 +45,27 @@ Profit!
45
45
46
46
## Usage
47
47
48
-
The `SettingsContainerInterface` (wrapped in`SettingsContainerAbstract`) provides plug-in functionality for immutable object properties and adds some fancy, like loading/saving JSON, arrays etc.
48
+
The `SettingsContainerInterface` (wrapped in`SettingsContainerAbstract`) provides plug-in functionality for immutable object properties and adds some fancy, like loading/saving JSON, arrays etc.
49
49
It takes an `iterable` as the only constructor argument and calls a method with the trait's name on invocation (`MyTrait::MyTrait()`) for each used trait.
50
50
51
+
A PHPStan ruleset to exclude errors generated by accessing magic properties on `SettingsContainerInterface` can be found in `rules-magic-access.neon`.
52
+
53
+
51
54
### Simple usage
52
55
```php
53
-
class MyContainer extends SettingsContainerAbstract{
54
-
protected $foo;
55
-
protected $bar;
56
-
}
57
-
```
58
-
Typed properties in PHP 7.4+:
59
-
```php
60
56
class MyContainer extends SettingsContainerAbstract{
61
57
protected string $foo;
62
58
protected string $bar;
63
59
}
64
60
```
65
61
66
62
```php
67
-
// use it just like a \stdClass
63
+
// use it just like a \stdClass (except the properties are fixed)
68
64
$container = new MyContainer;
69
65
$container->foo = 'what';
70
66
$container->bar = 'foo';
71
67
72
-
// which is equivalent to
68
+
// which is equivalent to
73
69
$container = new MyContainer(['bar' => 'foo', 'foo' => 'what']);
0 commit comments