Skip to content

Commit e88515f

Browse files
committed
Revamp repository
It has been four years since I've changed anything in this library, and this commit will make the code more up-to-date. - Configure GitHub actions - Configure integration with Codecov - Configure PHPStan - Remove integration with Scrutinizer - Remove integration with Travis - Upgrade Composer scripts - Upgrade PHPUnit's version - Upgrade Respect's coding standard - Upgrade LICENSE file - Upgrade license headers Because of the new coding standards, there have been some backward compatibility changes, but that's not a problem because it won't change much of the final API. Because of the upgraded packages, I had to drop the support PHP versions before 8.1. Signed-off-by: Henrique Moody <[email protected]>
1 parent 868216d commit e88515f

Some content is hidden

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

48 files changed

+449
-884
lines changed

.docheader

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/*
22
* This file is part of Respect/Stringifier.
3-
*
4-
* (c) Henrique Moody <[email protected]>
5-
*
6-
* For the full copyright and license information, please view the "LICENSE.md"
7-
* file that was distributed with this source code.
3+
* Copyright (c) Henrique Moody <[email protected]>
4+
* SPDX-License-Identifier: MIT
85
*/
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push: ~
5+
pull_request: ~
6+
7+
jobs:
8+
tests:
9+
name: Tests
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
php-version:
16+
- "8.1"
17+
- "8.2"
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
23+
- name: Install PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php-version }}
27+
coverage: none
28+
29+
- name: Install Dependencies
30+
run: composer install --prefer-dist
31+
32+
- name: Run Unit Tests
33+
run: ./vendor/bin/phpunit --testsuite=unit
34+
35+
- name: Run Integration Tests
36+
run: ./vendor/bin/phpunit --testsuite=integration
37+
38+
code-coverage:
39+
name: Code coverage
40+
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v3
46+
47+
- name: Install PHP
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: 8.1
51+
coverage: pcov
52+
53+
- name: Install Dependencies
54+
run: composer install --prefer-dist
55+
56+
- name: Generating Code Coverage Report
57+
run: ./vendor/bin/phpunit --testsuite=unit --coverage-clover=coverage.xml
58+
59+
- name: Send Code Coverage Report to Codecov.io
60+
uses: codecov/codecov-action@v3
61+
62+
static-analysis:
63+
name: Static Analysis
64+
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v3
70+
71+
- name: Install PHP
72+
uses: shivammathur/setup-php@v2
73+
with:
74+
php-version: 8.1
75+
coverage: none
76+
77+
- name: Install dependencies
78+
run: composer install --prefer-dist
79+
80+
- name: Run DocHeader
81+
run: vendor/bin/docheader check src/ tests/
82+
83+
- name: Run PHP_CodeSniffer
84+
run: vendor/bin/phpcs
85+
86+
- name: Run PHPStan
87+
run: vendor/bin/phpstan

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.phpcs.cache
2+
.phpunit.cache
23
composer.lock
34
phpcs.xml
45
phpunit.xml

.scrutinizer.yml

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

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# License
1+
MIT License
22

3-
Copyright (c) [Henrique Moody](http://github.com/henriquemoody).
3+
Copyright (c) Henrique Moody
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
77
in the Software without restriction, including without limitation the rights
88
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is furnished
10-
to do so, subject to the following conditions:
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
1111

1212
The above copyright notice and this permission notice shall be included in all
1313
copies or substantial portions of the Software.
@@ -17,5 +17,5 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Respect\Stringifier
22

3-
[![Build Status](https://img.shields.io/travis/Respect/Stringifier/master.svg?style=flat-square)](http://travis-ci.org/Respect/Stringifier)
4-
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/Respect/Stringifier/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/Respect/Stringifier/?branch=master)
5-
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/Respect/Stringifier/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/Respect/Stringifier/?branch=master)
3+
[![Build Status](https://img.shields.io/github/actions/workflow/status/Respect/Stringifier/continuous-integration.yml?branch=master&style=flat-square)](https://github.com/Respect/Stringifier/actions/workflows/continuous-integration.yml)
4+
[![Code Coverage](https://img.shields.io/codecov/c/github/Respect/Stringifier?style=flat-square)](https://codecov.io/gh/Respect/Stringifier)
65
[![Latest Stable Version](https://img.shields.io/packagist/v/respect/stringifier.svg?style=flat-square)](https://packagist.org/packages/respect/stringifier)
76
[![Total Downloads](https://img.shields.io/packagist/dt/respect/stringifier.svg?style=flat-square)](https://packagist.org/packages/respect/stringifier)
87
[![License](https://img.shields.io/packagist/l/respect/stringifier.svg?style=flat-square)](https://packagist.org/packages/respect/stringifier)
@@ -18,7 +17,7 @@ using [Composer](http://getcomposer.org).
1817
composer require respect/stringifier
1918
```
2019

21-
This library requires PHP >= 7.1.
20+
This library requires PHP >= 8.1.
2221

2322
## Feature Guide
2423

composer.json

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"description": "Converts any value to a string",
44
"keywords": ["respect", "stringifier", "stringify"],
55
"type": "library",
6-
"homepage": "http://respect.github.io/Stringifier/",
76
"license": "MIT",
87
"authors": [
98
{
@@ -12,30 +11,46 @@
1211
}
1312
],
1413
"require": {
15-
"php": ">=7.1"
14+
"php": "^8.1"
1615
},
1716
"require-dev": {
1817
"malukenho/docheader": "^0.1.7",
19-
"phpunit/phpunit": "^6.4",
20-
"respect/coding-standard": "^1.0",
21-
"squizlabs/php_codesniffer": "^3.4"
18+
"phpstan/phpstan": "^1.10",
19+
"phpstan/phpstan-deprecation-rules": "^1.1",
20+
"phpstan/phpstan-phpunit": "^1.3",
21+
"phpstan/phpstan-strict-rules": "^1.5",
22+
"phpunit/phpunit": "^10.0",
23+
"respect/coding-standard": "^4.0",
24+
"squizlabs/php_codesniffer": "^3.7"
2225
},
2326
"autoload": {
2427
"psr-4": {
2528
"Respect\\Stringifier\\": "src/",
26-
"Respect\\Stringifier\\Test\\": "tests/src/"
29+
"Respect\\Stringifier\\Test\\": "tests/src/",
30+
"Respect\\Stringifier\\Test\\Unit\\": "tests/unit"
2731
},
2832
"files": [
2933
"src/stringify.php"
3034
]
3135
},
3236
"scripts": {
3337
"docheader": "vendor/bin/docheader check src/ tests/",
34-
"test": "vendor/bin/phpunit",
35-
"test-unit": "vendor/bin/phpunit --testsuite=unit",
36-
"test-integration": "vendor/bin/phpunit --testsuite=integration"
38+
"phpcs": "vendor/bin/phpcs",
39+
"phpstan": "vendor/bin/phpstan",
40+
"phpunit": "vendor/bin/phpunit",
41+
"phpunit-integration": "vendor/bin/phpunit --testsuite=integration",
42+
"phpunit-unit": "vendor/bin/phpunit --testsuite=unit",
43+
"qa": [
44+
"@docheader",
45+
"@phpcs",
46+
"@phpstan",
47+
"@phpunit"
48+
]
3749
},
3850
"config": {
39-
"sort-packages": true
51+
"sort-packages": true,
52+
"allow-plugins": {
53+
"dealerdirect/phpcodesniffer-composer-installer": true
54+
}
4055
}
4156
}

phpstan.neon.dist

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

phpunit.xml.dist

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
<phpunit bootstrap="vendor/autoload.php"
2-
backupGlobals="false"
3-
backupStaticAttributes="false"
4-
cacheTokens="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
processIsolation="false"
9-
stopOnFailure="false"
10-
syntaxCheck="false"
11-
colors="true"
12-
verbose="true">
13-
<testsuites>
14-
<testsuite name="unit">
15-
<directory suffix="Test.php">tests/unit/</directory>
16-
</testsuite>
17-
<testsuite name="integration">
18-
<directory suffix=".phpt">tests/integration/</directory>
19-
</testsuite>
20-
</testsuites>
21-
<filter>
22-
<whitelist processUncoveredFilesFromWhitelist="true">
23-
<directory>src/</directory>
24-
</whitelist>
25-
</filter>
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
bootstrap="vendor/autoload.php"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
5+
cacheDirectory=".phpunit.cache">
6+
<coverage>
7+
<include>
8+
<directory>src/</directory>
9+
</include>
10+
</coverage>
11+
<testsuites>
12+
<testsuite name="integration">
13+
<directory suffix="Test.php">tests/integration/</directory>
14+
</testsuite>
15+
<testsuite name="unit">
16+
<directory suffix="Test.php">tests/unit/</directory>
17+
</testsuite>
18+
</testsuites>
2619
</phpunit>

0 commit comments

Comments
 (0)