Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit 7995e04

Browse files
authored
Merge pull request #5 from petrknap/2-extract-shorts
refactor: refactored via Shorts
2 parents 15503aa + c0b11d0 commit 7995e04

File tree

14 files changed

+60
-1941
lines changed

14 files changed

+60
-1941
lines changed

.github/workflows/docker.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
name: Docker
1+
name: composer ci-script
22

33
on:
44
pull_request:
55

66
jobs:
7-
build-and-run:
7+
run:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v3
1111
- run: docker build -t $GITHUB_REPOSITORY:$GITHUB_SHA .
12-
- run: docker run $GITHUB_REPOSITORY:$GITHUB_SHA composer ci-script
12+
- name: Run composer ci-script
13+
run: docker run $GITHUB_REPOSITORY:$GITHUB_SHA composer ci-script

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Because **it is safer and less scary** than using constants. Don't trust me? Let see at this code:
2121

2222
```php
23-
use PetrKnap\Enum\Test\Readme\MyBoolean;
23+
use PetrKnap\Enum\Readme\MyBoolean;
2424

2525
$isTrue = function (int $myBoolean)
2626
{
@@ -44,7 +44,7 @@ var_dump($isTrue((int) false)); // none
4444
And now the **same code [with enum](./tests/Readme/MyBoolean.php)** instead of constants:
4545

4646
```php
47-
use PetrKnap\Enum\Test\Readme\MyBoolean;
47+
use PetrKnap\Enum\Readme\MyBoolean;
4848

4949
$isTrue = function (MyBoolean $myBoolean): bool
5050
{

bin/build.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
DIR="$(realpath "${BASH_SOURCE%/*}")"
3+
4+
docker build "${DIR}/.." -t petrknap/php-enum:latest

bin/build.bat

100644100755
File mode changed.

bin/run.bash

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
DIR="$(realpath "${BASH_SOURCE%/*}")"
3+
4+
docker run --rm -ti \
5+
-v "${DIR}/..:/app" \
6+
petrknap/php-enum:latest \
7+
$@

bin/run.bat

100644100755
File mode changed.

composer.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
"autoload": {
44
"psr-4": {
55
"PetrKnap\\Enum\\": "src"
6-
},
7-
"files": [
8-
"shorts.php"
9-
]
6+
}
107
},
118
"autoload-dev": {
129
"psr-4": {
13-
"PetrKnap\\Enum\\Test\\": "tests"
10+
"PetrKnap\\Enum\\": "tests"
1411
}
1512
},
13+
"config": {
14+
"allow-plugins": false,
15+
"sort-packages": true
16+
},
1617
"description": "Enumerated type for PHP",
1718
"funding": [
1819
{
@@ -29,12 +30,14 @@
2930
"license": "LGPL-3.0-or-later",
3031
"name": "petrknap/enum",
3132
"require": {
32-
"php": ">=8.0"
33+
"php": ">=8.0",
34+
"petrknap/shorts": "^1.3"
3335
},
3436
"require-dev": {
3537
"phpunit/phpunit": "^9.6",
3638
"squizlabs/php_codesniffer": "^3.7",
37-
"phpstan/phpstan": "^1.10"
39+
"phpstan/phpstan": "^1.10",
40+
"nunomaduro/phpinsights": "^2.9"
3841
},
3942
"scripts": {
4043
"test": [
@@ -43,7 +46,8 @@
4346
"validate": [
4447
"phpcs --colors --standard=PSR12 --exclude=PSR12.Files.OpenTag,PSR12.Files.FileHeader,Generic.Files.LineLength src tests",
4548
"phpstan analyse --level max src",
46-
"phpstan analyse --level 5 tests"
49+
"phpstan analyse --level 5 tests",
50+
"phpinsights analyse src"
4751
],
4852
"ci-script": [
4953
"@validate",

0 commit comments

Comments
 (0)