Support for PHP7.1 (min.)

This commit is contained in:
Progi1984 2022-09-25 21:43:00 +02:00
parent c467fe02d3
commit c3e34a0d24
4 changed files with 22 additions and 50 deletions

View File

@ -8,6 +8,9 @@ jobs:
strategy: strategy:
matrix: matrix:
php-version: php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4" - "7.4"
- "8.0" - "8.0"
- "8.1" - "8.1"
@ -76,42 +79,14 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies - name: Composer Install
run: composer install --no-progress --prefer-dist --optimize-autoloader run: composer global require friendsofphp/php-cs-fixer
- name: Add environment path
run: export PATH="$PATH:$HOME/.composer/vendor/bin"
- name: Code style with PHP-CS-Fixer - 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 run: php-cs-fixer fix --dry-run --diff
phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- 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: 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
coverage: coverage:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -58,26 +58,23 @@
"fix": "Fixes issues found by PHP-CS" "fix": "Fixes issues found by PHP-CS"
}, },
"require": { "require": {
"php": "^7.4 || ^8.0", "php": "^7.1|^8.0",
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-xml": "*", "ext-xml": "*",
"laminas/laminas-escaper": "^2.10" "laminas/laminas-escaper": ">=2.6"
}, },
"require-dev": { "require-dev": {
"ext-zip": "*", "ext-zip": "*",
"ext-gd": "*", "ext-gd": "*",
"ext-libxml": "*", "ext-libxml": "*",
"dompdf/dompdf": "^2.0", "dompdf/dompdf": "^2.0",
"friendsofphp/php-cs-fixer": "^3.11",
"mpdf/mpdf": "^8.1", "mpdf/mpdf": "^8.1",
"php-coveralls/php-coveralls": "^2.5", "php-coveralls/php-coveralls": "^2.5",
"phploc/phploc": "^7.0",
"phpmd/phpmd": "^2.13", "phpmd/phpmd": "^2.13",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": ">=7.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5", "tecnickcom/tcpdf": "^6.5",
"symfony/process": "^5.4" "symfony/process": "^4.4"
}, },
"suggest": { "suggest": {
"ext-zip": "Allows writing OOXML and ODF", "ext-zip": "Allows writing OOXML and ODF",

View File

@ -501,15 +501,15 @@ HTML;
public function testParseTableStyleAttributeInlineStyle(): void public function testParseTableStyleAttributeInlineStyle(): void
{ {
$phpWord = new PhpWord(); $phpWord = new PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection([
'orientation' => \PhpOffice\PhpWord\Style\Section::ORIENTATION_LANDSCAPE,
]);
$html = <<<HTML $html = '<table style="background-color:red;width:100%;" bgColor="lightgreen" width="50%">
<table style="background-color:red;width:100%;" bgColor="lightgreen" width="50%"> <tr>
<tr> <td>A</td>
<td>A</td> </tr>
</tr> </table>';
</table>
HTML;
Html::addHtml($section, $html); Html::addHtml($section, $html);
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');

View File

@ -408,7 +408,7 @@ class DocumentTest extends \PHPUnit\Framework\TestCase
// behind // behind
$element = $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:pict/v:shape'); $element = $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:pict/v:shape');
$style = $element->getAttribute('style'); $style = $element->getAttribute('style');
self::assertMatchesRegularExpression('/z\-index:\-[0-9]*/', $style); self::assertRegExp('/z\-index:\-[0-9]*/', $style);
// square // square
$element = $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:pict/v:shape/w10:wrap'); $element = $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:pict/v:shape/w10:wrap');