Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
endelwar committed Nov 4, 2024
2 parents 62c8704 + 35047c7 commit 702d761
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ tests/ export-ignore
.gitignore export-ignore
.php-cs-fixer-dist.php export-ignore
infection.json.dist export-ignore
phpstan.neon.dist export-ignore
phpstan.dist.neon export-ignore
phpstan-baseline.neon export-ignore
phpunit.xml.dist export-ignore
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"

name: PHP ${{ matrix.php-version }}

Expand Down Expand Up @@ -47,7 +48,7 @@ jobs:
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run PHPStan
run: phpstan --xdebug analyse src
run: phpstan analyse src

- name: Test with PHPUnit
run: ./vendor/bin/phpunit
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ and this project adheres to [Semantic Versioning(https://semver.org/spec/v2.0.0.

## Unreleased

## 1.5.0 - 2024-11-04
### Added
- Support WeasyPrint 63.0 new `srgb` option
- Added support for PHP 8.4

## 1.4.0 - 2023-11-20
### Changed
- Added support for Symfony 7.0 and PHP 8.3

## 1.3.0 - 2023-10-07
### Added
- Support WeasyPrint 60.0 new option
- Support WeasyPrint 60.0 new `timeout` option

## 1.2.0 - 2023-05-11
### Added
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ $pdf->generateFromHtml('<h1>Bill</h1><p>You owe me money, dude.</p>', '/tmp/bill
$pdf = new Pdf('/usr/local/bin/weasyprint');
$pdf->setOption('encoding', 'utf8');
$pdf->setOption('media-type', 'screen');
$pdf->setOption('presentational-hints');
$pdf->setOption('optimize-size', 'all');
$pdf->setOption('presentational-hints', true);
$pdf->setOption('optimize-images', true);
$pdf->setOption('stylesheet', ['/path/to/first-style.css', '/path/to/second-style.css']);
$pdf->setOption('attachment', ['/path/to/image.png', '/path/to/logo.jpg']);
```
Expand All @@ -83,7 +83,7 @@ $pdf->resetOptions();

## Differences with Snappy

Although PhpWeasyPrint and Snappy are interchangeable, there are a couple of differences between the two, due to WeasyPrint cli API:
Although PhpWeasyPrint and Snappy are interchangeable, there are a couple of differences between the two, due to WeasyPrint CLI API:

* WeasyPrint doesn't support multiple sources to be merged in one single output pdf, so only one input source (string or URL) is accepted in PhpWeasyPrint;
* WeasyPrint version >= 53 doesn't generate images, so image generation from HTML string or URL is possible only with WeasyPrint lower versions and an unsupported PhpWeasyPrint version (`Pontedilana\PhpWeasyPrint\Image` has been successfully tested with Weasyprint 52.5 on PhpWeasyPrint 0.13.0).
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
}
],
"require": {
"php": "7.4.* || 8.0.* || 8.1.* || 8.2.* || 8.3.*",
"php": "7.4.* || 8.0.* || 8.1.* || 8.2.* || 8.3.* || 8.4.*",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/process": "^5.4 || ^6.2 || ^7"
"symfony/process": "^5.4 || ^6.2 || ^7"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.2",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
"friendsofphp/php-cs-fixer": "^3.64",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-phpunit": "^1.4",
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 11 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
includes:
- phpstan-baseline.neon

parameters:
level: 8
paths:
- src/
- tests/
inferPrivatePropertyTypeFromConstructor: true
ignoreErrors:
- identifier: missingType.iterableValue
10 changes: 0 additions & 10 deletions phpstan.neon.dist

This file was deleted.

2 changes: 1 addition & 1 deletion src/AbstractGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class AbstractGenerator implements GeneratorInterface, LoggerAwareInter
* @param array<string, bool|string|array|null> $options
* @param array<string, mixed>|null $env
*/
public function __construct(string $binary = null, array $options = [], array $env = null)
public function __construct(?string $binary = null, array $options = [], ?array $env = null)
{
$this->configure();

Expand Down
3 changes: 2 additions & 1 deletion src/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Pdf extends AbstractGenerator
/**
* {@inheritdoc}
*/
public function __construct(string $binary = null, array $options = [], array $env = null)
public function __construct(?string $binary = null, array $options = [], ?array $env = null)
{
$this->setDefaultExtension('pdf');
$this->setOptionsWithContentCheck();
Expand Down Expand Up @@ -121,6 +121,7 @@ protected function configure(): void
'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
'srgb' => null, // added in WeasyPrint 63.0
// Deprecated
'format' => null, // deprecated in WeasyPrint 53.0b2
'resolution' => null, // deprecated - png only
Expand Down

0 comments on commit 702d761

Please sign in to comment.