Skip to content

Commit 48d085f

Browse files
authored
Merge pull request #11 from Micro-PHP/v1.7.0
v1.7.0 Implements plugin autowiring
2 parents 56938c9 + 0a50037 commit 48d085f

File tree

16 files changed

+265
-401
lines changed

16 files changed

+265
-401
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
# normal, highest, non-dev installs
20-
php-version: [ '8.2' ]
20+
php-version: [ '8.4' ]
2121
dependency-versions: [ 'highest' ]
2222
include:
2323
# testing lowest PHP version with the lowest dependencies
2424
# - php-version: '8.2'
2525
# dependency-versions: 'lowest'
2626

2727
# testing dev versions with the highest PHP
28-
- php-version: '8.2'
28+
- php-version: '8.4'
2929
dependency-versions: 'highest'
3030

3131
steps:
@@ -35,7 +35,7 @@ jobs:
3535
- name: "Install PHP"
3636
uses: "shivammathur/setup-php@v2"
3737
with:
38-
coverage: "none"
38+
coverage: "xdebug"
3939
php-version: "${{ matrix.php-version }}"
4040

4141
- name: "Composer install"
@@ -47,12 +47,12 @@ jobs:
4747
- name: Run tests
4848
run: composer run test
4949

50-
- name: Coverage report
51-
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover coverage.xml
50+
# - name: Coverage report
51+
# run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover coverage.xml
5252

53-
- name: Upload coverage reports to Codecov
54-
run: |
55-
# Replace `linux` below with the appropriate OS
56-
curl -Os https://uploader.codecov.io/latest/linux/codecov
57-
chmod +x codecov
58-
./codecov -t ${CODECOV_TOKEN}
53+
# - name: Upload coverage reports to Codecov
54+
# run: |
55+
# # Replace `linux` below with the appropriate OS
56+
# curl -Os https://uploader.codecov.io/latest/linux/codecov
57+
# chmod +x codecov
58+
# ./codecov -t ${CODECOV_TOKEN}

.php-cs-fixer.dist.php

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

composer.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,9 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^8.2",
14-
"micro/dependency-injection": "^1.6"
15-
},
16-
"require-dev": {
17-
"ergebnis/composer-normalize": "^2.29",
18-
"friendsofphp/php-cs-fixer": "^3.13",
19-
"phpstan/phpstan": "^1.9",
20-
"phpunit/php-code-coverage": "^9.2",
21-
"phpunit/phpunit": "^9.5",
22-
"vimeo/psalm": "^5.2"
13+
"php": "^8.4",
14+
"micro/autowire": "^1.6",
15+
"micro/dependency-injection": "^1.7"
2316
},
2417
"autoload": {
2518
"psr-4": {
@@ -33,7 +26,8 @@
3326
},
3427
"config": {
3528
"allow-plugins": {
36-
"ergebnis/composer-normalize": true
29+
"ergebnis/composer-normalize": true,
30+
"micro/testing-tool": true
3731
},
3832
"sort-packages": true
3933
},
@@ -56,5 +50,8 @@
5650
"composer normalize",
5751
"@coverage"
5852
]
53+
},
54+
"require-dev": {
55+
"micro/testing-tool": "^1.7"
5956
}
6057
}

phpcs.xml

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

phpstan.neon.dist

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

phpunit.xml.dist

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

psalm.xml

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

src/AppModeEnum.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Micro framework package.
7+
*
8+
* (c) Stanislau Komar <kost@micro-php.net>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
namespace Micro\Framework\Kernel;
15+
16+
enum AppModeEnum: string
17+
{
18+
case DEV = 'dev';
19+
case TEST = 'test';
20+
case PROD = 'prod';
21+
22+
/**
23+
* @psalm-suppress PossiblyUnusedMethod
24+
*/
25+
public function isDev(): bool
26+
{
27+
return self::DEV === $this;
28+
}
29+
30+
/**
31+
* @psalm-suppress PossiblyUnusedMethod
32+
*/
33+
public function isTest(): bool
34+
{
35+
return self::TEST === $this;
36+
}
37+
38+
public function isProd(): bool
39+
{
40+
return self::PROD === $this;
41+
}
42+
43+
/**
44+
* @psalm-suppress PossiblyUnusedMethod
45+
*/
46+
public static function fromString(string $mode): self
47+
{
48+
$normalized = strtolower($mode);
49+
50+
return match ($normalized) {
51+
'dev', 'development' => self::DEV,
52+
'test' => self::TEST,
53+
'prod', 'production' => self::PROD,
54+
default => throw new \InvalidArgumentException("Unknown app mode: {$mode}"),
55+
};
56+
}
57+
}

0 commit comments

Comments
 (0)