Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove implicitly nullable parameter declarations #215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
MarkusBauer marked this conversation as resolved.
Show resolved Hide resolved
$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)
MarkusBauer marked this conversation as resolved.
Show resolved Hide resolved
{
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)
MarkusBauer marked this conversation as resolved.
Show resolved Hide resolved
{
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
Loading