Skip to content

Commit

Permalink
Add phpstan check and fix level 0 issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Oct 10, 2023
1 parent 0bd1fdb commit cc6dbfc
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 19 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,22 @@ jobs:
with:
flags: php-${{ matrix.php-version }}-${{ matrix.os }}
name: php-${{ matrix.php-version }}-${{ matrix.os }}

static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use php 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
- name: Cache module
uses: actions/cache@v3
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install phpstan
run: composer require --dev phpstan/phpstan
- name: Analyse files
run: ./vendor/bin/phpstan analyse src test
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.23
2.4.25
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.27), ${misc:Depends}
Depends: php (>= 5.4.0), php-tecnickcom-tc-lib-pdf-filter (<< 2.0.0), php-tecnickcom-tc-lib-pdf-filter (>= 1.4.29), ${misc:Depends}
Description: PHP PDF Parser Library
PHP library to parse PDF documents.
2 changes: 1 addition & 1 deletion resources/rpm/rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BuildArch: noarch

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

Provides: php-composer(%{c_vendor}/%{gh_project}) = %{version}
Expand Down
16 changes: 0 additions & 16 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@
*/
class Parser extends \Com\Tecnick\Pdf\Parser\Process\Xref
{
/**
* Raw content of the PDF document.
*
* @var string
*/
protected $pdfdata = '';

/**
* Array of PDF objects.
*
* @var array
*/
protected $objects = array();

/**
* Array of configuration parameters.
*
Expand Down Expand Up @@ -228,8 +214,6 @@ protected function decodeStream($sdic, $stream)
* @param int $slength Stream length
* @param array $sdic Stream's dictionary array.
* @param int $key Index
*
* @return array Array of filters
*/
protected function getDeclaredStreamLength(&$stream, &$slength, $sdic, $key)
{
Expand Down
14 changes: 14 additions & 0 deletions src/Process/RawObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@
*/
abstract class RawObject
{
/**
* Raw content of the PDF document.
*
* @var string
*/
protected $pdfdata = '';

/**
* Array of PDF objects.
*
* @var array
*/
protected $objects = array();

/**
* Get object type, raw value and offset to next object
*
Expand Down
3 changes: 3 additions & 0 deletions src/Process/Xref.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ abstract class Xref extends \Com\Tecnick\Pdf\Parser\Process\XrefStream
*/
protected $mrkoff = array();


abstract protected function getIndirectObject($obj_ref, $offset = 0, $decoding = true);

/**
* Get Cross-Reference (xref) table and trailer data from PDF document data.
*
Expand Down

0 comments on commit cc6dbfc

Please sign in to comment.