Skip to content

Commit c3e34a0

Browse files
committed
Support for PHP7.1 (min.)
1 parent c467fe0 commit c3e34a0

File tree

4 files changed

+22
-50
lines changed

4 files changed

+22
-50
lines changed

.github/workflows/ci.yml

+9-34
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ jobs:
88
strategy:
99
matrix:
1010
php-version:
11+
- "7.1"
12+
- "7.2"
13+
- "7.3"
1114
- "7.4"
1215
- "8.0"
1316
- "8.1"
@@ -76,42 +79,14 @@ jobs:
7679
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
7780
restore-keys: ${{ runner.os }}-composer-
7881

79-
- name: Install dependencies
80-
run: composer install --no-progress --prefer-dist --optimize-autoloader
81-
82-
- name: Code style with PHP-CS-Fixer
83-
run: ./vendor/bin/php-cs-fixer fix --dry-run --show-progress=none --using-cache=no -v --format=checkstyle | cs2pr
84-
85-
phpcs:
86-
runs-on: ubuntu-latest
87-
steps:
88-
- name: Checkout
89-
uses: actions/checkout@v2
82+
- name: Composer Install
83+
run: composer global require friendsofphp/php-cs-fixer
9084

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

99-
- name: Get composer cache directory
100-
id: composer-cache
101-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
102-
103-
- name: Cache composer dependencies
104-
uses: actions/cache@v2
105-
with:
106-
path: ${{ steps.composer-cache.outputs.dir }}
107-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
108-
restore-keys: ${{ runner.os }}-composer-
109-
110-
- name: Install dependencies
111-
run: composer install --no-progress --prefer-dist --optimize-autoloader
112-
113-
- name: Code style with PHP_CodeSniffer
114-
run: ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip --report=checkstyle | cs2pr
88+
- name: Code style with PHP-CS-Fixer
89+
run: php-cs-fixer fix --dry-run --diff
11590

11691
coverage:
11792
runs-on: ubuntu-latest

composer.json

+4-7
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,23 @@
5858
"fix": "Fixes issues found by PHP-CS"
5959
},
6060
"require": {
61-
"php": "^7.4 || ^8.0",
61+
"php": "^7.1|^8.0",
6262
"ext-dom": "*",
6363
"ext-json": "*",
6464
"ext-xml": "*",
65-
"laminas/laminas-escaper": "^2.10"
65+
"laminas/laminas-escaper": ">=2.6"
6666
},
6767
"require-dev": {
6868
"ext-zip": "*",
6969
"ext-gd": "*",
7070
"ext-libxml": "*",
7171
"dompdf/dompdf": "^2.0",
72-
"friendsofphp/php-cs-fixer": "^3.11",
7372
"mpdf/mpdf": "^8.1",
7473
"php-coveralls/php-coveralls": "^2.5",
75-
"phploc/phploc": "^7.0",
7674
"phpmd/phpmd": "^2.13",
77-
"phpunit/phpunit": "^9.5",
78-
"squizlabs/php_codesniffer": "^3.7",
75+
"phpunit/phpunit": ">=7.0",
7976
"tecnickcom/tcpdf": "^6.5",
80-
"symfony/process": "^5.4"
77+
"symfony/process": "^4.4"
8178
},
8279
"suggest": {
8380
"ext-zip": "Allows writing OOXML and ODF",

tests/PhpWordTests/Shared/HtmlTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -501,15 +501,15 @@ public function testParseTableCellspacingRowBgColor(): void
501501
public function testParseTableStyleAttributeInlineStyle(): void
502502
{
503503
$phpWord = new PhpWord();
504-
$section = $phpWord->addSection();
504+
$section = $phpWord->addSection([
505+
'orientation' => \PhpOffice\PhpWord\Style\Section::ORIENTATION_LANDSCAPE,
506+
]);
505507

506-
$html = <<<HTML
507-
<table style="background-color:red;width:100%;" bgColor="lightgreen" width="50%">
508-
<tr>
509-
<td>A</td>
510-
</tr>
511-
</table>
512-
HTML;
508+
$html = '<table style="background-color:red;width:100%;" bgColor="lightgreen" width="50%">
509+
<tr>
510+
<td>A</td>
511+
</tr>
512+
</table>';
513513

514514
Html::addHtml($section, $html);
515515
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');

tests/PhpWordTests/Writer/Word2007/Part/DocumentTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public function testWriteImage(): void
408408
// behind
409409
$element = $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:pict/v:shape');
410410
$style = $element->getAttribute('style');
411-
self::assertMatchesRegularExpression('/z\-index:\-[0-9]*/', $style);
411+
self::assertRegExp('/z\-index:\-[0-9]*/', $style);
412412

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

0 commit comments

Comments
 (0)