mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2026-02-03 13:17:11 +00:00
update phpstan to 1.1.2; update php-qrcode to 3.4.1
This commit is contained in:
@@ -4,10 +4,10 @@ matrix:
|
||||
include:
|
||||
- php: 7.2
|
||||
- php: 7.3
|
||||
- php: 7.4snapshot
|
||||
- php: 7.4
|
||||
- php: 8.0
|
||||
- php: nightly
|
||||
allow_failures:
|
||||
- php: 7.4snapshot
|
||||
- php: nightly
|
||||
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ Profit!
|
||||
|
||||
## Usage
|
||||
|
||||
The `SettingsContainerInterface` (wrapped in`SettingsContainerAbstract` ) provides plug-in functionality for immutable object variables and adds some fancy, like loading/saving JSON, arrays etc.
|
||||
It takes iterable as the only constructor argument and calls a method with the trait's name on invocation (`MyTrait::MyTrait()`) for each used trait.
|
||||
The `SettingsContainerInterface` (wrapped in`SettingsContainerAbstract` ) provides plug-in functionality for immutable object properties and adds some fancy, like loading/saving JSON, arrays etc.
|
||||
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.
|
||||
|
||||
### Simple usage
|
||||
```php
|
||||
@@ -61,6 +61,13 @@ class MyContainer extends SettingsContainerAbstract{
|
||||
protected $bar;
|
||||
}
|
||||
```
|
||||
Typed properties in PHP 7.4+:
|
||||
```php
|
||||
class MyContainer extends SettingsContainerAbstract{
|
||||
protected string $foo;
|
||||
protected string $bar;
|
||||
}
|
||||
```
|
||||
|
||||
```php
|
||||
// use it just like a \stdClass
|
||||
@@ -78,6 +85,8 @@ $container->fromJSON('{"foo": "what", "bar": "foo"}');
|
||||
$container->toArray(); // -> ['foo' => 'what', 'bar' => 'foo']
|
||||
// or JSON
|
||||
$container->toJSON(); // -> {"foo": "what", "bar": "foo"}
|
||||
// JSON via JsonSerializable
|
||||
$json = json_encode($container); // -> {"foo": "what", "bar": "foo"}
|
||||
|
||||
//non-existing properties will be ignored:
|
||||
$container->nope = 'what';
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
"source": "https://github.com/chillerlan/php-settings-container"
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.3"
|
||||
"phpunit/phpunit": "^8.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
Reference in New Issue
Block a user