Skip to content

Commit

Permalink
Merge pull request #147 from milan-miscevic/skeleton-align
Browse files Browse the repository at this point in the history
Align with future php-skeleton 1.0
  • Loading branch information
milan-miscevic authored Mar 15, 2022
2 parents dd73f36 + 7c498d3 commit e299b2a
Show file tree
Hide file tree
Showing 19 changed files with 815 additions and 719 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab

[*.yml]
indent_size = 2
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2
updates:
- package-ecosystem: composer
- package-ecosystem: "composer"
directory: "/"
open-pull-requests-limit: 10
schedule:
interval: daily
interval: "daily"
time: "04:00"
versioning-strategy: "increase"
90 changes: 0 additions & 90 deletions .github/workflows/build.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "Test"

on:
pull_request:
branches:
- "master"
push:
branches:
- "master"

jobs:
phpstan:
name: "PHPStan static analysis"
runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "8.1"

steps:
- uses: "shivammathur/setup-php@2.9.0"
with:
php-version: "${{ matrix.php-version }}"
- uses: "actions/checkout@v2"
- uses: "php-actions/composer@v1"
- run: "vendor/bin/phpstan analyse"

psalm:
name: "Psalm static analysis"
runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "8.1"

steps:
- uses: "shivammathur/setup-php@2.9.0"
with:
php-version: "${{ matrix.php-version }}"
- uses: "actions/checkout@v2"
- uses: "php-actions/composer@v1"
- run: "vendor/bin/psalm --show-info=true --shepherd"

standards:
name: "PHP-CS-Fixer coding standards"
runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "8.1"

steps:
- uses: "shivammathur/setup-php@2.9.0"
with:
php-version: "${{ matrix.php-version }}"
- uses: "actions/checkout@v2"
- uses: "php-actions/composer@v1"
- run: "vendor/bin/php-cs-fixer fix --dry-run -v"

unit:
name: "PHPUnit unit tests"
runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"

steps:
- uses: "shivammathur/setup-php@2.9.0"
with:
php-version: "${{ matrix.php-version }}"
- uses: "actions/checkout@v2"
- uses: "php-actions/composer@v1"
- run: "vendor/bin/phpunit"
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/.php_cs.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
/.vscode
/infection.log
/phpstan.neon
/phpunit.xml
/vendor
36 changes: 27 additions & 9 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('vendor')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
;

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['align_double_arrow' => null],
'array_syntax' => true,
'binary_operator_spaces' => [
'operators' => [
'=>' => 'single_space',
]
],
'blank_line_after_opening_tag' => true,
'concat_space' => ['spacing' => 'one'],
'concat_space' => [
'spacing' => 'one',
],
'declare_strict_types' => true,
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
],
],
'include' => true,
'method_chaining_indentation' => true,
'modernize_types_casting' => true,
Expand All @@ -25,16 +36,23 @@
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_phpdoc_tags' => [
'remove_inheritdoc' => true,
],
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => true,
'phpdoc_line_span' => ['property' => 'single'],
'return_type_declaration' => ['space_before' => 'none'],
'phpdoc_line_span' => [
'property' => 'single',
],
'return_type_declaration' => [
'space_before' => 'none',
],
'single_blank_line_before_namespace' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
])
->setRiskyAllowed(true)
->setFinder($finder)
Expand Down
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
DOCKER=docker-compose -f ./docker/docker-compose.yml
PHP=php81-cli

coverage:
$(DOCKER) run --rm $(PHP) php -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text

fix:
$(DOCKER) run --rm $(PHP) ./vendor/bin/php-cs-fixer fix

install:
$(DOCKER) build
$(DOCKER) run --rm $(PHP) composer install

mutation:
$(DOCKER) run --rm $(PHP) ./vendor/bin/infection --min-msi=80

phpstan:
$(DOCKER) run --rm $(PHP) ./vendor/bin/phpstan analyse

psalm:
$(DOCKER) run --rm $(PHP) ./vendor/bin/psalm --show-info=true

standards:
$(DOCKER) run --rm $(PHP) ./vendor/bin/php-cs-fixer fix --dry-run -v

test: standards phpstan psalm coverage

unit:
$(DOCKER) run --rm php74-cli ./vendor/bin/phpunit
$(DOCKER) run --rm php80-cli ./vendor/bin/phpunit
$(DOCKER) run --rm $(PHP) ./vendor/bin/phpunit
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
[![Software License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![PDS Skeleton](https://img.shields.io/badge/pds-skeleton-blue.svg?style=flat-square)](https://github.com/php-pds/skeleton)

[![GitHub Build](https://github.com/milan-miscevic/inert/workflows/Build/badge.svg?branch=master)](https://github.com/milan-miscevic/inert/actions)
[![GitHub Build](https://github.com/milan-miscevic/inert/workflows/Test/badge.svg?branch=master)](https://github.com/milan-miscevic/inert/actions)
[![Type Coverage](https://shepherd.dev/github/milan-miscevic/inert/coverage.svg)](https://shepherd.dev/github/milan-miscevic/inert)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=milan-miscevic_inert&metric=alert_status)](https://sonarcloud.io/dashboard?id=milan-miscevic_inert)

This repository provides a mini PHP framework with basic MVC and service container support.

Expand Down
42 changes: 19 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{
"name": "milan-miscevic/inert",
"type": "library",
"description": "Mini PHP framework with basic MVC and service container support",
"license": "MIT",
"type": "library",
"keywords": [
"inert",
"php-framework",
"action",
"action-container",
"controller",
"factory",
"framework",
"inert",
"mini-php-framework",
"mvc",
"service-container",
"basic",
"factory",
"action-container"
"php-framework",
"response",
"service-container"
],
"license": "MIT",
"authors": [
{
"name": "Milan Miščević",
Expand All @@ -23,14 +26,11 @@
"php": "^7.4 || ^8"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19.3",
"infection/infection": "^0.20 || ^0.21",
"phpstan/phpstan": "^1.4.6",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.21"
},
"config": {
"sort-packages": true
"friendsofphp/php-cs-fixer": "^3.7.0",
"infection/infection": "^0.26.6",
"phpstan/phpstan": "^1.4.9",
"phpunit/phpunit": "^9.5.18",
"vimeo/psalm": "^4.22.0"
},
"autoload": {
"psr-4": {
Expand All @@ -42,12 +42,8 @@
"Mmm\\Inert\\Tests\\": "tests/"
}
},
"scripts": {
"coverage": "phpunit --coverage-text",
"fixer": "php-cs-fixer fix",
"infection": "infection",
"phpstan": "phpstan analyse",
"psalm": "psalm --show-info=true",
"unit": "phpunit"
"config": {
"allow-plugins": {},
"sort-packages": true
}
}
Loading

0 comments on commit e299b2a

Please sign in to comment.