Skip to content

Commit f40346c

Browse files
committed
v1.6.0 released
1 parent f4a524e commit f40346c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+887
-649
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.github export-ignore
2+
/tests export-ignore
3+
/phpunit.xml.dist export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.php-cs-fixer.dist.php export-ignore
7+
/psalm.xml export-ignore
8+
9+
*.php diff=php

.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: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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
49+
50+
- name: Coverage report
51+
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover coverage.xml
52+
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}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
vendor/
1+
.idea
2+
vendor
23
composer.lock
34
.phpunit.result.cache
5+
.php-cs-fixer.cache
6+
test-coverage-report
7+
phpunit.xml
8+
coverage/
9+
.php-cs-fixer.php
10+
phpstan.neon

.php-cs-fixer.dist.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
'array_indentation' => true,
18+
'array_syntax' => ['syntax' => 'short'],
19+
'combine_consecutive_unsets' => true,
20+
'declare_strict_types' => true,
21+
'dir_constant' => true,
22+
'fully_qualified_strict_types' => true,
23+
'linebreak_after_opening_tag' => true,
24+
'mb_str_functions' => true,
25+
'modernize_types_casting' => true,
26+
'no_alternative_syntax' => true,
27+
'no_null_property_initialization' => true,
28+
'no_php4_constructor' => true,
29+
'no_superfluous_elseif' => true,
30+
'no_unreachable_default_argument_value' => true,
31+
'no_useless_else' => true,
32+
'no_useless_return' => true,
33+
'ordered_class_elements' => true,
34+
'ordered_imports' => true,
35+
'phpdoc_order' => true,
36+
'phpdoc_to_comment' => false,
37+
'phpdoc_types_order' => [
38+
'null_adjustment' => 'always_last',
39+
'sort_algorithm' => 'none'
40+
],
41+
'php_unit_set_up_tear_down_visibility' => true,
42+
'pow_to_exponentiation' => true,
43+
'semicolon_after_instruction' => true,
44+
'ternary_to_null_coalescing' => true,
45+
'method_argument_space' => [
46+
'keep_multiple_spaces_after_comma' => true,
47+
'on_multiline' => 'ensure_fully_multiline',
48+
'after_heredoc' => true,
49+
],
50+
'phpdoc_annotation_without_dot' => false,
51+
'phpdoc_var_without_name' => false,
52+
'phpdoc_trim' => true,
53+
'no_superfluous_phpdoc_tags' => false,
54+
'single_line_throw' => true,
55+
'header_comment' => [
56+
'header' => <<<EOF
57+
This file is part of the Micro framework package.
58+
59+
(c) Stanislau Komar <[email protected]>
60+
61+
For the full copyright and license information, please view the LICENSE
62+
file that was distributed with this source code.
63+
EOF
64+
]
65+
))
66+
->setRiskyAllowed(true)
67+
->setFinder($finder);

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Micro Framework
2+
3+
Documentation is available [here](https://micro-php.net/docs). If not, we will be grateful if you can become its author :)

composer.json

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,60 @@
11
{
22
"name": "micro/plugin-redis",
33
"description": "Micro Framework: Redis component",
4-
"type": "library",
54
"license": "MIT",
6-
"version": "1.0",
7-
"autoload": {
8-
"psr-4": {
9-
"Micro\\Plugin\\Redis\\": "src/"
10-
}
11-
},
5+
"type": "micro-plugin",
126
"authors": [
137
{
148
"name": "Stanislau.Komar",
159
"email": "[email protected]"
1610
}
1711
],
1812
"require": {
19-
"micro/kernel": "^1"
13+
"ext-redis": "*",
14+
"micro/kernel-app": "^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"
23+
},
24+
"autoload": {
25+
"psr-4": {
26+
"Micro\\Plugin\\Redis\\": "src/"
27+
}
28+
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"Micro\\Plugin\\Cache\\Test\\Unit\\": "tests/Unit"
32+
}
33+
},
34+
"config": {
35+
"allow-plugins": {
36+
"ergebnis/composer-normalize": true
37+
},
38+
"sort-packages": true
39+
},
40+
"scripts": {
41+
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text",
42+
"coverage-html": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html ./test-coverage-report",
43+
"php-cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --using-cache=no",
44+
"php-cs-try": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no",
45+
"phpstan": "./vendor/bin/phpstan analyze --no-progress",
46+
"phpunit": "./vendor/bin/phpunit",
47+
"psalm": "./vendor/bin/psalm --no-progress --show-info=true --no-cache",
48+
"statics": [
49+
"@phpstan",
50+
"@psalm",
51+
"@php-cs-try"
52+
],
53+
"test": [
54+
"@statics",
55+
"composer validate --strict",
56+
"composer normalize",
57+
"@coverage"
58+
]
2059
}
2160
}

phpcs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<rule ref="Generic.Files.LineLength">
1919
<properties>
2020
<property name="lineLimit" value="120"/>
21-
<property name="absoluteLineLimit" value="150"/>
21+
<property name="absoluteLineLimit" value="140"/>
2222
</properties>
2323
</rule>
2424
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>

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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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/Unit</directory>
17+
</testsuite>
18+
</testsuites>
19+
<filter>
20+
<whitelist>
21+
<directory suffix=".php">src/</directory>
22+
</whitelist>
23+
</filter>
24+
<coverage>
25+
<include>
26+
<directory suffix=".php">src</directory>
27+
</include>
28+
<report>
29+
<html outputDirectory="test-coverage-report/" />
30+
</report>
31+
</coverage>
32+
33+
<logging>
34+
<log type="coverage-clover" target="coverage/clover.xml"/>
35+
</logging>
36+
37+
</phpunit>

0 commit comments

Comments
 (0)