Skip to content

Commit

Permalink
Release/3.2.0 (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavofreze authored Oct 5, 2024
1 parent bbebb56 commit e4643e7
Show file tree
Hide file tree
Showing 29 changed files with 451 additions and 228 deletions.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/tests export-ignore
/vendor export-ignore

/LICENSE export-ignore
/Makefile export-ignore
/README.md export-ignore
/phpmd.xml export-ignore
/phpunit.xml export-ignore
/phpstan.neon.dist export-ignore
/infection.json.dist export-ignore

/.github export-ignore
/.gitignore export-ignore
/.gitattributes export-ignore
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
DOCKER_RUN = docker run --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.2

.PHONY: configure test test-no-coverage review show-reports clean
.PHONY: configure test test-file test-no-coverage review show-reports clean

configure:
@${DOCKER_RUN} composer update --optimize-autoloader

test: review
test:
@${DOCKER_RUN} composer tests

test-no-coverage: review
test-file:
@${DOCKER_RUN} composer tests-file-no-coverage ${FILE}

test-no-coverage:
@${DOCKER_RUN} composer tests-no-coverage

review:
Expand All @@ -19,4 +22,4 @@ show-reports:

clean:
@sudo chown -R ${USER}:${USER} ${PWD}
@rm -rf report vendor
@rm -rf report vendor .phpunit.cache
23 changes: 15 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"minimum-stability": "stable",
"keywords": [
"psr",
"psr-4",
"psr-7",
"psr-12",
"http",
"http-code",
"tiny-blocks",
Expand All @@ -24,6 +21,10 @@
"homepage": "https://github.com/gustavofreze"
}
],
"support": {
"issues": "https://github.com/tiny-blocks/http/issues",
"source": "https://github.com/tiny-blocks/http"
},
"config": {
"sort-packages": true,
"allow-plugins": {
Expand All @@ -42,29 +43,32 @@
},
"require": {
"php": "^8.2",
"tiny-blocks/serializer": "^3.0",
"tiny-blocks/serializer": "^3",
"psr/http-message": "^1.1",
"ext-mbstring": "*"
},
"require-dev": {
"infection/infection": "^0.27",
"phpmd/phpmd": "^2.15",
"phpunit/phpunit": "^10.5",
"squizlabs/php_codesniffer": "^3.8"
"phpunit/phpunit": "^11",
"phpstan/phpstan": "^1",
"infection/infection": "^0.29",
"squizlabs/php_codesniffer": "^3.10"
},
"suggest": {
"ext-mbstring": "Provides multibyte-specific string functions that help us deal with multibyte encodings in PHP."
},
"scripts": {
"phpcs": "phpcs --standard=PSR12 --extensions=php ./src",
"phpmd": "phpmd ./src text phpmd.xml --suffixes php --exclude /src/HttpCode.php --exclude /src/Internal/Response --ignore-violations-on-exit",
"phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
"test": "phpunit --log-junit=report/coverage/junit.xml --coverage-xml=report/coverage/coverage-xml --coverage-html=report/coverage/coverage-html tests",
"test-mutation": "infection --only-covered --logger-html=report/coverage/mutation-report.html --coverage=report/coverage --min-msi=100 --min-covered-msi=100 --threads=4",
"test-no-coverage": "phpunit --no-coverage",
"test-mutation-no-coverage": "infection --only-covered --min-msi=100 --threads=4",
"review": [
"@phpcs",
"@phpmd"
"@phpmd",
"@phpstan"
],
"tests": [
"@test",
Expand All @@ -73,6 +77,9 @@
"tests-no-coverage": [
"@test-no-coverage",
"@test-mutation-no-coverage"
],
"tests-file-no-coverage": [
"@test-no-coverage"
]
}
}
25 changes: 14 additions & 11 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
{
"$schema": "vendor/infection/infection/resources/schema.json",
"tmpDir": "report/",
"logs": {
"text": "report/logs/infection-text.log",
"summary": "report/logs/infection-summary.log"
},
"timeout": 10,
"testFramework": "phpunit",
"tmpDir": "report/infection/",
"source": {
"directories": [
"src"
]
},
"timeout": 10,
"logs": {
"text": "report/infection/logs/infection-text.log",
"summary": "report/infection/logs/infection-summary.log"
},
"mutators": {
"@default": true,
"LogicalOr": false,
"InstanceOf_": false,
"UnwrapArrayMap": false,
"CastInt": false,
"CastString": false,
"MatchArmRemoval": false,
"MethodCallRemoval": false
},
"testFramework": "phpunit"
"phpUnit": {
"configDir": "",
"customPath": "./vendor/bin/phpunit"
}
}
11 changes: 11 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
paths:
- src
level: 9
tmpDir: report/phpstan
ignoreErrors:
- '#function fread expects#'
- '#expects object, mixed given#'
- '#expects resource, resource#'
- '#value type specified in iterable#'
reportUnmatchedIgnoredErrors: false
38 changes: 19 additions & 19 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true" processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
failOnRisky="true"
failOnWarning="true"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
beStrictAboutOutputDuringTests="true">

<coverage>
<report>
<clover outputFile="report/coverage-clover.xml"/>
<html outputDirectory="report/html/"/>
<text outputFile="report/coverage.txt"/>
</report>
</coverage>
<source>
<include>
<directory>src</directory>
</include>
</source>

<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage>
<report>
<text outputFile="report/coverage.txt"/>
<html outputDirectory="report/html/"/>
<clover outputFile="report/coverage-clover.xml"/>
</report>
</coverage>

<logging>
<junit outputFile="report/execution-result.xml"/>
</logging>

<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>

</phpunit>
2 changes: 2 additions & 0 deletions src/HttpCode.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http;

use BackedEnum;
Expand Down
2 changes: 2 additions & 0 deletions src/HttpContentType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http;

use TinyBlocks\Http\Internal\Header;
Expand Down
2 changes: 2 additions & 0 deletions src/HttpHeaders.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http;

use TinyBlocks\Http\Internal\Header;
Expand Down
2 changes: 2 additions & 0 deletions src/HttpMethod.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/HttpResponse.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http;

use Psr\Http\Message\ResponseInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Internal/Exceptions/BadMethodCall.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal\Exceptions;

use BadMethodCallException;
Expand Down
15 changes: 15 additions & 0 deletions src/Internal/Exceptions/InvalidResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal\Exceptions;

use RuntimeException;

final class InvalidResource extends RuntimeException
{
public function __construct()
{
parent::__construct(message: 'The provided value is not a valid resource.');
}
}
2 changes: 2 additions & 0 deletions src/Internal/Exceptions/MissingResourceStream.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal\Exceptions;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Internal/Exceptions/NonReadableStream.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal\Exceptions;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Internal/Exceptions/NonSeekableStream.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal\Exceptions;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Internal/Exceptions/NonWritableStream.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal\Exceptions;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Internal/Header.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal;

interface Header
Expand Down
2 changes: 2 additions & 0 deletions src/Internal/Response.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace TinyBlocks\Http\Internal;

use Psr\Http\Message\MessageInterface;
Expand Down
Loading

0 comments on commit e4643e7

Please sign in to comment.