diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..64664d6 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +github: [endelwar] +ko_fi: endelwar diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 2c8be8e..ee11608 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -6,6 +6,7 @@ ; return (new PhpCsFixer\Config()) + ->setFinder($finder) ->setRiskyAllowed(true) ->setRules([ '@Symfony' => true, @@ -13,8 +14,15 @@ 'array_syntax' => ['syntax' => 'short'], 'concat_space' => ['spacing' => 'one'], 'cast_spaces' => ['space' => 'none'], - 'native_function_invocation' => false, + 'types_spaces' => ['space' => 'none'], 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], + 'phpdoc_to_comment' => false, + 'fopen_flags' => ['b_mode' => true], + 'native_function_invocation' => ['include' => ['@all']], + 'function_declaration' => ['closure_function_spacing' => 'none', 'closure_fn_spacing' => 'none'], + 'method_argument_space' => [ + 'on_multiline' => 'ensure_fully_multiline', + 'keep_multiple_spaces_after_comma' => false, + ], ]) - ->setFinder($finder) ; diff --git a/CHANGELOG.md b/CHANGELOG.md index e90b42a..da124d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,13 @@ and this project adheres to [Semantic Versioning(https://semver.org/spec/v2.0.0. ## Unreleased +## 1.3.0 - 2023-10-07 +### Added +- Support WeasyPrint 60.0 new option + ## 1.2.0 - 2023-05-11 ### Added -- Support WeasyPrint 59.0b1 new option +- Support WeasyPrint 59.0b1 new options ## 1.1.1 - 2023-04-27 ### Security diff --git a/src/AbstractGenerator.php b/src/AbstractGenerator.php index 329541e..f564731 100644 --- a/src/AbstractGenerator.php +++ b/src/AbstractGenerator.php @@ -506,7 +506,7 @@ protected function checkOutput(string $output, string $command): void protected function checkProcessStatus(?int $status, string $stdout, string $stderr, string $command): void { if (null === $status) { - throw new \RuntimeException(sprintf('The command is not terminated.' . "\n" . 'stderr: "%s"' . "\n" . 'stdout: "%s"' . "\n" . 'command: %s', $stderr, $stdout, $command)); + throw new \RuntimeException(\sprintf('The command is not terminated.' . "\n" . 'stderr: "%s"' . "\n" . 'stdout: "%s"' . "\n" . 'command: %s', $stderr, $stdout, $command)); } if (0 !== $status && '' !== $stderr) { diff --git a/src/Pdf.php b/src/Pdf.php index 89b9461..2bf121e 100644 --- a/src/Pdf.php +++ b/src/Pdf.php @@ -50,7 +50,7 @@ protected function handleOptions(array $options = []): array if ('attachment' === $option || 'stylesheet' === $option) { $handledOption = $this->handleArrayOptions($option, $value); - if (count($handledOption) > 0) { + if (\count($handledOption) > 0) { $options[$option] = $handledOption; } } @@ -66,7 +66,7 @@ protected function handleOptions(array $options = []): array */ private function handleArrayOptions(string $option, $value): array { - if (!is_array($value)) { + if (!\is_array($value)) { $value = [$value]; } @@ -120,6 +120,7 @@ protected function configure(): void 'jpeg-quality' => null, // added in WeasyPrint 59.0b1 'optimize-images' => null, // no longer deprecated in WeasyPrint 59.0b1 'cache-folder' => null, // added in WeasyPrint 59.0b1 + 'timeout' => null, // added in WeasyPrint 60.0 // Deprecated 'format' => null, // deprecated in WeasyPrint 53.0b2 'resolution' => null, // deprecated - png only diff --git a/tests/Unit/AbstractGeneratorTest.php b/tests/Unit/AbstractGeneratorTest.php index c383618..6b740d5 100644 --- a/tests/Unit/AbstractGeneratorTest.php +++ b/tests/Unit/AbstractGeneratorTest.php @@ -910,7 +910,7 @@ private function getPHPExecutableFromPath(): ?string /** * test against CVE-2023-28115 - * fix and test by @AntoineLelaisant + * fix and test by @AntoineLelaisant. */ public function testFailingGenerateWithOutputContainingPharPrefix(): void { diff --git a/tests/Unit/PdfTest.php b/tests/Unit/PdfTest.php index 8a49ff6..faaa13e 100644 --- a/tests/Unit/PdfTest.php +++ b/tests/Unit/PdfTest.php @@ -32,7 +32,7 @@ protected function tearDown(): void $htmlFiles = new \CallbackFilterIterator( new \DirectoryIterator(__DIR__), - function ($filename) { + function($filename) { return 1 === \preg_match('/\.html$/', $filename); } );