Skip to content

Commit

Permalink
Requires PHP 8.1+ ; Updated dependencies + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Dec 26, 2024
1 parent 5ab3b65 commit 44d754a
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 91 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["8.0", "8.1", "8.2", "8.3"]
php-version: ["8.1", "8.2", "8.3", "8.4"]
experimental: [false]
os: [ubuntu-latest]
coverage-extension: [pcov]
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Run all tests
run: make qa
- name: Send coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
flags: php-${{ matrix.php-version }}-${{ matrix.os }}
name: php-${{ matrix.php-version }}-${{ matrix.os }}
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ endif
deps: ensuretarget
rm -rf ./vendor/*
($(COMPOSER) install -vvv --no-interaction)
curl --silent --show-error --fail --location --output ./vendor/phpstan.phar https://github.com/phpstan/phpstan/releases/download/1.10.41/phpstan.phar \
curl --silent --show-error --fail --location --output ./vendor/phpstan.phar https://github.com/phpstan/phpstan/releases/download/2.0.4/phpstan.phar \
&& chmod +x ./vendor/phpstan.phar

# Generate source code documentation
Expand Down Expand Up @@ -212,8 +212,8 @@ endif
.PHONY: lint
lint:
./vendor/bin/phpcs --ignore="./vendor/" --standard=phpcs.xml src test
./vendor/bin/phpmd src text codesize,unusedcode,naming,design --exclude vendor
./vendor/bin/phpmd test text unusedcode,naming,design
./vendor/bin/phpmd src text codesize,unusedcode,naming,design --exclude */vendor/*
./vendor/bin/phpmd test text unusedcode,naming,design --exclude */vendor/*
php -r 'exit((int)version_compare(PHP_MAJOR_VERSION, "7", ">"));' || ./vendor/phpstan.phar analyse

# Run all tests and reports
Expand Down Expand Up @@ -261,7 +261,7 @@ tag:
.PHONY: test
test:
cp phpunit.xml.dist phpunit.xml
./vendor/bin/phpunit --migrate-configuration || true
#./vendor/bin/phpunit --migrate-configuration || true
XDEBUG_MODE=coverage ./vendor/bin/phpunit --stderr test

# Remove all installed files
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.17
2.0.18
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
}
],
"require": {
"php": ">=8.0",
"php": ">=8.1",
"ext-mbstring": "*",
"ext-pcre": "*",
"tecnickcom/tc-lib-unicode-data": "^2.0"
},
"require-dev": {
"pdepend/pdepend": "2.13.0",
"phpmd/phpmd": "2.13.0",
"phpunit/phpunit": "10.1.2 || 9.6.13",
"squizlabs/php_codesniffer": "3.7.2"
"pdepend/pdepend": "2.16.2",
"phpmd/phpmd": "2.15.0",
"phpunit/phpunit": "11.5.2 || 10.5.40",
"squizlabs/php_codesniffer": "3.11.2"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parameters:
paths:
- src
- test
scanDirectories:
excludePaths:
- vendor
ignoreErrors:
reportUnmatchedIgnoredErrors: false
Expand Down
32 changes: 18 additions & 14 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitDeprecations="true"
processIsolation="false"
stopOnFailure="false"
verbose="true">
stopOnFailure="false">
<testsuites>
<testsuite name="tc-lib-unicode Test Suite">
<directory>./test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix="php">src</directory>
</whitelist>
</filter>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
<coverage>
<report>
<clover outputFile="target/coverage/coverage.xml"/>
<html outputDirectory="target/coverage" lowUpperBound="50" highLowerBound="90"/>
</report>
</coverage>
<logging>
<log type="coverage-html" target="target/coverage"/>
<log type="coverage-clover" target="target/coverage/coverage.xml"/>
<log type="junit" target="target/logs/junit.xml"/>
<junit outputFile="target/logs/junit.xml"/>
</logging>
</phpunit>
2 changes: 1 addition & 1 deletion resources/debian/compat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9
10
2 changes: 1 addition & 1 deletion resources/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Vcs-Git: https://github.com/~#VENDOR#~/~#PROJECT#~.git
Package: ~#PKGNAME#~
Provides: php-~#PROJECT#~
Architecture: all
Depends: php (>= 8.0.0), php-mbstring, php-tecnickcom-tc-lib-unicode-data (<< 3.0.0), php-tecnickcom-tc-lib-unicode-data (>= 2.0.17), ${misc:Depends}
Depends: php (>= 8.1.0), php-mbstring, php-tecnickcom-tc-lib-unicode-data (<< 3.0.0), php-tecnickcom-tc-lib-unicode-data (>= 2.0.18), ${misc:Depends}
Description: PHP Unicode methods.
PHP library containing Unicode methods.
4 changes: 2 additions & 2 deletions resources/rpm/rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ URL: https://github.com/%{gh_owner}/%{gh_project}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
BuildArch: noarch

Requires: php(language) >= 8.0.0
Requires: php(language) >= 8.1.0
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0.17
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0.18
Requires: php-pcre
Requires: php-mbstring

Expand Down
4 changes: 2 additions & 2 deletions src/Bidi.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function __construct(
* @param ?array<int> $ordarr Array of UTF-8 codepoints (if empty it will be generated from $str or $chrarr)
* @param string $forcedir If 'R' forces RTL, if 'L' forces LTR
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
*/
protected function setInput(
?string $str = null,
Expand Down Expand Up @@ -272,7 +272,7 @@ protected function getParagraphs(): array
/**
* Process the string
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
*/
protected function process(): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bidi/StepN.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ protected function processN1next(int &$jdx): string
*
* @param int $idx Start index
*/
protected function getNextN1Char(int $idx): int|float
protected function getNextN1Char(int $idx): int
{
$jdx = ($idx + 1);
while (($jdx < $this->seq['length']) && ($this->seq['item'][$jdx]['type'] == 'NI')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Bidi/StepX.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function processX(): void
* @param int $pos Original character position in the input string
* @param int $ord Char code
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
*/
protected function processXcase(int $pos, int $ord): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function chr(int $ord): string
public function ord(string $chr): int
{
$uni = unpack('N', mb_convert_encoding($chr, 'UCS-4BE', 'UTF-8'));
if ($uni === false) {
if (($uni === false) || (!isset($uni[1])) || (!is_int($uni[1]))) {
throw new UniException('Error converting string');
}

Expand Down
6 changes: 4 additions & 2 deletions test/Bidi/StepITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use Com\Tecnick\Unicode\Bidi\StepI;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;

/**
* Bidi Test
Expand All @@ -33,8 +34,6 @@
class StepITest extends TestCase
{
/**
* @dataProvider stepIDataProvider
*
* @param array{
* 'e': int,
* 'edir': string,
Expand All @@ -55,7 +54,10 @@ class StepITest extends TestCase
* 'x': int,
* }>,
* } $seq Isolated Sequence array
*
* @param mixed $expected Expected result
*/
#[DataProvider('stepIDataProvider')]
public function testStepI(array $seq, mixed $expected): void
{
$stepi = new StepI($seq);
Expand Down
4 changes: 2 additions & 2 deletions test/Bidi/StepLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use Com\Tecnick\Unicode\Bidi\StepL;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;

/**
* Bidi Test
Expand All @@ -33,8 +34,6 @@
class StepLTest extends TestCase
{
/**
* @dataProvider stepLDataProvider
*
* @param array<int, array{
* 'char': int,
* 'i': int,
Expand All @@ -46,6 +45,7 @@ class StepLTest extends TestCase
* 'x': int,
* }> $chardata
*/
#[DataProvider('stepLDataProvider')]
public function testStepL(array $chardata, int $pel, int $maxlevel, mixed $expected): void
{
$stepl = new StepL($chardata, $pel, $maxlevel);
Expand Down
13 changes: 5 additions & 8 deletions test/Bidi/StepNTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use Com\Tecnick\Unicode\Bidi\StepN;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;

/**
* Bidi Test
Expand All @@ -33,8 +34,6 @@
class StepNTest extends TestCase
{
/**
* @dataProvider stepN0DataProvider
*
* @param array{
* 'e': int,
* 'edir': string,
Expand All @@ -56,6 +55,7 @@ class StepNTest extends TestCase
* }>,
* } $seq Isolated Sequence array
*/
#[DataProvider('stepN0DataProvider')]
public function testStepN0(array $seq, mixed $expected): void
{
$stepn = new StepN($seq, false);
Expand Down Expand Up @@ -1533,8 +1533,6 @@ public static function stepN0DataProvider(): array
}

/**
* @dataProvider stepN1DataProvider
*
* @param array{
* 'e': int,
* 'edir': string,
Expand All @@ -1556,6 +1554,7 @@ public static function stepN0DataProvider(): array
* }>,
* } $seq Isolated Sequence array
*/
#[DataProvider('stepN1DataProvider')]
public function testStepN1(array $seq, mixed $expected): void
{
$stepn = new \Com\Tecnick\Unicode\Bidi\StepN($seq, false);
Expand Down Expand Up @@ -2558,8 +2557,6 @@ public static function stepN1DataProvider(): array
}

/**
* @dataProvider stepN2DataProvider
*
* @param array{
* 'e': int,
* 'edir': string,
Expand All @@ -2581,6 +2578,7 @@ public static function stepN1DataProvider(): array
* }>,
* } $seq Isolated Sequence array
*/
#[DataProvider('stepN2DataProvider')]
public function testStepN2(array $seq, mixed $expected): void
{
$stepn = new \Com\Tecnick\Unicode\Bidi\StepN($seq, false);
Expand Down Expand Up @@ -2663,8 +2661,6 @@ public static function stepN2DataProvider(): array
}

/**
* @dataProvider stepNDataProvider
*
* @param array{
* 'e': int,
* 'edir': string,
Expand All @@ -2686,6 +2682,7 @@ public static function stepN2DataProvider(): array
* }>,
* } $seq Isolated Sequence array
*/
#[DataProvider('stepNDataProvider')]
public function testStepN(array $seq, mixed $expected): void
{
$stepn = new \Com\Tecnick\Unicode\Bidi\StepN($seq);
Expand Down
Loading

0 comments on commit 44d754a

Please sign in to comment.