Skip to content

Commit

Permalink
Tests: Update development tools and check PHP 8.1/8.2 support (#553)
Browse files Browse the repository at this point in the history
* updated PHP-CS-Fixer from 2.x to 3.x
* dev tools: bumped version of PHPStan; updated .gitignore with .php-cs-fixer.cache
* CI workflow: enabled PHP 8.1 + PHP 8.2 (at RC2 currently)
* replaced function calls of utf8_encode utf8_encode with mb_convert_encoding - FYI: https://php.watch/versions/8.2/utf8_encode-utf8_decode-deprecated
  • Loading branch information
k00ni committed Sep 26, 2022
1 parent 7c00709 commit 988efcb
Show file tree
Hide file tree
Showing 67 changed files with 500 additions and 337 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -149,6 +151,8 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"

steps:
- name: "Checkout"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
/composer
debug*
composer.lock
/.php_cs.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
30 changes: 19 additions & 11 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
<?php

return PhpCsFixer\Config::create()
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in([
__DIR__.'/src',
__DIR__.'/tests',
])
->name('*.php')
;

$config = new Config();
$config
->setFinder($finder)
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
Expand All @@ -11,13 +25,7 @@
'ordered_imports' => true,
'phpdoc_summary' => false,
'protected_to_private' => false,
])
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->exclude([
'vendor',
])
->in(__DIR__)
->name('*.php')
);
])
;

return $config;
6 changes: 3 additions & 3 deletions dev-tools/composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"description": "This file provides development-only dependencies.",
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"phpstan/phpstan": "^0.12.81",
"phpstan/phpstan-phpunit": "^0.12.18",
"friendsofphp/php-cs-fixer": "^3",
"phpstan/phpstan": "^1",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": ">=7.5"
}
}
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Konrad Abicht <hi@inspirito.de>
*
* @date 2020-11-22
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
4 changes: 3 additions & 1 deletion src/Smalot/PdfParser/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down Expand Up @@ -91,7 +93,7 @@ public function getContent()

public function __toString(): string
{
return (string) ($this->value);
return (string) $this->value;
}

public static function parse(string $content, ?Document $document = null, int &$position = 0)
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
4 changes: 3 additions & 1 deletion src/Smalot/PdfParser/Element/ElementBoolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down Expand Up @@ -43,7 +45,7 @@ class ElementBoolean extends Element
*/
public function __construct($value)
{
parent::__construct(('true' == strtolower($value) || true === $value), null);
parent::__construct('true' == strtolower($value) || true === $value, null);
}

public function __toString(): string
Expand Down
4 changes: 3 additions & 1 deletion src/Smalot/PdfParser/Element/ElementDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHPi, extraction oriented.
Expand Down Expand Up @@ -90,7 +92,7 @@ public function equals($value): bool

public function __toString(): string
{
return (string) ($this->value->format($this->format));
return (string) $this->value->format($this->format);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementHexa.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementMissing.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementName.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementNull.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementNumeric.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementString.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Element/ElementStruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
4 changes: 3 additions & 1 deletion src/Smalot/PdfParser/Element/ElementXRef.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down Expand Up @@ -65,7 +67,7 @@ public function equals($value): bool
&& true === \is_string($this->getContent())
&& 1 === preg_match('/[0-9]+\_[0-9]+/', $this->getContent(), $matches)
) {
return (float) ($this->getContent()) == $value;
return (float) $this->getContent() == $value;
}

$id = ($value instanceof self) ? $value->getId() : $value;
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Encoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Encoding/ISOLatin1Encoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Encoding/ISOLatin9Encoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Encoding/MacRomanEncoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Encoding/PostScriptGlyphs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
* @file This file is part of the PdfParser library.
*
* @author Dāvis Mosāns <davis.mosans@intelligentsystems.lv>
*
* @date 2019-09-17
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Encoding/StandardEncoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
2 changes: 2 additions & 0 deletions src/Smalot/PdfParser/Encoding/WinAnsiEncoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* This file is part of the PdfParser library.
*
* @author Sébastien MALOT <sebastien@malot.fr>
*
* @date 2017-01-03
*
* @license LGPLv3
*
* @url <https://github.com/smalot/pdfparser>
*
* PdfParser is a pdf library written in PHP, extraction oriented.
Expand Down
Loading

0 comments on commit 988efcb

Please sign in to comment.