Skip to content

Support for PHP7.1 (min.) #2302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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