Skip to content

Commit 18032a8

Browse files
committed
Maintainance
1 parent aaf5138 commit 18032a8

File tree

11 files changed

+48
-45
lines changed

11 files changed

+48
-45
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ trim_trailing_whitespace = true
1111

1212
[*.yml]
1313
indent_size = 2
14+
15+
[*.neon]
16+
indent_style = tab

.github/workflows/ci.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
php-version: ['8.1', '8.2']
21-
prefer-lowest: ['']
20+
php-version: ['8.1', '8.2', '8.3']
2221
include:
2322
- php-version: '8.1'
24-
prefer-lowest: 'prefer-lowest'
23+
composer-options: '--ignore-platform-req=php'
24+
- php-version: '8.1'
25+
dependencies: lowest
2526

2627
steps:
2728
- uses: actions/checkout@v4
@@ -42,27 +43,25 @@ jobs:
4243
wkhtmltopdf --version
4344
4445
- name: Composer install
45-
run: |
46-
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
47-
composer update --prefer-lowest --prefer-stable
48-
else
49-
composer install
50-
fi
46+
uses: ramsey/composer-install@v3
47+
with:
48+
dependency-versions: ${{ matrix.dependencies }}
49+
composer-options: ${{ matrix.composer-options }}
5150

5251
- name: Setup problem matchers for PHPUnit
5352
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
5453

5554
- name: Run PHPUnit
5655
run: |
57-
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
58-
vendor/bin/phpunit --coverage-clover=coverage.xml
56+
if [[ ${{ matrix.php-version }} == '8.3' ]]; then
57+
vendor/bin/phpunit --display-warnings --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml
5958
else
60-
vendor/bin/phpunit
59+
vendor/bin/phpunit --display-warnings --display-deprecations
6160
fi
6261
6362
- name: Code Coverage Report
64-
if: matrix.php-version == '8.1'
65-
uses: codecov/codecov-action@v3
63+
if: matrix.php-version == '8.3'
64+
uses: codecov/codecov-action@v4
6665

6766
cs-stan:
6867
uses: cakephp/.github/.github/workflows/[email protected]

.phive/phars.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="1.10.37" installed="1.10.37" location="./tools/phpstan" copy="false"/>
4-
<phar name="psalm" version="5.15.0" installed="5.15.0" location="./tools/psalm" copy="false"/>
3+
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
55
</phive>

phpstan.neon

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
parameters:
2-
level: 6
3-
checkMissingIterableValueType: false
4-
bootstrapFiles:
5-
- vendor/cakephp/cakephp/src/Core/Exception/CakeException.php
6-
- tests/bootstrap.php
7-
paths:
8-
- src
2+
level: 7
3+
bootstrapFiles:
4+
- vendor/cakephp/cakephp/src/Core/Exception/CakeException.php
5+
- tests/bootstrap.php
6+
paths:
7+
- src
8+
ignoreErrors:
9+
-
10+
identifier: missingType.iterableValue

psalm-baseline.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

psalm.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8-
errorBaseline="psalm-baseline.xml"
8+
findUnusedBaselineEntry="true"
9+
findUnusedCode="false"
910
>
1011
<projectFiles>
1112
<directory name="src" />
@@ -32,5 +33,6 @@
3233
<RedundantConditionGivenDocblockType errorLevel="info" />
3334

3435
<UnsafeInstantiation errorLevel="info" />
36+
<RiskyTruthyFalsyComparison errorLevel="info" />
3537
</issueHandlers>
3638
</psalm>

src/Pdf/CakePdf.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ public function write(string $destination, bool $create = true, ?string $html =
349349
}
350350

351351
$splFileInfo = $fileInfo->getPathInfo();
352-
/** @phpstan-ignore-next-line */
353352
if ($splFileInfo === null) {
354353
throw new CakeException('Failed to retrieve path information');
355354
}
@@ -378,7 +377,6 @@ public function engine(array|string|null $name = null): ?AbstractPdfEngine
378377
$name = $name['className'];
379378
}
380379

381-
/** @var class-string<\CakePdf\Pdf\Engine\AbstractPdfEngine>|null $engineClassName */
382380
$engineClassName = App::className($name, 'Pdf/Engine', 'Engine');
383381
if ($engineClassName === null) {
384382
throw new CakeException(sprintf('Pdf engine "%s" not found', $name));
@@ -580,10 +578,10 @@ public function margin(
580578
$right = $left;
581579
}
582580

583-
$this->marginBottom($bottom);
584-
$this->marginLeft($left);
585-
$this->marginRight($right);
586-
$this->marginTop($top);
581+
$this->marginBottom($bottom); // @phpstan-ignore argument.type
582+
$this->marginLeft($left); // @phpstan-ignore argument.type
583+
$this->marginRight($right); // @phpstan-ignore argument.type
584+
$this->marginTop($top); // @phpstan-ignore argument.type
587585

588586
return $this;
589587
}

src/Pdf/Crypto/PdftkCrypto.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public function encrypt(string $data): string
8484
];
8585

8686
$prochandle = proc_open($command, $descriptorspec, $pipes);
87+
if ($prochandle === false) {
88+
throw new CakeException('Unable to execute pdftk, proc_open() failed');
89+
}
8790

8891
fwrite($pipes[0], $data);
8992
fclose($pipes[0]);

src/Pdf/Engine/TexToPdfEngine.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ protected function _exec(string $cmd, string $input): array
102102
$result = ['stdout' => '', 'stderr' => '', 'return' => ''];
103103

104104
$proc = proc_open($cmd, [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
105+
if ($proc === false) {
106+
throw new CakeException('Unable to execute latexpdf, proc_open() failed');
107+
}
108+
105109
fwrite($pipes[0], $input);
106110
fclose($pipes[0]);
107111

src/Pdf/Engine/WkHtmlToPdfEngine.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ protected function _exec(string $cmd, string $input): array
8080
$cwd = $this->getConfig('cwd');
8181

8282
$proc = proc_open($cmd, [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes, $cwd);
83+
if ($proc === false) {
84+
throw new CakeException('Unable to execute wkhtmltopdf, proc_open() failed');
85+
}
86+
8387
fwrite($pipes[0], $input);
8488
fclose($pipes[0]);
8589

@@ -150,10 +154,6 @@ protected function _getCommand(): string
150154
}
151155
$command .= ' - -';
152156

153-
if ($this->_windowsEnvironment && PHP_MAJOR_VERSION < 8) {
154-
$command = '"' . $command . '"';
155-
}
156-
157157
return $command;
158158
}
159159

0 commit comments

Comments
 (0)