Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  specify next release
  simplify job name
  test against php 8.3
  remove the generated website
  copy readme style from other packages
  fix note style
  fix documentation
  fix documentation
  remove Map fixture
  always use Encoding enum in Str
  run phpunit tests via blackbox
  discard psalm errors
  CS
  simplify blackbox config
  • Loading branch information
Baptouuuu committed Sep 16, 2023
2 parents 16b1fd2 + 6941fda commit e7968ea
Show file tree
Hide file tree
Showing 48 changed files with 188 additions and 426 deletions.
58 changes: 7 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,12 @@ name: CI
on: [push]

jobs:
phpunit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.2']
name: 'PHPUnit'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: none
- name: Composer
uses: "ramsey/composer-install@v2"
- name: PHPUnit
run: vendor/bin/phpunit
env:
BLACKBOX_SET_SIZE: 20
blackbox:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.2']
php-version: ['8.2', '8.3']
dependency-versions: ['lowest', 'highest']
name: 'BlackBox'
steps:
Expand All @@ -48,14 +26,16 @@ jobs:
dependency-versions: ${{ matrix.dependencies }}
- name: BlackBox
run: php blackbox.php
blackbox_coverage:
env:
BLACKBOX_SET_SIZE: 20
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.2']
php-version: ['8.2', '8.3']
dependency-versions: ['lowest', 'highest']
name: 'BlackBox Coverage'
name: 'Coverage'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -73,30 +53,6 @@ jobs:
run: php blackbox.php
env:
ENABLE_COVERAGE: 'true'
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.2']
name: 'Coverage'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: xdebug
- name: Composer
uses: "ramsey/composer-install@v2"
- name: PHPUnit
run: vendor/bin/phpunit --coverage-clover=coverage.clover
env:
BLACKBOX_SET_SIZE: 1
- uses: codecov/codecov-action@v1
with:
Expand All @@ -105,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2']
php-version: ['8.2', '8.3']
name: 'Psalm'
steps:
- name: Checkout
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/documentation.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
composer.lock
vendor
.phpunit.result.cache
.couscous
.php-cs-fixer.cache
83 changes: 0 additions & 83 deletions .journal

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 5.0.0 - 2023-09-16

### Changed

- `Innmind\Immutable\Str` only use `Innmind\Immutable\Str\Encoding` to represent the encoding to work with

### Removed

- `Fixtures\Innmind\Immutable\Map`

## 4.15.0 - 2023-07-08

### Added
Expand Down
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@

A set of classes to wrap PHP primitives to build immutable data.

[Documentation](docs/)

## Installation

```sh
composer require innmind/immutable
```

## Usage

Here are some examples of what you can do:

## Sequence
### Sequence

To be used to wrap an ordered list of elements (elements can be of mixed types).

Expand Down Expand Up @@ -38,7 +48,7 @@ $lines->foreach(fn($line) => echo($line));

For a complete list of methods check [`Sequence`](src/Sequence.php).

## Set
### Set

To be used as a collection of unordered elements (elements must be of the same type).

Expand All @@ -52,7 +62,7 @@ $set->add(42.0); // psalm will raise an error

For a complete list of methods check [`Set`](src/Set.php).

## Map
### Map

To be used as a collection of key/value pairs (both keys and values must be of the same type).

Expand All @@ -72,7 +82,7 @@ $map->values()->toList(); // [42, 66]

For a complete list of methods check [`Map`](src/Map.php).

## Strings
### Strings

```php
use Innmind\Immutable\Str;
Expand Down Expand Up @@ -100,9 +110,9 @@ $regexp->matches(Str::of('foobar')); // false
$regexp->capture(Str::of('foo123bar')); // Map<int|string, Str> with index `i` set to Str::of('123')
```

## [BlackBox](https://github.com/innmind/blackbox/)
### [BlackBox](https://github.com/innmind/blackbox/)

This library provides 3 `Set`s that can be used with [`innmind/black-box`](https://packagist.org/packages/innmind/black-box).
This library provides 2 `Set`s that can be used with [`innmind/black-box`](https://packagist.org/packages/innmind/black-box).

You can use them as follow:

Expand All @@ -121,19 +131,14 @@ class SomeTest extends \PHPUnit\Framework\TestCase
{
$this
->forAll(
Immutable\Map::of(
Set\Integers::any(),
Set\Strings::any(),
),
Immutable\Set::of(
Set\RealNumbers::any(),
),
Immutable\Sequence::of(
Set\Uuid::any(),
),
)
->then(function($map, $set, $sequence) {
// $map is an instance of \Innmind\Immutable\Map<int, string>
->then(function($set, $sequence) {
// $set is an instance of \Innmind\Immutable\Set<float>
// $sequence is an instance of \Innmind\Immutable\Sequence<string>

Expand Down
25 changes: 13 additions & 12 deletions blackbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
};

Application::new($argv)
->codeCoverage(
CodeCoverage::of(
__DIR__.'/src/',
__DIR__.'/proofs/',
__DIR__.'/fixtures/',
)
->dumpTo('coverage.clover')
->enableWhen(\getenv('ENABLE_COVERAGE') !== false),
->when(
\getenv('ENABLE_COVERAGE') !== false,
static fn(Application $app) => $app
->codeCoverage(
CodeCoverage::of(
__DIR__.'/src/',
__DIR__.'/proofs/',
__DIR__.'/fixtures/',
)
->dumpTo('coverage.clover')
->enableWhen(true),
)
->scenariiPerProof(1),
)
->scenariiPerProof(match (\getenv('ENABLE_COVERAGE')) {
false => 100,
default => 1,
})
->tryToProve(Load::everythingIn(__DIR__.'/proofs/'))
->exit();
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
}
},
"require-dev": {
"phpunit/phpunit": "~10.0",
"vimeo/psalm": "~5.6",
"innmind/black-box": "~5.0",
"innmind/black-box": "^5.5.1",
"innmind/coding-standard": "~2.0"
},
"conflict": {
Expand Down
12 changes: 8 additions & 4 deletions docs/EITHER.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function accessResource(User $user): Either {
}
```

> **Note** `ServerRequest`, `User`, `Resource` and `Error` are imaginary classes.
> **Note**
> `ServerRequest`, `User`, `Resource` and `Error` are imaginary classes.
## `::left()`

Expand All @@ -42,7 +43,8 @@ This builds an `Either` instance with the given value in the left hand side.
$either = Either::left($anyValue);
```

> **Note** usually this side is used for errors.
> **Note**
> usually this side is used for errors.
## `::right()`

Expand All @@ -52,7 +54,8 @@ This builds an `Either` instance with the given value in the right hand side.
$either = Either::right($anyValue);
```

> **Note** usually this side is used for valid values.
> **Note**
> usually this side is used for valid values.
## `::defer()`

Expand Down Expand Up @@ -110,7 +113,8 @@ $response = identify($serverRequest)
);
```

> **Note** `Response` is an imaginary class.
> **Note**
> `Response` is an imaginary class.
## `->otherwise()`

Expand Down
Loading

0 comments on commit e7968ea

Please sign in to comment.