mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 09:38:32 +01:00
require php 8.0
This commit is contained in:
parent
336653fabb
commit
bff689c862
2
.github/workflows/coding-standards.yml
vendored
2
.github/workflows/coding-standards.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- name: "installing PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "7.4"
|
||||
php-version: "8.0"
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer:v2, cs2pr
|
||||
extensions: bcmath, mbstring, intl, sodium, json
|
||||
|
2
.github/workflows/documentation-check.yml
vendored
2
.github/workflows/documentation-check.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- name: "installing PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "7.4"
|
||||
php-version: "8.0"
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer:v2, cs2pr
|
||||
extensions: bcmath, mbstring, intl, sodium, json
|
||||
|
2
.github/workflows/security-analysis.yml
vendored
2
.github/workflows/security-analysis.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- name: "installing PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "7.4"
|
||||
php-version: "8.0"
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer:v2, cs2pr
|
||||
extensions: bcmath, mbstring, intl, sodium, json
|
||||
|
2
.github/workflows/static-analysis.yml
vendored
2
.github/workflows/static-analysis.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
- name: "installing PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "7.4"
|
||||
php-version: "8.0"
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer:v2, cs2pr
|
||||
extensions: bcmath, mbstring, intl, sodium, json
|
||||
|
1
.github/workflows/unit-tests.yml
vendored
1
.github/workflows/unit-tests.yml
vendored
@ -13,7 +13,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "7.4"
|
||||
- "8.0"
|
||||
operating-system:
|
||||
- "macos-latest"
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,6 +17,7 @@
|
||||
|
||||
# php-cs-fixer cache
|
||||
/.php_cs.cache
|
||||
/.php-cs-fixer.cache
|
||||
|
||||
# phpunit cache
|
||||
/tools/phpunit/.phpunit.result.cache
|
||||
|
4
Makefile
4
Makefile
@ -14,11 +14,11 @@ install-unit-tests-dependencies:
|
||||
install: install-root-dependencies install-coding-standard-dependencies install-static-analysis-dependencies install-unit-tests-dependencies
|
||||
|
||||
coding-standard-fix:
|
||||
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist
|
||||
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist.php
|
||||
php tools/php-codesniffer/vendor/bin/phpcbf --basepath=. --standard=tools/php-codesniffer/.phpcs.xml
|
||||
|
||||
coding-standard-check:
|
||||
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist --dry-run
|
||||
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist.php --dry-run
|
||||
php tools/php-codesniffer/vendor/bin/phpcs --basepath=. --standard=tools/php-codesniffer/.phpcs.xml
|
||||
|
||||
static-analysis:
|
||||
|
@ -10,7 +10,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^8.0",
|
||||
"ext-bcmath": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
|
@ -24,7 +24,7 @@ namespace Psl\Iter;
|
||||
* @param iterable<T> $iterable
|
||||
* @param T $value
|
||||
*/
|
||||
function contains(iterable $iterable, $value): bool
|
||||
function contains(iterable $iterable, mixed $value): bool
|
||||
{
|
||||
foreach ($iterable as $v) {
|
||||
if ($value === $v) {
|
||||
|
@ -10,10 +10,10 @@ namespace Psl\Iter;
|
||||
* @template Tk
|
||||
* @template Tv
|
||||
*
|
||||
* @param iterable<Tk, Tv> $iterable,
|
||||
* @param iterable<Tk, Tv> $iterable
|
||||
* @param Tk $key
|
||||
*/
|
||||
function contains_key(iterable $iterable, $key): bool
|
||||
function contains_key(iterable $iterable, mixed $key): bool
|
||||
{
|
||||
foreach ($iterable as $k => $_v) {
|
||||
if ($key === $k) {
|
||||
|
@ -17,11 +17,9 @@ use const JSON_THROW_ON_ERROR;
|
||||
*
|
||||
* @throws Exception\DecodeException If an error occurred.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @pure
|
||||
*/
|
||||
function decode(string $json, bool $assoc = true)
|
||||
function decode(string $json, bool $assoc = true): mixed
|
||||
{
|
||||
try {
|
||||
/** @var mixed $value */
|
||||
|
@ -18,13 +18,11 @@ use const JSON_UNESCAPED_UNICODE;
|
||||
/**
|
||||
* Returns a string containing the JSON representation of the supplied value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @pure
|
||||
*
|
||||
* @throws Exception\EncodeException If an error occurred.
|
||||
*/
|
||||
function encode($value, bool $pretty = false, int $flags = 0): string
|
||||
function encode(mixed $value, bool $pretty = false, int $flags = 0): string
|
||||
{
|
||||
$flags |= JSON_UNESCAPED_UNICODE
|
||||
| JSON_UNESCAPED_SLASHES
|
||||
|
@ -17,7 +17,7 @@ use Psl\Type;
|
||||
*
|
||||
* @return T
|
||||
*/
|
||||
function typed(string $json, Type\TypeInterface $type)
|
||||
function typed(string $json, Type\TypeInterface $type): mixed
|
||||
{
|
||||
try {
|
||||
return $type->coerce(decode($json));
|
||||
|
@ -49,7 +49,6 @@ function base_convert(string $value, int $from_base, int $to_base): string
|
||||
Psl\invariant($to_base >= 2 && $to_base <= 36, 'Expected $to_base to be between 2 and 36, got %d', $to_base);
|
||||
|
||||
$from_alphabet = Byte\slice(Str\ALPHABET_ALPHANUMERIC, 0, $from_base);
|
||||
/** @var numeric-string $result_decimal */
|
||||
$result_decimal = '0';
|
||||
$place_value = bcpow((string)$from_base, (string)(Byte\length($value) - 1));
|
||||
foreach (Byte\chunk($value) as $digit) {
|
||||
@ -69,7 +68,6 @@ function base_convert(string $value, int $from_base, int $to_base): string
|
||||
$result = '';
|
||||
do {
|
||||
$result = $to_alphabet[(int)bcmod($result_decimal, (string)$to_base)] . $result;
|
||||
/** @var numeric-string $result_decimal */
|
||||
$result_decimal = bcdiv($result_decimal, (string)$to_base);
|
||||
} while (bccomp($result_decimal, '0') > 0);
|
||||
|
||||
|
@ -21,12 +21,12 @@ final class Success implements ResultInterface
|
||||
*
|
||||
* @readonly
|
||||
*/
|
||||
private $value;
|
||||
private mixed $value;
|
||||
|
||||
/**
|
||||
* @param T $value
|
||||
*/
|
||||
public function __construct($value)
|
||||
public function __construct(mixed $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
@ -38,7 +38,7 @@ final class Success implements ResultInterface
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function getResult()
|
||||
public function getResult(): mixed
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ use function stream_get_contents;
|
||||
*
|
||||
* @param string $command The command to execute.
|
||||
* @param list<string> $arguments The command arguments listed as separate entries.
|
||||
* @param string $working_directory The initial working directory for the command.
|
||||
* @param null|string $working_directory The initial working directory for the command.
|
||||
* This must be an absolute directory path, or null if you want to
|
||||
* use the default value ( the current directory )
|
||||
* @param array<string, string> $environment A dict with the environment variables for the command that
|
||||
|
@ -23,9 +23,6 @@ function slice(string $string, int $offset, ?int $length = null): string
|
||||
{
|
||||
Psl\invariant(null === $length || $length >= 0, 'Expected a non-negative length.');
|
||||
$offset = Psl\Internal\validate_offset($offset, length($string));
|
||||
$result = null === $length
|
||||
? substr($string, $offset)
|
||||
: substr($string, $offset, $length);
|
||||
|
||||
return false === $result ? '' : $result;
|
||||
return null === $length ? substr($string, $offset) : substr($string, $offset, $length);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^8.0",
|
||||
"ext-bcmath": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
return (new PhpCsFixer\Config())
|
||||
->setFinder(
|
||||
\Symfony\Component\Finder\Finder::create()
|
||||
->in([
|
||||
@ -25,14 +25,10 @@ return PhpCsFixer\Config::create()
|
||||
'list_syntax' => [
|
||||
'syntax' => 'short',
|
||||
],
|
||||
'lowercase_constants' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
'native_function_casing' => true,
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_superfluous_phpdoc_tags' => [
|
||||
'allow_mixed' => true,
|
||||
],
|
||||
'no_unused_imports' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^8.0",
|
||||
"ext-bcmath": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-sodium": "*",
|
||||
"friendsofphp/php-cs-fixer": "^2.18"
|
||||
"friendsofphp/php-cs-fixer": "^3.0"
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^8.0",
|
||||
"ext-bcmath": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^8.0",
|
||||
"ext-bcmath": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm totallyTyped="true" forbidEcho="true" strictBinaryOperands="true" phpVersion="7.4" allowPhpStormGenerics="true" allowStringToStandInForClass="true" rememberPropertyAssignmentsAfterCall="false" checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="baseline.xml">
|
||||
<psalm totallyTyped="true" forbidEcho="true" strictBinaryOperands="true" phpVersion="8.0" allowStringToStandInForClass="true" rememberPropertyAssignmentsAfterCall="false" checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="baseline.xml">
|
||||
<projectFiles>
|
||||
<directory name="../../src" />
|
||||
<directory name="../../integration" />
|
||||
|
Loading…
Reference in New Issue
Block a user