Skip to content

Commit 68ed2d2

Browse files
committed
feat: switch to alchemy v2
1 parent 362352f commit 68ed2d2

File tree

9 files changed

+159
-131
lines changed

9 files changed

+159
-131
lines changed

.github/workflows/lint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Lint code
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: true
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
with:
15+
ref: ${{ github.head_ref }}
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '8.2'
21+
extensions: json, zip
22+
tools: composer:v2
23+
coverage: none
24+
25+
- name: Install PHP dependencies
26+
run: composer update --no-interaction --no-progress
27+
28+
- name: Run Linter
29+
run: composer run lint
30+
31+
- name: Commit changes
32+
uses: stefanzweifel/git-auto-commit-action@v4
33+
with:
34+
commit_message: 'chore: fix styling'

.github/workflows/php-cs-fixer.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name: Run Tests
22

3-
on: ['push', 'pull_request']
3+
on: ["push","pull_request"]
44

55
jobs:
6-
ci:
6+
tests:
77
runs-on: ${{ matrix.os }}
88
strategy:
9+
fail-fast: true
910
matrix:
10-
os: [ubuntu-latest, macos-latest, windows-latest]
11-
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
11+
os: ["ubuntu-latest","macos-latest","windows-latest"]
12+
php: ["8.3","8.2","8.1","8.0","7.4"]
1213

1314
name: PHP ${{ matrix.php }} - ${{ matrix.os }}
1415

@@ -27,5 +28,5 @@ jobs:
2728
- name: Install PHP dependencies
2829
run: composer update --no-interaction --no-progress
2930

30-
- name: All Tests
31-
run: php vendor/bin/pest --colors=always --coverage
31+
- name: Run Tests
32+
run: composer run test

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ Thumbs.db
1616
*.swp
1717

1818
# phpstorm
19-
.idea/*
19+
.idea/*
20+
21+
# Alchemy
22+
.alchemy

.php_cs.dist.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

alchemy.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
app:
2+
- src
3+
4+
tests:
5+
engine: pest
6+
parallel: true
7+
paths:
8+
- tests
9+
files:
10+
- '*.test.php'
11+
coverage:
12+
processUncoveredFiles: true
13+
14+
lint:
15+
preset: PSR12
16+
rules:
17+
single_quote: true
18+
phpdoc_scalar: true
19+
no_unused_imports: true
20+
unary_operator_spaces: true
21+
binary_operator_spaces: true
22+
phpdoc_var_without_name: true
23+
trailing_comma_in_multiline: true
24+
phpdoc_single_line_var_spacing: true
25+
single_trait_insert_per_statement: true
26+
not_operator_with_successor_space: false
27+
array_syntax:
28+
syntax: short
29+
ordered_imports:
30+
sort_algorithm: alpha
31+
method_argument_space:
32+
on_multiline: ensure_fully_multiline
33+
keep_multiple_spaces_after_comma: true
34+
blank_line_before_statement:
35+
statements:
36+
- break
37+
- continue
38+
- declare
39+
- return
40+
- throw
41+
- try
42+
43+
actions:
44+
run:
45+
- lint
46+
- tests
47+
os:
48+
- ubuntu-latest
49+
- macos-latest
50+
- windows-latest
51+
php:
52+
extensions: json, zip
53+
versions:
54+
- '8.3'
55+
- '8.2'
56+
- '8.1'
57+
- '8.0'
58+
- '7.4'
59+
events:
60+
- push
61+
- pull_request

composer.json

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,56 @@
11
{
2-
"name": "leafs/leaf",
3-
"description": "Elegant PHP for modern developers",
4-
"keywords": [
5-
"microframework",
6-
"rest",
7-
"router",
8-
"leaf",
9-
"php",
10-
"framework"
11-
],
12-
"homepage": "https://leafphp.dev",
13-
"type": "library",
14-
"license": "MIT",
15-
"authors": [
16-
{
17-
"name": "Michael Darko",
18-
"email": "[email protected]",
19-
"homepage": "https://mychi.netlify.app",
20-
"role": "Developer"
21-
}
22-
],
23-
"autoload": {
24-
"psr-4": {
25-
"Leaf\\": "src"
26-
},
27-
"files": [
28-
"src/functions.php"
29-
]
30-
},
31-
"minimum-stability": "dev",
32-
"prefer-stable": true,
33-
"require": {
34-
"php": "^7.4|^8.0",
35-
"leafs/http": "*",
36-
"leafs/anchor": "*",
37-
"leafs/exception": "*"
38-
},
39-
"require-dev": {
40-
"pestphp/pest": "^1.21",
41-
"friendsofphp/php-cs-fixer": "^3.0"
42-
},
43-
"scripts": {
2+
"name": "leafs/leaf",
3+
"description": "Elegant PHP for modern developers",
4+
"keywords": [
5+
"microframework",
6+
"rest",
7+
"router",
8+
"leaf",
9+
"php",
10+
"framework"
11+
],
12+
"homepage": "https://leafphp.dev",
13+
"type": "library",
14+
"license": "MIT",
15+
"authors": [
16+
{
17+
"name": "Michael Darko",
18+
"email": "[email protected]",
19+
"homepage": "https://mychi.netlify.app",
20+
"role": "Developer"
21+
}
22+
],
23+
"autoload": {
24+
"psr-4": {
25+
"Leaf\\": "src"
26+
},
27+
"files": [
28+
"src/functions.php"
29+
]
30+
},
31+
"minimum-stability": "dev",
32+
"prefer-stable": true,
33+
"require": {
34+
"php": "^7.4|^8.0",
35+
"leafs/http": "*",
36+
"leafs/anchor": "*",
37+
"leafs/exception": "*",
38+
"leafs/alchemy": "dev-next"
39+
},
40+
"scripts": {
4441
"format": "vendor/bin/php-cs-fixer fix --config=.php_cs.dist.php --allow-risky=yes",
45-
"test": "vendor/bin/pest"
42+
"test": "./vendor/bin/alchemy setup --test",
43+
"alchemy": "./vendor/bin/alchemy setup",
44+
"lint": "./vendor/bin/alchemy setup --lint",
45+
"actions": "./vendor/bin/alchemy setup --actions"
46+
},
47+
"config": {
48+
"allow-plugins": {
49+
"pestphp/pest-plugin": true
50+
}
4651
},
47-
"config": {
48-
"allow-plugins": {
49-
"pestphp/pest-plugin": true
50-
}
51-
}
52+
"require-dev": {
53+
"pestphp/pest": "^3.3",
54+
"friendsofphp/php-cs-fixer": "^3.64"
55+
}
5256
}

phpunit.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public static function reset()
216216

217217
protected static function getDiIndex($class)
218218
{
219-
$fullName = \explode("\\", \strtolower(\get_class($class)));
219+
$fullName = \explode('\\', \strtolower(\get_class($class)));
220220
$className = $fullName[\count($fullName) - 1];
221221

222222
return $className;

0 commit comments

Comments
 (0)