Skip to content

Commit 2f14ee0

Browse files
authored
Merge pull request #21 from ker0x/3.x
Full package refactoring
2 parents e3e804e + 65da2a0 commit 2f14ee0

File tree

76 files changed

+1155
-3108
lines changed

Some content is hidden

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

76 files changed

+1155
-3108
lines changed

.gitattributes

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
# Path-based git attributes
2-
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3-
4-
# Ignore all test and documentation with "export-ignore".
5-
/.github export-ignore
6-
/tests export-ignore
7-
/.editorconfig export-ignore
8-
/.gitattributes export-ignore
9-
/.gitignore export-ignore
10-
/.php_cs.dist export-ignore
11-
/phpunit.xml.dist export-ignore
1+
/.github export-ignore
2+
/tests export-ignore
3+
/.editorconfig export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.php-cs-fixer.dist.php export-ignore
7+
/phpstan.neon.dis export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/rector.php export-ignore

.github/workflows/ci.yml

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,54 @@
11
name: ci
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
75
branches: [ main ]
86

97
jobs:
10-
build:
8+
tests:
119

1210
runs-on: ubuntu-latest
1311

14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
php-version: [ '7.4', '8.0' ]
18-
allow-failure: [ false ]
19-
coverage: [ false ]
20-
composer-flags: [ '' ]
21-
include:
22-
- php-version: '7.3'
23-
coverage: true
24-
- php-version: '8.1'
25-
allow-failure: true
26-
composer-flags: '--ignore-platform-req php'
27-
2812
steps:
29-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
3014

3115
- name: php-setup
3216
uses: shivammathur/setup-php@v2
3317
with:
34-
php-version: ${{ matrix.php-version }}
18+
php-version: '8.2'
19+
coverage: xdebug
20+
extensions: xdebug
3521

3622
- name: composer-validate
3723
run: composer validate
3824

3925
- name: composer-cache
4026
id: composer-cache
41-
uses: actions/cache@v2
27+
uses: actions/cache@v3
4228
with:
4329
path: vendor
4430
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
4531
restore-keys: |
4632
${{ runner.os }}-${{ matrix.php-version }}-composer-
33+
4734
- name: composer-install
4835
if: steps.composer-cache.outputs.cache-hit != 'true'
49-
run: composer install --prefer-dist --no-progress --no-suggest ${{ matrix.composer-flags }}
50-
51-
- name: phpstan
52-
run: vendor/bin/phpstan --level=max --memory-limit="-1" --no-progress analyze
36+
run: composer install --prefer-dist --no-progress --no-interaction
5337

5438
- name: php-cs-fixer
55-
continue-on-error: ${{ matrix.allow-failure }}
56-
env:
57-
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.allow-failure }}
58-
run: vendor/bin/php-cs-fixer fix --dry-run --diff --verbose --config=.php_cs.dist
39+
run: vendor/bin/php-cs-fixer fix --dry-run --diff --verbose --ansi
40+
41+
- name: phpstan
42+
run: vendor/bin/phpstan analyse --memory-limit 256M
5943

6044
- name: phpunit
61-
run: vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml
45+
env:
46+
FCM_OAUTH_TOKEN: ${{ secrets.FCM_OAUTH_TOKEN }}
47+
FCM_PROJECT_ID: ${{ secrets.FCM_PROJECT_ID }}
48+
run: vendor/bin/phpunit
6249

6350
- name: coverage
64-
if: ${{ matrix.coverage }}
65-
uses: codecov/codecov-action@v1
51+
uses: codecov/codecov-action@v3
6652
with:
6753
token: ${{ secrets.CODECOV_TOKEN }}
68-
directory: ./build
54+
files: ./.coverage/coverage.xml

.gitignore

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
build/
2-
vendor/
1+
/.coverage/
2+
/.phpunit.cache/
3+
/vendor/
4+
.php-cs-fixer.cache
35
composer.lock
4-
.php_cs
5-
.php_cs.cache
6-
.phpunit.result.cache
7-
phpunit.xml

.php-cs-fixer.dist.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
;
6+
7+
return (new PhpCsFixer\Config())
8+
->setRules([
9+
'@Symfony' => true,
10+
'@Symfony:risky' => true,
11+
'declare_strict_types' => true,
12+
])
13+
->setRiskyAllowed(true)
14+
->setFinder($finder)
15+
;

.php_cs.dist

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Tests](https://img.shields.io/github/actions/workflow/status/ker0x/fcm/ci.yml?label=tests&style=for-the-badge)](https://github.com/ker0x/fcm/actions/workflows/ci.yml)
22
[![Coverage](https://img.shields.io/codecov/c/gh/ker0x/fcm?style=for-the-badge)](https://codecov.io/gh/ker0x/fcm/)
3-
![PHP Version](https://img.shields.io/badge/php->=7.3-4f5b93.svg?style=for-the-badge)
3+
![PHP Version](https://img.shields.io/badge/php->=8.2-4f5b93.svg?style=for-the-badge)
44
[![Download](https://img.shields.io/packagist/dt/kerox/fcm.svg?style=for-the-badge)](https://packagist.org/packages/kerox/fcm)
55
[![Packagist](https://img.shields.io/packagist/v/kerox/fcm.svg?style=for-the-badge)](https://packagist.org/packages/kerox/fcm)
66
[![License](https://img.shields.io/github/license/talesfromadev/flowbite-bundle?style=for-the-badge)](https://github.com/ker0x/fcm/blob/main/LICENSE)

composer.json

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,34 @@
1414
{
1515
"name": "Romain Monteil",
1616
"email": "monteil.romain@gmail.com",
17-
"homepage": "https://kerox.fr",
17+
"homepage": "https://talesfroma.dev",
1818
"role": "Author"
1919
}
2020
],
2121
"require": {
22-
"php": ">=7.3.0",
23-
"ext-json": "*",
24-
"guzzlehttp/guzzle": "^7.2"
22+
"php": ">=8.2",
23+
"fig/http-message-util": "^1.1",
24+
"php-http/discovery": "^1.18",
25+
"psr/http-client": "^1.0",
26+
"psr/http-client-implementation": "*",
27+
"psr/http-factory-implementation": "*",
28+
"symfony/property-access": "^6.2",
29+
"symfony/serializer": "^6.2"
2530
},
2631
"require-dev": {
27-
"friendsofphp/php-cs-fixer": "^2.5",
28-
"phpstan/phpstan": "^0.12",
29-
"phpunit/phpunit": "^8.0"
32+
"friendsofphp/php-cs-fixer": "^3.16",
33+
"nyholm/psr7": "^1.8",
34+
"phpstan/phpstan": "^1.10",
35+
"phpunit/phpunit": "^10.1",
36+
"rector/rector": "^0.16.0",
37+
"symfony/http-client": "^6.2"
3038
},
3139
"config": {
3240
"optimize-autoloader": true,
33-
"sort-packages": true
41+
"sort-packages": true,
42+
"allow-plugins": {
43+
"php-http/discovery": false
44+
}
3445
},
3546
"autoload": {
3647
"psr-4": {
@@ -43,8 +54,9 @@
4354
}
4455
},
4556
"scripts": {
46-
"php-cs-fixer": "vendor/bin/php-cs-fixer fix --diff --verbose --config=.php_cs",
47-
"phpstan": "vendor/bin/phpstan --level=max --memory-limit=\"-1\" --no-progress analyze",
48-
"phpunit": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
57+
"php-cs-fixer": "vendor/bin/php-cs-fixer fix --diff --verbose --ansi",
58+
"phpstan": "vendor/bin/phpstan",
59+
"phpunit": "vendor/bin/phpunit",
60+
"rector": "vendor/bin/rector process src"
4961
}
5062
}

phpstan.neon

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

phpstan.neon.dist

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

phpunit.xml.dist

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
2-
<phpunit processIsolation="false"
3-
stopOnFailure="false"
4-
bootstrap="vendor/autoload.php">
5-
<testsuites>
6-
<testsuite name="Fcm Test Suite">
7-
<directory>./tests</directory>
8-
</testsuite>
9-
</testsuites>
10-
11-
<filter>
12-
<whitelist processUncoveredFilesFromWhitelist="true">
13-
<directory suffix=".php">./src</directory>
14-
</whitelist>
15-
</filter>
16-
17-
<logging>
18-
<log type="coverage-clover" target="build/logs/clover.xml"/>
19-
</logging>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" bootstrap="vendor/autoload.php" cacheDirectory=".phpunit.cache" executionOrder="depends,defects" requireCoverageMetadata="false" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true" testdox="true">
3+
<testsuites>
4+
<testsuite name="default">
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage>
9+
<report>
10+
<clover outputFile=".coverage/coverage.xml"/>
11+
<html outputDirectory=".coverage/html/"/>
12+
</report>
13+
</coverage>
14+
<source>
15+
<include>
16+
<directory suffix=".php">src</directory>
17+
</include>
18+
</source>
2019
</phpunit>

0 commit comments

Comments
 (0)