Skip to content

Commit 3a00402

Browse files
committed
Upgrade dependencies + require PHP 8.1
1 parent 3f05533 commit 3a00402

File tree

9 files changed

+49
-40
lines changed

9 files changed

+49
-40
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=8.0",
21+
"php": ">=8.1",
2222
"ext-mbstring": "*",
2323
"squirrelphp/debug": "^2.0"
2424
},
2525
"require-dev": {
2626
"ext-intl": "*",
2727
"bamarni/composer-bin-plugin": "^1.3",
2828
"captainhook/plugin-composer": "^5.0",
29-
"phpunit/phpunit": "^9.0",
29+
"phpunit/phpunit": "^10.0",
3030
"twig/twig": "^3.0",
31-
"symfony/form": "^5.0|^6.0",
32-
"symfony/http-foundation": "^5.0|^6.0"
31+
"symfony/form": "^5.0|^6.0|^7.0",
32+
"symfony/http-foundation": "^5.0|^6.0|^7.0"
3333
},
3434
"suggest": {
3535
"squirrelphp/strings-bundle": "Symfony integration of squirrelphp/strings"

phpunit.xml.dist

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php">
3-
<coverage>
4-
<include>
5-
<directory suffix=".php">src</directory>
6-
</include>
7-
</coverage>
8-
<testsuites>
9-
<testsuite name="Unit Tests">
10-
<directory>tests</directory>
11-
</testsuite>
12-
</testsuites>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php">
3+
<coverage includeUncoveredFiles="false"/>
4+
<testsuites>
5+
<testsuite name="Squirrel Test Suite">
6+
<directory>tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
<source>
10+
<include>
11+
<directory>src</directory>
12+
</include>
13+
</source>
1314
</phpunit>

psalm-baseline.xml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="v4.15.0@a1b5e489e6fcebe40cb804793d964e99fc347820">
2+
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
33
<file src="src/Attribute/StringFilter.php">
4-
<DocblockTypeContradiction occurrences="1">
4+
<DocblockTypeContradiction>
55
<code>\is_string($name)</code>
66
</DocblockTypeContradiction>
77
</file>
88
<file src="src/Attribute/StringFilterExtension.php">
9-
<ArgumentTypeCoercion occurrences="1">
10-
<code>$options['data_class']</code>
9+
<ArgumentTypeCoercion>
10+
<code><![CDATA[$options['data_class']]]></code>
11+
</ArgumentTypeCoercion>
12+
</file>
13+
<file src="src/Filter/NormalizeLettersToAsciiFilter.php">
14+
<PossiblyNullArgument>
15+
<code>\IntlChar::chr($codepointAsInt)</code>
16+
</PossiblyNullArgument>
17+
</file>
18+
<file src="src/Regex.php">
19+
<ArgumentTypeCoercion>
20+
<code>$pattern</code>
21+
<code>$pattern</code>
1122
</ArgumentTypeCoercion>
1223
</file>
1324
<file src="tests/StringFilterAttributeProcessorTest.php">
14-
<InvalidArgument occurrences="1">
15-
<code>''</code>
16-
</InvalidArgument>
17-
<InvalidScalarArgument occurrences="1">
25+
<InvalidArgument>
26+
<code><![CDATA['']]></code>
1827
<code>[0]</code>
19-
</InvalidScalarArgument>
28+
</InvalidArgument>
2029
</file>
2130
</files>

psalm.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
88
errorBaseline="psalm-baseline.xml"
9+
findUnusedBaselineEntry="true"
10+
findUnusedCode="false"
911
>
1012
<projectFiles>
1113
<directory name="src" />

ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
5454
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
5555
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
56-
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing"/>
56+
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration"/>
5757
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
5858
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
5959
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants"/>

src/Filter/TrimFilter.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,25 @@ class TrimFilter implements StringFilterInterface
1515
private string $trimCharacters;
1616

1717
/**
18-
* @var string Default is to trim ascii characters
18+
* @var callable
1919
*/
20-
private string $trimFunction = 'trimAscii';
20+
private $trimFunction;
2121

2222
public function __construct(string $trimCharacters = " \t\n\r\0\x0B")
2323
{
2424
// If trimCharacters contains unicode characters we change to the trimUnicode function
2525
if (\mb_strlen($trimCharacters, 'UTF-8') !== \strlen($trimCharacters)) {
26-
$this->trimFunction = 'trimUnicode';
26+
$this->trimFunction = $this->trimUnicode(...);
27+
} else {
28+
$this->trimFunction = $this->trimAscii(...);
2729
}
2830

2931
$this->trimCharacters = $trimCharacters;
3032
}
3133

3234
public function filter(string $string): string
3335
{
34-
/**
35-
* @var callable $callable
36-
*/
37-
$callable = [$this, $this->trimFunction];
38-
39-
return $callable($string, $this->trimCharacters);
36+
return ($this->trimFunction)($string, $this->trimCharacters);
4037
}
4138

4239
private function trimAscii(string $string, string $trimCharacters): string

tests/RegexTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ public function testReplaceWithCallbackException(): void
375375
return '';
376376
}, 'ladida');
377377
} catch (RegexException $e) {
378-
$this->assertSame(__LINE__ - 2, $e->getOriginLine());
379-
$this->assertSame(__LINE__ - 3, $e->getLine());
378+
$this->assertSame(__LINE__ - 4, $e->getOriginLine());
379+
$this->assertSame(__LINE__ - 5, $e->getLine());
380380
$this->assertSame(__FILE__, $e->getOriginFile());
381381
$this->assertStringStartsWith('Regex::replaceWithCallback(', $e->getOriginCall());
382382
$this->assertSame('Regex error in Squirrel\Strings\Regex: PREG_INTERNAL_ERROR', $e->getMessage());
@@ -390,8 +390,8 @@ public function testReplaceArrayWithCallbackException(): void
390390
return '';
391391
}, ['ladida']);
392392
} catch (RegexException $e) {
393-
$this->assertSame(__LINE__ - 2, $e->getOriginLine());
394-
$this->assertSame(__LINE__ - 3, $e->getLine());
393+
$this->assertSame(__LINE__ - 4, $e->getOriginLine());
394+
$this->assertSame(__LINE__ - 5, $e->getLine());
395395
$this->assertSame(__FILE__, $e->getOriginFile());
396396
$this->assertStringStartsWith('Regex::replaceArrayWithCallback(', $e->getOriginCall());
397397
$this->assertSame('Regex error in Squirrel\Strings\Regex: PREG_INTERNAL_ERROR', $e->getMessage());

vendor-bin/phpcs/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"require": {
33
"squizlabs/php_codesniffer": "^3.5",
4-
"slevomat/coding-standard": "^7.0"
4+
"slevomat/coding-standard": "^8.0"
55
},
66
"config": {
77
"allow-plugins": {

vendor-bin/psalm/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"vimeo/psalm": "^4.0",
3+
"vimeo/psalm": "^5.0",
44
"psalm/plugin-phpunit": "*",
55
"psalm/plugin-mockery": "*"
66
}

0 commit comments

Comments
 (0)