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
22 changes: 11 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
fail-fast: false
matrix:
# normal, highest, non-dev installs
php-version: [ '8.2' ]
php-version: [ '8.4' ]
dependency-versions: [ 'highest' ]
include:
# testing lowest PHP version with the lowest dependencies
# - php-version: '8.2'
# dependency-versions: 'lowest'

# testing dev versions with the highest PHP
- php-version: '8.2'
- php-version: '8.4'
dependency-versions: 'highest'

steps:
Expand All @@ -35,7 +35,7 @@ jobs:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
coverage: "xdebug"
php-version: "${{ matrix.php-version }}"

- name: "Composer install"
Expand All @@ -47,12 +47,12 @@ jobs:
- name: Run tests
run: composer run test

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

- name: Upload coverage reports to Codecov
run: |
# Replace `linux` below with the appropriate OS
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN}
# - name: Upload coverage reports to Codecov
# run: |
# # Replace `linux` below with the appropriate OS
# curl -Os https://uploader.codecov.io/latest/linux/codecov
# chmod +x codecov
# ./codecov -t ${CODECOV_TOKEN}
30 changes: 0 additions & 30 deletions .php-cs-fixer.dist.php

This file was deleted.

19 changes: 8 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,9 @@
}
],
"require": {
"php": "^8.2",
"micro/dependency-injection": "^1.6"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.29",
"friendsofphp/php-cs-fixer": "^3.13",
"phpstan/phpstan": "^1.9",
"phpunit/php-code-coverage": "^9.2",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^5.2"
"php": "^8.4",
"micro/autowire": "^1.6",
"micro/dependency-injection": "^1.7"
},
"autoload": {
"psr-4": {
Expand All @@ -33,7 +26,8 @@
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
"ergebnis/composer-normalize": true,
"micro/testing-tool": true
},
"sort-packages": true
},
Expand All @@ -56,5 +50,8 @@
"composer normalize",
"@coverage"
]
},
"require-dev": {
"micro/testing-tool": "^1.7"
}
}
64 changes: 0 additions & 64 deletions phpcs.xml

This file was deleted.

4 changes: 0 additions & 4 deletions phpstan.neon.dist

This file was deleted.

41 changes: 0 additions & 41 deletions phpunit.xml.dist

This file was deleted.

17 changes: 0 additions & 17 deletions psalm.xml

This file was deleted.

57 changes: 57 additions & 0 deletions src/AppModeEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Micro framework package.
*
* (c) Stanislau Komar <kost@micro-php.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Micro\Framework\Kernel;

enum AppModeEnum: string
{
case DEV = 'dev';
case TEST = 'test';
case PROD = 'prod';

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function isDev(): bool
{
return self::DEV === $this;
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function isTest(): bool
{
return self::TEST === $this;
}

public function isProd(): bool
{
return self::PROD === $this;
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public static function fromString(string $mode): self
{
$normalized = strtolower($mode);

return match ($normalized) {
'dev', 'development' => self::DEV,
'test' => self::TEST,
'prod', 'production' => self::PROD,
default => throw new \InvalidArgumentException("Unknown app mode: {$mode}"),
};
}
}
Loading
Loading