Skip to content

Commit 76d842c

Browse files
authored
Release/1.3.1 (#21)
* fix: Fixes execution of composer scripts and updates dependencies.
1 parent f899846 commit 76d842c

File tree

10 files changed

+59
-37
lines changed

10 files changed

+59
-37
lines changed

.github/workflows/auto-assign.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
name: Auto assign issues
1+
name: Auto assign issues and pull requests
22

33
on:
44
issues:
55
types:
66
- opened
7+
pull_request:
8+
types:
9+
- opened
710

811
jobs:
912
run:
@@ -12,11 +15,11 @@ jobs:
1215
issues: write
1316
pull-requests: write
1417
steps:
15-
- name: Assign issues
16-
uses: gustavofreze/auto-assign@1.0.0
18+
- name: Assign issues and pull requests
19+
uses: gustavofreze/auto-assign@1.1.4
1720
with:
1821
assignees: '${{ secrets.ASSIGNEES }}'
1922
github_token: '${{ secrets.GITHUB_TOKEN }}'
2023
allow_self_assign: 'true'
2124
allow_no_assignees: 'true'
22-
assignment_options: 'ISSUE'
25+
assignment_options: 'ISSUE,PULL_REQUEST'

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: CI
22

33
on:
4-
push:
54
pull_request:
65

76
permissions:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022-2024 Tiny Blocks
3+
Copyright (c) 2022-2025 Tiny Blocks
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
DOCKER_RUN = docker run --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.3
1+
ifeq ($(OS),Windows_NT)
2+
PWD := $(shell cd)
3+
else
4+
PWD := $(shell pwd -L)
5+
endif
6+
7+
ARCH := $(shell uname -m)
8+
PLATFORM :=
9+
10+
ifeq ($(ARCH),arm64)
11+
PLATFORM := --platform=linux/amd64
12+
endif
13+
14+
DOCKER_RUN = docker run ${PLATFORM} --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.3
215

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

@@ -9,7 +22,7 @@ test:
922
@${DOCKER_RUN} composer tests
1023

1124
test-file:
12-
@${DOCKER_RUN} composer tests-file-no-coverage ${FILE}
25+
@${DOCKER_RUN} composer test-file ${FILE}
1326

1427
test-no-coverage:
1528
@${DOCKER_RUN} composer tests-no-coverage
@@ -22,4 +35,4 @@ show-reports:
2235

2336
clean:
2437
@sudo chown -R ${USER}:${USER} ${PWD}
25-
@rm -rf report vendor .phpunit.cache
38+
@rm -rf report vendor .phpunit.cache *.lock

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,17 @@ Ksuid::fromTimestamp(value: 286235327);
5959
You can inspect the components used to create a `Ksuid`, using the `inspectFrom` method.
6060

6161
```php
62-
$ksuid = Ksuid::inspectFrom(ksuid: '2QzPUGEaAKHhVcQYrqQodbiZat1'); # Array
63-
# (
64-
# [time] => 2023-06-09 20:30:50 -0300 -03
65-
# [payload] => 464932c1194da98e752145d72b8f0aab
66-
# [timestamp] => 286353450
67-
# )
62+
$ksuid = Ksuid::inspectFrom(ksuid: '2QzPUGEaAKHhVcQYrqQodbiZat1');
63+
```
64+
65+
This will output the following array:
66+
67+
```php
68+
[
69+
'time' => '2023-06-09 20:30:50 -0300 -03',
70+
'payload' => '464932c1194da98e752145d72b8f0aab',
71+
'timestamp' => 286353450
72+
]
6873
```
6974

7075
<div id='license'></div>

composer.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,24 @@
5555
"ext-bcmath": "Enables the extension which is an interface to the GNU implementation as a Basic Calculator utility library."
5656
},
5757
"scripts": {
58+
"test": "phpunit --configuration phpunit.xml tests",
5859
"phpcs": "phpcs --standard=PSR12 --extensions=php ./src",
5960
"phpmd": "phpmd ./src text phpmd.xml --suffixes php --ignore-violations-on-exit",
6061
"phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
61-
"test": "phpunit --log-junit=report/coverage/junit.xml --coverage-xml=report/coverage/coverage-xml --coverage-html=report/coverage/coverage-html tests",
62-
"test-mutation": "infection --only-covered --logger-html=report/coverage/mutation-report.html --coverage=report/coverage --min-msi=100 --min-covered-msi=100 --threads=4",
63-
"test-no-coverage": "phpunit --no-coverage",
64-
"test-mutation-no-coverage": "infection --only-covered --min-msi=100 --threads=4",
62+
"test-file": "phpunit --configuration phpunit.xml --no-coverage --filter",
63+
"mutation-test": "infection --only-covered --threads=max --logger-html=report/coverage/mutation-report.html --coverage=report/coverage",
64+
"test-no-coverage": "phpunit --configuration phpunit.xml --no-coverage tests",
6565
"review": [
6666
"@phpcs",
6767
"@phpmd",
6868
"@phpstan"
6969
],
7070
"tests": [
7171
"@test",
72-
"@test-mutation"
72+
"@mutation-test"
7373
],
7474
"tests-no-coverage": [
75-
"@test-no-coverage",
76-
"@test-mutation-no-coverage"
75+
"@test-no-coverage"
7776
]
7877
}
7978
}

infection.json.dist

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
{
2-
"timeout": 10,
3-
"testFramework": "phpunit",
2+
"logs": {
3+
"text": "report/infection/logs/infection-text.log",
4+
"summary": "report/infection/logs/infection-summary.log"
5+
},
46
"tmpDir": "report/infection/",
7+
"minMsi": 100,
8+
"timeout": 30,
59
"source": {
610
"directories": [
711
"src"
812
]
913
},
10-
"logs": {
11-
"text": "report/infection/logs/infection-text.log",
12-
"summary": "report/infection/logs/infection-summary.log"
14+
"phpUnit": {
15+
"configDir": "",
16+
"customPath": "./vendor/bin/phpunit"
1317
},
1418
"mutators": {
1519
"@default": true,
16-
"Minus": false,
1720
"CastArray": false
1821
},
19-
"phpUnit": {
20-
"configDir": "",
21-
"customPath": "./vendor/bin/phpunit"
22-
}
22+
"minCoveredMsi": 100,
23+
"testFramework": "phpunit"
2324
}

phpunit.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
failOnRisky="true"
77
failOnWarning="true"
88
cacheDirectory=".phpunit.cache"
9+
executionOrder="random"
910
beStrictAboutOutputDuringTests="true">
1011

1112
<source>
@@ -22,14 +23,15 @@
2223

2324
<coverage>
2425
<report>
26+
<xml outputDirectory="report/coverage/coverage-xml"/>
27+
<html outputDirectory="report/coverage/coverage-html"/>
2528
<text outputFile="report/coverage.txt"/>
26-
<html outputDirectory="report/html/"/>
2729
<clover outputFile="report/coverage-clover.xml"/>
2830
</report>
2931
</coverage>
3032

3133
<logging>
32-
<junit outputFile="report/execution-result.xml"/>
34+
<junit outputFile="report/coverage/junit.xml"/>
3335
</logging>
3436

3537
</phpunit>

src/Internal/Timestamp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public static function fromBytes(string $value): Timestamp
3232
return new Timestamp(value: $timestamp['uint']);
3333
}
3434

35-
public static function fromAdjustedCurrentTime(): Timestamp
35+
public static function fromCurrentTime(): Timestamp
3636
{
37-
return new Timestamp(value: time() - self::EPOCH);
37+
return new Timestamp(value: time());
3838
}
3939

4040
public function getValue(): int

src/Ksuid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private function __construct(private Payload $payload, private Timestamp $timest
1919

2020
public static function random(): Ksuid
2121
{
22-
return new Ksuid(payload: Payload::random(), timestamp: Timestamp::fromAdjustedCurrentTime());
22+
return new Ksuid(payload: Payload::random(), timestamp: Timestamp::fromCurrentTime());
2323
}
2424

2525
public static function from(string $payload, int $timestamp): Ksuid

0 commit comments

Comments
 (0)