Skip to content

Commit ce26e93

Browse files
authored
Merge pull request #1 from Micro-PHP/feature/plugin-refactor
v1.6.0 rc1
2 parents 72f64fe + 9bc77d1 commit ce26e93

32 files changed

+659
-243
lines changed

.github/workflows/.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[{*.yaml,*.yml}]
2+
indent_size = 2

.github/workflows/ci.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Plugin CI
2+
on:
3+
push:
4+
branches: [ 'master' ]
5+
pull_request:
6+
7+
env:
8+
PHP_CS_FIXER_IGNORE_ENV: 1
9+
XDEBUG_MODE: coverage
10+
11+
jobs:
12+
tests:
13+
name: "Tests ${{ matrix.php-version }} deps ${{ matrix.dependency-versions }}"
14+
runs-on: ubuntu-22.04
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
# normal, highest, non-dev installs
20+
php-version: [ '8.2' ]
21+
dependency-versions: [ 'highest' ]
22+
include:
23+
# testing lowest PHP version with the lowest dependencies
24+
# - php-version: '8.2'
25+
# dependency-versions: 'lowest'
26+
27+
# testing dev versions with the highest PHP
28+
- php-version: '8.2'
29+
dependency-versions: 'highest'
30+
31+
steps:
32+
- name: "Checkout code"
33+
uses: "actions/checkout@v2"
34+
35+
- name: "Install PHP"
36+
uses: "shivammathur/setup-php@v2"
37+
with:
38+
coverage: "none"
39+
php-version: "${{ matrix.php-version }}"
40+
41+
- name: "Composer install"
42+
uses: "ramsey/composer-install@v2"
43+
with:
44+
dependency-versions: "${{ matrix.dependency-versions }}"
45+
composer-options: "--prefer-dist --no-progress"
46+
47+
- name: Run tests
48+
run: composer run test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor/
22
composer.lock
33
.phpunit.result.cache
4+
test-coverage-report

.php-cs-fixer.dist.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
if (!file_exists(__DIR__.'/src')) {
4+
exit(0);
5+
}
6+
7+
$finder = (new PhpCsFixer\Finder())
8+
->in(__DIR__.'/src')
9+
->in(__DIR__.'/tests')
10+
;
11+
12+
return (new PhpCsFixer\Config())
13+
->setRules(array(
14+
'@Symfony' => true,
15+
'@Symfony:risky' => true,
16+
'protected_to_private' => false,
17+
'semicolon_after_instruction' => false,
18+
))
19+
->setRiskyAllowed(true)
20+
->setFinder($finder);

composer.json

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,65 @@
11
{
22
"name": "micro/plugin-serializer",
33
"description": "Micro Framework: Serializer plugin",
4-
"type": "library",
5-
"version": "0.1",
64
"license": "MIT",
7-
"autoload": {
8-
"psr-4": {
9-
"Micro\\Plugin\\Serializer\\": "src/"
10-
}
11-
},
5+
"type": "micro-plugin",
126
"authors": [
137
{
14-
"name": "Stanislau.Komar",
8+
"name": "Stanislau Komar",
159
"email": "stanislau_komar@epam.com"
10+
},
11+
{
12+
"name": "Oleksii Bulba",
13+
"email": "oleksii_bulba@epam.com"
1614
}
1715
],
1816
"require": {
19-
"php": ">=8.0"
17+
"micro/kernel": "^1.6"
18+
},
19+
"require-dev": {
20+
"ergebnis/composer-normalize": "^2.29",
21+
"friendsofphp/php-cs-fixer": "^3.13",
22+
"micro/kernel-app": "^1.6",
23+
"phpstan/phpstan": "^1.9",
24+
"phpunit/php-code-coverage": "^9.2",
25+
"phpunit/phpunit": "^9.5",
26+
"vimeo/psalm": "^5.4"
27+
},
28+
"suggest": {
29+
"micro/plugin-serializer-symfony": "Symfony serializer provider for Micro PHP Framework"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"Micro\\Plugin\\Serializer\\": "src/"
34+
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"Micro\\Plugin\\Serializer\\Test\\": "tests/"
39+
}
40+
},
41+
"config": {
42+
"allow-plugins": {
43+
"ergebnis/composer-normalize": true
44+
}
45+
},
46+
"scripts": {
47+
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text",
48+
"php-cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --using-cache=no",
49+
"php-cs-try": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no",
50+
"phpstan": "./vendor/bin/phpstan analyze --no-progress",
51+
"phpunit": "./vendor/bin/phpunit",
52+
"psalm": "./vendor/bin/psalm --no-progress --show-info=true",
53+
"statics": [
54+
"@phpstan",
55+
"@psalm",
56+
"@php-cs-try"
57+
],
58+
"test": [
59+
"@statics",
60+
"composer validate --strict",
61+
"composer normalize --dry-run",
62+
"@coverage"
63+
]
2064
}
2165
}

phpstan.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 7
3+
paths:
4+
- src

phpunit.xml.dist

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- https://phpunit.readthedocs.io/en/9.5/configuration.html#the-phpunit-element -->
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
5+
backupGlobals="false"
6+
bootstrap="vendor/autoload.php"
7+
colors="true"
8+
failOnRisky="true"
9+
failOnWarning="true"
10+
>
11+
<php>
12+
<ini name="error_reporting" value="-1" force="true"/>
13+
</php>
14+
<testsuites>
15+
<testsuite name="Unit tests">
16+
<directory>tests/</directory>
17+
</testsuite>
18+
</testsuites>
19+
<coverage>
20+
<include>
21+
<directory suffix=".php">src</directory>
22+
</include>
23+
<report>
24+
<html outputDirectory="test-coverage-report/" />
25+
</report>
26+
</coverage>
27+
</phpunit>

psalm.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="7"
4+
resolveFromConfigFile="true"
5+
findUnusedVariablesAndParams="true"
6+
strictBinaryOperands="true"
7+
cacheDirectory="var"
8+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xmlns="https://getpsalm.org/schema/config"
10+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
11+
>
12+
<projectFiles>
13+
<directory name="src" />
14+
</projectFiles>
15+
</psalm>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Micro\Plugin\Serializer\Business\Context;
6+
7+
interface SerializerContextInterface
8+
{
9+
public function getSourceFormat(): ?string;
10+
11+
public function getDestinationFormat(): ?string;
12+
13+
/**
14+
* @return array<string, mixed>
15+
*/
16+
public function getContext(): array;
17+
}

src/Business/MessageSerialized.php

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

0 commit comments

Comments
 (0)