Skip to content

Commit

Permalink
Php8 (#11)
Browse files Browse the repository at this point in the history
* Require PHP 8.0+

* Set max phpstan level and fix errors
  • Loading branch information
nicolaasuni authored Nov 13, 2023
1 parent 668b3c4 commit cd42dd0
Show file tree
Hide file tree
Showing 15 changed files with 1,202 additions and 388 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php-version: ["8.0", "8.1", "8.2"]
experimental: [false]
os: [ubuntu-latest]
coverage-extension: [pcov]
include:
#- { php-version: '5.3', experimental: false, os: ubuntu-latest, coverage-extension: 'xdebug' }
#- { php-version: '5.4', experimental: false, os: ubuntu-latest, coverage-extension: 'xdebug' }
- { php-version: '5.5', experimental: false, os: ubuntu-latest, coverage-extension: 'xdebug' }
- { php-version: '5.6', experimental: false, os: ubuntu-latest, coverage-extension: 'xdebug' }
- { php-version: '7.1', experimental: false, os: ubuntu-latest, coverage-extension: 'xdebug' }
steps:
- uses: actions/checkout@v4
- name: Use php ${{ matrix.php-version }}
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
**/.vagrant
**/auth.json
**/nbproject
**/temp.php
**/test.php
.phpdoc
.phpunit.cache
.phpunit.result.cache
composer.lock
ecs.php
phpunit.xml
rector.php
target
vendor
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ All artifacts are generated in the target directory.

Examples are located in the `example` directory.

Start a development server (requires PHP 5.4) using the command:
Start a development server (requires PHP 8.0+) using the command:

```
make server
Expand All @@ -78,15 +78,15 @@ Create a composer.json in your projects root-directory:
```json
{
"require": {
"tecnickcom/tc-lib-pdf-parser": "^2.3"
"tecnickcom/tc-lib-pdf-parser": "^3.0.0"
}
}
```

Or add to an existing project with:

```bash
composer require tecnickcom/tc-lib-pdf-parser ^2.3
composer require tecnickcom/tc-lib-pdf-parser ^3.0.0
```


Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.33
3.0.3
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
}
],
"require": {
"php": ">=5.4",
"php": ">=8.0",
"ext-pcre": "*",
"tecnickcom/tc-lib-pdf-filter": "^1.4"
"tecnickcom/tc-lib-pdf-filter": "^2.0"
},
"require-dev": {
"pdepend/pdepend": "2.13.0",
"phpmd/phpmd": "2.13.0",
"phpunit/phpunit": "10.1.2 || 9.6.7 || 8.5.31 || 7.5.20 || 6.5.14 || 5.7.27 || 4.8.36",
"squizlabs/php_codesniffer": "3.7.2 || 2.9.2"
"phpunit/phpunit": "10.1.2 || 9.6.13",
"squizlabs/php_codesniffer": "3.7.2"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 6 additions & 3 deletions example/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@
*/

// autoloader when using Composer
require ('../vendor/autoload.php');
require(__DIR__ . '/../vendor/autoload.php');

// autoloader when using RPM or DEB package installation
//require ('/usr/share/php/Com/Tecnick/Pdf/Parser/autoload.php');

$filename = '../resources/test/example_036.pdf';
$rawdata = file_get_contents($filename);
if ($rawdata === false) {
die('Unable to get the content of the file: '.$filename);
die('Unable to get the content of the file: ' . $filename);
}

// configuration parameters for parser
$cfg = array('ignore_filter_errors' => true);
$cfg = [
'ignore_filter_errors' => true,
];

// parse PDF data
$pdf = new \Com\Tecnick\Pdf\Parser\Parser($cfg);
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 5
level: max
paths:
- src
- test
Expand Down
2 changes: 1 addition & 1 deletion resources/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Vcs-Git: https://github.com/~#VENDOR#~/~#PROJECT#~.git
Package: ~#PKGNAME#~
Provides: php-~#PROJECT#~
Architecture: all
Depends: php (>= 5.4.0), php-tecnickcom-tc-lib-pdf-filter (<< 2.0.0), php-tecnickcom-tc-lib-pdf-filter (>= 1.4.37), ${misc:Depends}
Depends: php (>= 8.0.0), php-tecnickcom-tc-lib-pdf-filter (<< 2.0.0), php-tecnickcom-tc-lib-pdf-filter (>= 2.0.6), ${misc:Depends}
Description: PHP PDF Parser Library
PHP library to parse PDF documents.
4 changes: 2 additions & 2 deletions resources/rpm/rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ URL: https://github.com/%{gh_owner}/%{gh_project}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
BuildArch: noarch

Requires: php(language) >= 5.4.0
Requires: php(language) >= 8.0.0
Requires: php-composer(%{c_vendor}/tc-lib-pdf-filter) < 2.0.0
Requires: php-composer(%{c_vendor}/tc-lib-pdf-filter) >= 1.4.37
Requires: php-composer(%{c_vendor}/tc-lib-pdf-filter) >= 2.0.6
Requires: php-pcre

Provides: php-composer(%{c_vendor}/%{gh_project}) = %{version}
Expand Down
28 changes: 14 additions & 14 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/**
* Exception.php
*
* @since 2011-05-23
* @category Library
* @package PdfParser
* @author Nicola Asuni <[email protected]>
* @copyright 2011-2023 Nicola Asuni - Tecnick.com LTD
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* @link https://github.com/tecnickcom/tc-lib-pdf-parser
* @since 2011-05-23
* @category Library
* @package PdfParser
* @author Nicola Asuni <[email protected]>
* @copyright 2011-2023 Nicola Asuni - Tecnick.com LTD
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* @link https://github.com/tecnickcom/tc-lib-pdf-parser
*
* This file is part of tc-lib-pdf-parser software library.
*/
Expand All @@ -21,13 +21,13 @@
*
* Custom Exception class
*
* @since 2011-05-23
* @category Library
* @package PdfParser
* @author Nicola Asuni <[email protected]>
* @copyright 2011-2023 Nicola Asuni - Tecnick.com LTD
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* @link https://github.com/tecnickcom/tc-lib-pdf-parser
* @since 2011-05-23
* @category Library
* @package PdfParser
* @author Nicola Asuni <[email protected]>
* @copyright 2011-2023 Nicola Asuni - Tecnick.com LTD
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* @link https://github.com/tecnickcom/tc-lib-pdf-parser
*/
class Exception extends \Exception
{
Expand Down
Loading

0 comments on commit cd42dd0

Please sign in to comment.