Merge pull request #1253 from acelaya-forks/feature/php8.1

Feature/php8.1
This commit is contained in:
Alejandro Celaya 2021-12-08 17:49:15 +01:00 committed by GitHub
commit 02d5a6f15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 64 deletions

View File

@ -49,7 +49,6 @@ jobs:
strategy:
matrix:
php-version: ['8.0', '8.1']
continue-on-error: ${{ matrix.php-version == '8.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -61,10 +60,7 @@ jobs:
extensions: openswoole-4.8.1
coverage: pcov
ini-values: pcov.directory=module
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- run: composer test:unit:ci
- uses: actions/upload-artifact@v2
if: ${{ matrix.php-version == '8.0' }}
@ -79,7 +75,6 @@ jobs:
strategy:
matrix:
php-version: ['8.0', '8.1']
continue-on-error: ${{ matrix.php-version == '8.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -91,10 +86,7 @@ jobs:
extensions: openswoole-4.8.1
coverage: pcov
ini-values: pcov.directory=module
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- run: composer test:db:sqlite:ci
- uses: actions/upload-artifact@v2
if: ${{ matrix.php-version == '8.0' }}
@ -109,7 +101,6 @@ jobs:
strategy:
matrix:
php-version: ['8.0', '8.1']
continue-on-error: ${{ matrix.php-version == '8.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -122,10 +113,7 @@ jobs:
tools: composer
extensions: openswoole-4.8.1
coverage: none
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- run: composer test:db:mysql
db-tests-maria:
@ -133,7 +121,6 @@ jobs:
strategy:
matrix:
php-version: ['8.0', '8.1']
continue-on-error: ${{ matrix.php-version == '8.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -146,10 +133,7 @@ jobs:
tools: composer
extensions: openswoole-4.8.1
coverage: none
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- run: composer test:db:maria
db-tests-postgres:
@ -157,7 +141,6 @@ jobs:
strategy:
matrix:
php-version: ['8.0', '8.1']
continue-on-error: ${{ matrix.php-version == '8.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -170,10 +153,7 @@ jobs:
tools: composer
extensions: openswoole-4.8.1
coverage: none
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- run: composer test:db:postgres
db-tests-ms:
@ -181,7 +161,6 @@ jobs:
strategy:
matrix:
php-version: ['8.0', '8.1']
continue-on-error: ${{ matrix.php-version == '8.1' }}
env:
LC_ALL: C
steps:
@ -198,10 +177,7 @@ jobs:
tools: composer
extensions: openswoole-4.8.1, pdo_sqlsrv-5.10.0beta2
coverage: none
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- name: Create test database
run: docker-compose exec -T shlink_db_ms /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Passw0rd!' -Q "CREATE DATABASE shlink_test;"
- run: composer test:db:ms
@ -211,7 +187,6 @@ jobs:
strategy:
matrix:
php-version: ['8.0', '8.1']
continue-on-error: ${{ matrix.php-version == '8.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -225,10 +200,7 @@ jobs:
extensions: openswoole-4.8.1
coverage: pcov
ini-values: pcov.directory=module
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- run: bin/test/run-api-tests.sh
- uses: actions/upload-artifact@v2
if: ${{ matrix.php-version == '8.0' }}
@ -248,7 +220,6 @@ jobs:
matrix:
php-version: ['8.0', '8.1']
test-group: ['unit', 'db']
continue-on-error: ${{ matrix.php-version == '8.1' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -260,10 +231,7 @@ jobs:
extensions: openswoole-4.8.1
coverage: pcov
ini-values: pcov.directory=module
- if: ${{ matrix.php-version == '8.1' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.1' }}
run: composer install --no-interaction --prefer-dist
- run: composer install --no-interaction --prefer-dist
- uses: actions/download-artifact@v2
with:
path: build

View File

@ -8,7 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
### Added
* [#1204](https://github.com/shlinkio/shlink/issues/1204) Added support for `openswoole` and migrated official docker image to `openswoole`.
* [#1242](https://github.com/shlinkio/shlink/issues/1242) Added support to import urls and visits from YOURLS.
In order to do it, you need to first install this [dedicated plugin](https://slnk.to/yourls-import) in YOURLS, and then run the `short-url:import yourls` command, as with any other source.
* [#1235](https://github.com/shlinkio/shlink/issues/1235) Added support to disable rounding QR codes block sizing via config option, env var or query param.
* [#1188](https://github.com/shlinkio/shlink/issues/1188) Added support for PHP 8.1.
The official docker image has also been updated to use PHP 8.1 by default.
### Changed
* [#1218](https://github.com/shlinkio/shlink/issues/1218) Updated to symfony/mercure 0.6.

View File

@ -1,4 +1,4 @@
FROM php:8.0.9-alpine3.14 as base
FROM php:8.1.0-alpine3.15 as base
ARG SHLINK_VERSION=latest
ENV SHLINK_VERSION ${SHLINK_VERSION}

View File

@ -24,7 +24,7 @@
"geoip2/geoip2": "^2.12",
"guzzlehttp/guzzle": "^7.4",
"happyr/doctrine-specification": "^2.0",
"jaybizzle/crawler-detect": "^1.2",
"jaybizzle/crawler-detect": "^1.2.110",
"laminas/laminas-config": "^3.7",
"laminas/laminas-config-aggregator": "^1.7",
"laminas/laminas-diactoros": "^2.8",
@ -41,13 +41,13 @@
"monolog/monolog": "^2.3",
"nikolaposa/monolog-factory": "^3.1",
"ocramius/proxy-manager": "^2.11",
"pagerfanta/core": "^2.7",
"pagerfanta/core": "^3.5",
"php-middleware/request-id": "^4.1",
"predis/predis": "^1.1",
"pugx/shortid-php": "^0.7",
"ramsey/uuid": "^3.9",
"rlanvin/php-ip": "3.0.0-rc2",
"shlinkio/shlink-common": "dev-main#7cc36a6 as 4.2",
"pugx/shortid-php": "^1.0",
"ramsey/uuid": "^4.2",
"rlanvin/php-ip": "dev-master#6b3a785 as 3.0",
"shlinkio/shlink-common": "dev-main#c2e3442 as 4.2",
"shlinkio/shlink-config": "^1.4",
"shlinkio/shlink-event-dispatcher": "dev-main#3925299 as 2.3",
"shlinkio/shlink-importer": "dev-main#d099072 as 2.5",
@ -64,7 +64,7 @@
"devster/ubench": "^2.1",
"dms/phpunit-arraysubset-asserts": "^0.3.0",
"eaglewu/swoole-ide-helper": "dev-master",
"infection/infection": "^0.25.3",
"infection/infection": "^0.25.4",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.2",
"phpstan/phpstan-doctrine": "^1.0",

View File

@ -1,7 +1,7 @@
FROM php:8.0.9-fpm-alpine3.14
FROM php:8.1.0-fpm-alpine3.15
MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
ENV APCU_VERSION 5.1.20
ENV APCU_VERSION 5.1.21
ENV PDO_SQLSRV_VERSION 5.10.0beta2
ENV MS_ODBC_SQL_VERSION 17.5.2.2

View File

@ -1,7 +1,7 @@
FROM php:8.0.9-alpine3.14
FROM php:8.1.0-alpine3.15
MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
ENV APCU_VERSION 5.1.20
ENV APCU_VERSION 5.1.21
ENV INOTIFY_VERSION 3.0.0
ENV OPENSWOOLE_VERSION 4.8.1
ENV PDO_SQLSRV_VERSION 5.10.0beta2

View File

@ -131,7 +131,7 @@ class ListShortUrlsCommand extends AbstractWithDateRangeCommand
];
if ($all) {
$data[ShortUrlsParamsInputFilter::ITEMS_PER_PAGE] = -1;
$data[ShortUrlsParamsInputFilter::ITEMS_PER_PAGE] = Paginator::ALL_ITEMS;
}
do {

View File

@ -271,7 +271,7 @@ class ListShortUrlsCommandTest extends TestCase
'startDate' => null,
'endDate' => null,
'orderBy' => null,
'itemsPerPage' => -1,
'itemsPerPage' => Paginator::ALL_ITEMS,
]))->willReturn(new Paginator(new ArrayAdapter([])));
$this->commandTester->execute(['--all' => true]);

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Model;
use Shlinkio\Shlink\Common\Paginator\Paginator;
use Shlinkio\Shlink\Common\Util\DateRange;
use function Shlinkio\Shlink\Core\parseDateRangeFromQuery;
@ -11,7 +12,6 @@ use function Shlinkio\Shlink\Core\parseDateRangeFromQuery;
final class VisitsParams
{
private const FIRST_PAGE = 1;
private const ALL_ITEMS = -1;
private DateRange $dateRange;
private int $page;
@ -36,10 +36,10 @@ final class VisitsParams
private function determineItemsPerPage(?int $itemsPerPage): int
{
if ($itemsPerPage !== null && $itemsPerPage < 0) {
return self::ALL_ITEMS;
return Paginator::ALL_ITEMS;
}
return $itemsPerPage ?? self::ALL_ITEMS;
return $itemsPerPage ?? Paginator::ALL_ITEMS;
}
public static function fromRawData(array $query): self

View File

@ -226,8 +226,6 @@ class VisitRepository extends EntitySpecificationRepository implements VisitRepo
'id' => 'visit_location_id',
]);
$query = $this->getEntityManager()->createNativeQuery($nativeQb->getSQL(), $rsm);
return $query->getResult();
return $this->getEntityManager()->createNativeQuery($nativeQb->getSQL(), $rsm)->getResult();
}
}

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Validation;
use Laminas\InputFilter\InputFilter;
use Shlinkio\Shlink\Common\Paginator\Paginator;
use Shlinkio\Shlink\Common\Validation;
class ShortUrlsParamsInputFilter extends InputFilter
@ -32,7 +33,7 @@ class ShortUrlsParamsInputFilter extends InputFilter
$this->add($this->createInput(self::SEARCH_TERM, false));
$this->add($this->createNumericInput(self::PAGE, false));
$this->add($this->createNumericInput(self::ITEMS_PER_PAGE, false, -1));
$this->add($this->createNumericInput(self::ITEMS_PER_PAGE, false, Paginator::ALL_ITEMS));
$this->add($this->createTagsInput(self::TAGS, false));
}

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioApiTest\Shlink\Rest\Action;
use GuzzleHttp\RequestOptions;
use Shlinkio\Shlink\Common\Paginator\Paginator;
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
class OrphanVisitsTest extends ApiTestCase
@ -51,7 +52,7 @@ class OrphanVisitsTest extends ApiTestCase
$payload = $this->getJsonResponsePayload($resp);
$visits = $payload['visits']['data'] ?? [];
self::assertEquals($totalItems, $payload['visits']['pagination']['totalItems'] ?? -1);
self::assertEquals($totalItems, $payload['visits']['pagination']['totalItems'] ?? Paginator::ALL_ITEMS);
self::assertCount($expectedAmount, $visits);
self::assertEquals($expectedVisits, $visits);
}

View File

@ -6,6 +6,7 @@ namespace ShlinkioApiTest\Shlink\Rest\Action;
use GuzzleHttp\Psr7\Query;
use Laminas\Diactoros\Uri;
use Shlinkio\Shlink\Common\Paginator\Paginator;
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
use ShlinkioApiTest\Shlink\Rest\Utils\NotFoundUrlHelpersTrait;
@ -58,7 +59,10 @@ class ShortUrlVisitsTest extends ApiTestCase
$resp = $this->callApiWithKey(self::METHOD_GET, (string) $url);
$payload = $this->getJsonResponsePayload($resp);
self::assertEquals($expectedAmountOfVisits, $payload['visits']['pagination']['totalItems'] ?? -1);
self::assertEquals(
$expectedAmountOfVisits,
$payload['visits']['pagination']['totalItems'] ?? Paginator::ALL_ITEMS,
);
self::assertCount($expectedAmountOfVisits, $payload['visits']['data'] ?? []);
}
@ -84,7 +88,10 @@ class ShortUrlVisitsTest extends ApiTestCase
$resp = $this->callApiWithKey(self::METHOD_GET, (string) $url);
$payload = $this->getJsonResponsePayload($resp);
self::assertEquals($expectedAmountOfVisits, $payload['visits']['pagination']['totalItems'] ?? -1);
self::assertEquals(
$expectedAmountOfVisits,
$payload['visits']['pagination']['totalItems'] ?? Paginator::ALL_ITEMS,
);
self::assertCount($expectedAmountOfVisits, $payload['visits']['data'] ?? []);
}

View File

@ -9,3 +9,6 @@ parameters:
doctrine:
repositoryClass: Happyr\DoctrineSpecification\Repository\EntitySpecificationRepository
objectManagerLoader: 'config/entity-manager.php'
ignoreErrors:
- '#should return int<0, max> but returns int#'
- '#expects -1|int<1, max>, int given#'