Skip to content

Commit

Permalink
Merge pull request PHPOffice#2302 from Progi1984/php7.1+
Browse files Browse the repository at this point in the history
Support for PHP7.1 (min.)
  • Loading branch information
Progi1984 authored Sep 26, 2022
2 parents c467fe0 + c3e34a0 commit f92ec7e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 50 deletions.
43 changes: 9 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ jobs:
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
Expand Down Expand Up @@ -76,42 +79,14 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Code style with PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --show-progress=none --using-cache=no -v --format=checkstyle | cs2pr

phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Composer Install
run: composer global require friendsofphp/php-cs-fixer

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none
tools: cs2pr
- name: Add environment path
run: export PATH="$PATH:$HOME/.composer/vendor/bin"

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Code style with PHP_CodeSniffer
run: ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip --report=checkstyle | cs2pr
- name: Code style with PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff

coverage:
runs-on: ubuntu-latest
Expand Down
11 changes: 4 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,23 @@
"fix": "Fixes issues found by PHP-CS"
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^7.1|^8.0",
"ext-dom": "*",
"ext-json": "*",
"ext-xml": "*",
"laminas/laminas-escaper": "^2.10"
"laminas/laminas-escaper": ">=2.6"
},
"require-dev": {
"ext-zip": "*",
"ext-gd": "*",
"ext-libxml": "*",
"dompdf/dompdf": "^2.0",
"friendsofphp/php-cs-fixer": "^3.11",
"mpdf/mpdf": "^8.1",
"php-coveralls/php-coveralls": "^2.5",
"phploc/phploc": "^7.0",
"phpmd/phpmd": "^2.13",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7",
"phpunit/phpunit": ">=7.0",
"tecnickcom/tcpdf": "^6.5",
"symfony/process": "^5.4"
"symfony/process": "^4.4"
},
"suggest": {
"ext-zip": "Allows writing OOXML and ODF",
Expand Down
16 changes: 8 additions & 8 deletions tests/PhpWordTests/Shared/HtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,15 @@ public function testParseTableCellspacingRowBgColor(): void
public function testParseTableStyleAttributeInlineStyle(): void
{
$phpWord = new PhpWord();
$section = $phpWord->addSection();
$section = $phpWord->addSection([
'orientation' => \PhpOffice\PhpWord\Style\Section::ORIENTATION_LANDSCAPE,
]);

$html = <<<HTML
<table style="background-color:red;width:100%;" bgColor="lightgreen" width="50%">
<tr>
<td>A</td>
</tr>
</table>
HTML;
$html = '<table style="background-color:red;width:100%;" bgColor="lightgreen" width="50%">
<tr>
<td>A</td>
</tr>
</table>';

Html::addHtml($section, $html);
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
Expand Down
2 changes: 1 addition & 1 deletion tests/PhpWordTests/Writer/Word2007/Part/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public function testWriteImage(): void
// behind
$element = $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:pict/v:shape');
$style = $element->getAttribute('style');
self::assertMatchesRegularExpression('/z\-index:\-[0-9]*/', $style);
self::assertRegExp('/z\-index:\-[0-9]*/', $style);

// square
$element = $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:pict/v:shape/w10:wrap');
Expand Down

0 comments on commit f92ec7e

Please sign in to comment.