Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSlabon authored Sep 2, 2024
2 parents c1fda61 + d9f85ad commit 078aa76
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
level: 5
treatPhpDocTypesAsCertain: false
paths:
- src
#- tests
Expand Down
4 changes: 3 additions & 1 deletion src/GraphicsState.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class GraphicsState
/**
* @param Matrix|null $ctm
*/
public function __construct(Matrix $ctm = null)
public function __construct($ctm = null)
{
if ($ctm === null) {
$ctm = new Matrix();
} elseif (!($ctm instanceof Matrix)) {
throw new \InvalidArgumentException('$ctm must be an instance of Fpdi\\Matrix or null');
}

$this->ctm = $ctm;
Expand Down
5 changes: 4 additions & 1 deletion src/PdfParser/Type/PdfDictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ public static function create(array $entries = [])
* @return PdfNull|PdfType
* @throws PdfTypeException
*/
public static function get($dictionary, $key, PdfType $default = null)
public static function get($dictionary, $key, $default = null)
{
if ($default !== null && !($default instanceof PdfType)) {
throw new \InvalidArgumentException('Default value must be an instance of PdfType or null');
}
$dictionary = self::ensure($dictionary);

if (isset($dictionary->value[$key])) {
Expand Down
7 changes: 5 additions & 2 deletions src/PdfParser/Type/PdfStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ class PdfStream extends PdfType
*
* @param PdfDictionary $dictionary
* @param StreamReader $reader
* @param PdfParser $parser Optional to keep backwards compatibility
* @param PdfParser|null $parser Optional to keep backwards compatibility
* @return self
* @throws PdfTypeException
*/
public static function parse(PdfDictionary $dictionary, StreamReader $reader, PdfParser $parser = null)
public static function parse(PdfDictionary $dictionary, StreamReader $reader, $parser = null)
{
if ($parser !== null && !($parser instanceof PdfParser)) {
throw new \InvalidArgumentException('$parser must be an instance of PdfParser or null');
}
$v = new self();
$v->value = $dictionary;
$v->reader = $reader;
Expand Down

0 comments on commit 078aa76

Please sign in to comment.