Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop: (26 commits)
  specify the next release
  mention php 8.4 support in the changelog
  add missing annotation
  use the default psalm matrix
  fix php 8.4 null deprecations
  fix psalm errors
  run psalm against php 8.4
  remove unnecessary access to secrets
  reuse release workflow
  reuse documentation workflow
  reuse CS workflow
  reuse palm workflow
  Revert "remove reference"
  remove reference
  Revert "remove reference"
  remove reference
  Revert "remove reference"
  remove reference
  call the matrix workflows
  Revert "remove secrets inheriting"
  ...
  • Loading branch information
Baptouuuu committed Jan 16, 2025
2 parents 5c5aa75 + 75dbb40 commit 5d001ad
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 135 deletions.
95 changes: 9 additions & 86 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,92 +4,15 @@ on: [push]

jobs:
blackbox:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.2', '8.3']
dependency-versions: ['lowest', 'highest']
name: 'BlackBox'
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v3"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: BlackBox
run: php blackbox.php
env:
BLACKBOX_SET_SIZE: 20
uses: innmind/github-workflows/.github/workflows/black-box-matrix.yml@main
with:
scenarii: 20
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.2', '8.3']
dependency-versions: ['lowest', 'highest']
name: 'Coverage'
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v3"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: BlackBox
run: php blackbox.php
env:
ENABLE_COVERAGE: 'true'
BLACKBOX_SET_SIZE: 1
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
uses: innmind/github-workflows/.github/workflows/coverage-matrix.yml@main
secrets: inherit
psalm:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2', '8.3']
name: 'Psalm'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v3"
- name: Psalm
run: vendor/bin/psalm --shepherd
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
cs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2']
name: 'CS'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v3"
- name: CS
run: vendor/bin/php-cs-fixer fix --diff --dry-run
uses: innmind/github-workflows/.github/workflows/cs.yml@main
with:
php-version: '8.2'
21 changes: 2 additions & 19 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,5 @@ permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
uses: innmind/github-workflows/.github/workflows/documentation.yml@main
secrets: inherit
16 changes: 2 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@ on:
tags:
- '*'

permissions:
contents: write

jobs:
release:
name: Create release
runs-on: ubuntu-22.04
steps:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--generate-notes
uses: innmind/github-workflows/.github/workflows/release.yml@main
secrets: inherit
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 5.11.1 - 2025-01-16

### Fixed

- Support for PHP `8.4`

## 5.11.0 - 2024-12-01

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
"require-dev": {
"vimeo/psalm": "~5.6",
"vimeo/psalm": "~5.6|dev-master",
"innmind/black-box": "^5.5.1",
"innmind/coding-standard": "~2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion fixtures/Sequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class Sequence
*
* @return Set<Structure<I>>
*/
public static function of(Set $set, Set\Integers $sizes = null): Set
public static function of(Set $set, ?Set\Integers $sizes = null): Set
{
// this is not optimal but it allows to avoid a BC break
$sizes ??= Set\Integers::between(0, 100);
Expand Down
2 changes: 1 addition & 1 deletion fixtures/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class Set
*
* @return Set<Structure<I>>
*/
public static function of(DataSet $set, DataSet\Integers $sizes = null): DataSet
public static function of(DataSet $set, ?DataSet\Integers $sizes = null): DataSet
{
// this is not optimal but it allows to avoid a BC break
$sizes ??= DataSet\Integers::between(0, 100);
Expand Down
1 change: 1 addition & 0 deletions src/Accumulate.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function current(): mixed
/** @psalm-suppress UnusedMethodCall */
$this->pop();

/** @var S */
return \current($this->values);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Map/DoubleIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class DoubleIndex implements Implementation
/**
* @param Sequence\Implementation<Pair<T, S>> $pairs
*/
public function __construct(Sequence\Implementation $pairs = null)
public function __construct(?Sequence\Implementation $pairs = null)
{
/** @var Sequence\Implementation<Pair<T, S>> */
$this->pairs = $pairs ?? new Sequence\Primitive;
Expand Down
2 changes: 1 addition & 1 deletion src/Map/ObjectKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class ObjectKeys implements Implementation
{
private \SplObjectStorage $values;

public function __construct(\SplObjectStorage $values = null)
public function __construct(?\SplObjectStorage $values = null)
{
$this->values = $values ?? new \SplObjectStorage;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Monoid/Append.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class Append implements Monoid
*
* @return self<C>
*/
public static function of(string $class = null): self
public static function of(?string $class = null): self
{
/** @var self<C> */
return new self;
Expand Down
2 changes: 1 addition & 1 deletion src/Monoid/MergeMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class MergeMap implements Monoid
*
* @return self<A, B>
*/
public static function of(string $key = null, string $value = null): self
public static function of(?string $key = null, ?string $value = null): self
{
/** @var self<A, B> */
return new self;
Expand Down
2 changes: 1 addition & 1 deletion src/Monoid/MergeSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class MergeSet implements Monoid
*
* @return self<C>
*/
public static function of(string $class = null): self
public static function of(?string $class = null): self
{
/** @var self<C> */
return new self;
Expand Down
5 changes: 4 additions & 1 deletion src/Sequence/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public function __invoke(callable $map): \Generator

/** @psalm-suppress ImpureMethodCall */
while ($this->values->valid()) {
/** @psalm-suppress ImpureFunctionCall */
/**
* @psalm-suppress PossiblyNullArgument
* @psalm-suppress ImpureFunctionCall
*/
$aggregate = $this->walk($map($n2, $n1), $void);

foreach ($aggregate as $element) {
Expand Down
1 change: 1 addition & 0 deletions src/Sequence/Lazy.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ public function dropWhile(callable $condition): self
/**
* @psalm-suppress ImpureMethodCall
* @psalm-suppress ImpureFunctionCall
* @psalm-suppress PossiblyNullArgument
*/
if (!$condition($generator->current())) {
/** @psalm-suppress ImpureMethodCall */
Expand Down
1 change: 1 addition & 0 deletions src/Sequence/Primitive.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ public function dropWhile(callable $condition): self
/**
* @psalm-suppress ImpureMethodCall
* @psalm-suppress ImpureFunctionCall
* @psalm-suppress PossiblyNullArgument
*/
if (!$condition($iterator->current())) {
/** @psalm-suppress ImpureMethodCall */
Expand Down
22 changes: 15 additions & 7 deletions src/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class Str implements \Stringable
private string $value;
private Str\Encoding $encoding;

private function __construct(string $value, Str\Encoding $encoding = null)
private function __construct(string $value, ?Str\Encoding $encoding = null)
{
$this->value = $value;
$this->encoding = $encoding ?? Str\Encoding::utf8;
Expand All @@ -27,7 +27,7 @@ public function __toString(): string
/**
* @psalm-pure
*/
public static function of(string $value, Str\Encoding $encoding = null): self
public static function of(string $value, ?Str\Encoding $encoding = null): self
{
return new self($value, $encoding);
}
Expand Down Expand Up @@ -75,7 +75,7 @@ public function maybe(callable $filter): Maybe
*
* @return Sequence<self>
*/
public function split(string $delimiter = null): Sequence
public function split(?string $delimiter = null): Sequence
{
if (\is_null($delimiter) || $delimiter === '') {
return $this->chunk();
Expand Down Expand Up @@ -279,12 +279,20 @@ public function words(string|\Stringable $charlist = ''): Map
/**
* Split the string using a regular expression
*
* @throws InvalidRegex If the split didn't work
*
* @return Sequence<self>
*/
public function pregSplit(string|\Stringable $regex, int $limit = -1): Sequence
{
/** @psalm-suppress ArgumentTypeCoercion */
$strings = \preg_split((string) $regex, $this->value, $limit);

if ($strings === false) {
/** @psalm-suppress ImpureFunctionCall */
throw new InvalidRegex('', \preg_last_error());
}

/** @var Sequence<self> */
$sequence = Sequence::of();

Expand Down Expand Up @@ -348,7 +356,7 @@ public function pregReplace(
*
* @param 0|positive-int $length
*/
public function substring(int $start, int $length = null): self
public function substring(int $start, ?int $length = null): self
{
if ($this->empty()) {
return $this;
Expand Down Expand Up @@ -462,7 +470,7 @@ public function equals(self $string): bool
/**
* Trim the string
*/
public function trim(string $mask = null): self
public function trim(?string $mask = null): self
{
return new self(
$mask === null ? \trim($this->value) : \trim($this->value, $mask),
Expand All @@ -473,7 +481,7 @@ public function trim(string $mask = null): self
/**
* Trim the right side of the string
*/
public function rightTrim(string $mask = null): self
public function rightTrim(?string $mask = null): self
{
return new self(
$mask === null ? \rtrim($this->value) : \rtrim($this->value, $mask),
Expand All @@ -484,7 +492,7 @@ public function rightTrim(string $mask = null): self
/**
* Trim the left side of the string
*/
public function leftTrim(string $mask = null): self
public function leftTrim(?string $mask = null): self
{
return new self(
$mask === null ? \ltrim($this->value) : \ltrim($this->value, $mask),
Expand Down

0 comments on commit 5d001ad

Please sign in to comment.