Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Auto assign issues
name: Auto assign issues and pull requests

on:
issues:
types:
- opened
pull_request:
types:
- opened

jobs:
run:
Expand All @@ -12,11 +15,11 @@ jobs:
issues: write
pull-requests: write
steps:
- name: Assign issues
uses: gustavofreze/auto-assign@1.0.0
- name: Assign issues and pull requests
uses: gustavofreze/auto-assign@1.1.4
with:
assignees: '${{ secrets.ASSIGNEES }}'
github_token: '${{ secrets.GITHUB_TOKEN }}'
allow_self_assign: 'true'
allow_no_assignees: 'true'
assignment_options: 'ISSUE'
assignment_options: 'ISSUE,PULL_REQUEST'
32 changes: 13 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,49 @@
name: CI

on:
push:
pull_request:

permissions:
contents: read

env:
PHP_VERSION: '8.3'

jobs:
auto-review:
name: Auto review
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use PHP 8.2
- name: Configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: ${{ env.PHP_VERSION }}

- name: Install dependencies
run: composer update --no-progress --optimize-autoloader

- name: Run phpcs
run: composer phpcs

- name: Run phpmd
run: composer phpmd
- name: Run review
run: composer review

tests:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use PHP 8.2
- name: Use PHP ${{ env.PHP_VERSION }}
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: ${{ env.PHP_VERSION }}

- name: Install dependencies
run: composer update --no-progress --optimize-autoloader

- name: Run unit tests
env:
XDEBUG_MODE: coverage
run: composer test

- name: Run mutation tests
run: composer test-mutation
- name: Run tests
run: composer tests
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2024 Tiny Blocks
Copyright (c) 2022-2025 Tiny Blocks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
DOCKER_RUN = docker run --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.2
ifeq ($(OS),Windows_NT)
PWD := $(shell cd)
else
PWD := $(shell pwd -L)
endif

ARCH := $(shell uname -m)
PLATFORM :=

ifeq ($(ARCH),arm64)
PLATFORM := --platform=linux/amd64
endif

DOCKER_RUN = docker run ${PLATFORM} --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.3

.PHONY: configure test test-file test-no-coverage review show-reports clean

Expand All @@ -9,7 +22,7 @@ test:
@${DOCKER_RUN} composer tests

test-file:
@${DOCKER_RUN} composer tests-file-no-coverage ${FILE}
@${DOCKER_RUN} composer test-file ${FILE}

test-no-coverage:
@${DOCKER_RUN} composer tests-no-coverage
Expand All @@ -22,4 +35,4 @@ show-reports:

clean:
@sudo chown -R ${USER}:${USER} ${PWD}
@rm -rf report vendor .phpunit.cache
@rm -rf report vendor .phpunit.cache *.lock
19 changes: 9 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,34 @@
}
},
"require": {
"php": "^8.2"
"php": "^8.3"
},
"require-dev": {
"phpmd/phpmd": "^2.15",
"phpunit/phpunit": "^11",
"phpstan/phpstan": "^1",
"infection/infection": "^0.29",
"squizlabs/php_codesniffer": "^3.10"
"infection/infection": "^0",
"squizlabs/php_codesniffer": "^3.11"
},
"scripts": {
"test": "phpunit --configuration phpunit.xml tests",
"phpcs": "phpcs --standard=PSR12 --extensions=php ./src",
"phpmd": "phpmd ./src text phpmd.xml --suffixes php --ignore-violations-on-exit",
"phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
"test": "phpunit --log-junit=report/coverage/junit.xml --coverage-xml=report/coverage/coverage-xml --coverage-html=report/coverage/coverage-html tests",
"test-mutation": "infection --only-covered --logger-html=report/coverage/mutation-report.html --coverage=report/coverage --min-msi=100 --min-covered-msi=100 --threads=4",
"test-no-coverage": "phpunit --no-coverage",
"test-mutation-no-coverage": "infection --only-covered --min-msi=100 --threads=4",
"test-file": "phpunit --configuration phpunit.xml --no-coverage --filter",
"mutation-test": "infection --only-covered --threads=max --logger-html=report/coverage/mutation-report.html --coverage=report/coverage",
"test-no-coverage": "phpunit --configuration phpunit.xml --no-coverage tests",
"review": [
"@phpcs",
"@phpmd",
"@phpstan"
],
"tests": [
"@test",
"@test-mutation"
"@mutation-test"
],
"tests-no-coverage": [
"@test-no-coverage",
"@test-mutation-no-coverage"
"@test-no-coverage"
]
}
}
23 changes: 13 additions & 10 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"timeout": 10,
"testFramework": "phpunit",
"logs": {
"text": "report/infection/logs/infection-text.log",
"summary": "report/infection/logs/infection-summary.log"
},
"tmpDir": "report/infection/",
"minMsi": 100,
"timeout": 30,
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "report/infection/logs/infection-text.log",
"summary": "report/infection/logs/infection-summary.log"
},
"mutators": {
"@default": true
},
"phpUnit": {
"configDir": "",
"customPath": "./vendor/bin/phpunit"
}
},
"mutators": {
"@default": true,
"PublicVisibility": false
},
"minCoveredMsi": 100,
"testFramework": "phpunit"
}
6 changes: 4 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
failOnRisky="true"
failOnWarning="true"
cacheDirectory=".phpunit.cache"
executionOrder="random"
beStrictAboutOutputDuringTests="true">

<source>
Expand All @@ -22,14 +23,15 @@

<coverage>
<report>
<xml outputDirectory="report/coverage/coverage-xml"/>
<html outputDirectory="report/coverage/coverage-html"/>
<text outputFile="report/coverage.txt"/>
<html outputDirectory="report/html/"/>
<clover outputFile="report/coverage-clover.xml"/>
</report>
</coverage>

<logging>
<junit outputFile="report/execution-result.xml"/>
<junit outputFile="report/coverage/junit.xml"/>
</logging>

</phpunit>
1 change: 1 addition & 0 deletions src/Internal/Exceptions/CollectionCannotBeChanged.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final class CollectionCannotBeChanged extends ImmutableException
public function __construct(mixed $offset, mixed $value, string $class)
{
$template = 'Cannot modify collection element at offset <%s> with value <%s> in class <%s>.';

parent::__construct(message: $this->withMessage($template, $offset, $value, $class));
}
}
1 change: 1 addition & 0 deletions src/Internal/Exceptions/CollectionCannotBeDeactivated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final class CollectionCannotBeDeactivated extends ImmutableException
public function __construct(mixed $offset, string $class)
{
$template = 'Cannot unset collection element at offset <%s> in class <%s>.';

parent::__construct(message: $this->withMessage($template, $offset, $class));
}
}
1 change: 1 addition & 0 deletions src/Internal/Exceptions/PropertyCannotBeChanged.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final class PropertyCannotBeChanged extends ImmutableException
public function __construct(string $key, mixed $value, string $class)
{
$template = 'Property <%s> with value <%s> cannot be changed in class <%s>.';

parent::__construct(message: $this->withMessage($template, $key, $value, $class));
}
}
1 change: 1 addition & 0 deletions src/Internal/Exceptions/PropertyCannotBeDeactivated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final class PropertyCannotBeDeactivated extends ImmutableException
public function __construct(string $key, string $class)
{
$template = 'Property <%s> cannot be deactivated in class <%s>.';

parent::__construct(message: $this->withMessage($template, $key, $class));
}
}
Loading