Skip to content

resolve merge conflict #6

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 11 commits into from
Jan 26, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
237 changes: 98 additions & 139 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,165 +1,124 @@
name: CI
on:
pull_request:
push:
branches:
- master
name: PHPWord
on: [push, pull_request]
jobs:
test:
php-cs-fixer:
name: PHP CS Fixer
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.1.3"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

name: PHP ${{ matrix.php-version }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP, with composer and extensions
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none

- 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@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Remove lock for old EOL PHP versions
if: matrix.php-version == '7.1.3' || matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4'
run: rm composer.lock && composer config platform.php ${{ matrix.php-version }}
php-version: '8.3'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@v2

- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Validate composer config
run: composer validate --strict

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Composer Install
run: composer global require friendsofphp/php-cs-fixer

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Add environment path
run: export PATH="$PATH:$HOME/.composer/vendor/bin"

- name: Configure matchers
uses: mheap/phpunit-matcher-action@v1
- name: Run PHPCSFixer
run: php-cs-fixer fix --dry-run --diff

- name: Test with PHPUnit
run: ./vendor/bin/phpunit --no-coverage

php-cs-fixer:
phpmd:
name: PHP Mess Detector
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: gd, xml, zip
- uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none
tools: cs2pr
- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- 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@v3
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-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
- name: Run phpmd
run: ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude "src/PhpWord/Shared/PCLZip/*"

phpstan:
name: PHP Static Analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Disabled PHPStan in '7.1'
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, xml, zip
- uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none
tools: cs2pr
- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- 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@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Run phpstan
run: ./vendor/bin/phpstan analyse -c phpstan.neon.dist

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

- name: Static analysis with PHPStan
run: ./vendor/bin/phpstan analyse

coverage:
phpunit:
name: PHPUnit ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, xml, zip
coverage: ${{ (matrix.php == '7.3') && 'xdebug' || 'none' }}

- uses: actions/checkout@v2

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Run phpunit
if: matrix.php != '7.3'
run: ./vendor/bin/phpunit -c phpunit.xml.dist --no-coverage

- name: Run phpunit
if: matrix.php == '7.3'
run: ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/clover.xml

- name: Upload coverage results to Coveralls
if: matrix.php == '7.3'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
chmod +x php-coveralls.phar
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv

samples:
name: Check samples
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, xml, zip
coverage: xdebug

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: xdebug
- uses: actions/checkout@v2

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Cache composer dependencies
uses: actions/cache@v3
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: Run phpunit
run: ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/clover.xml

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
chmod +x php-coveralls.phar
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv
- name: Generate samples files
run: composer run samples
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/composer.lock


.DS_Store
._*
.Spotlight-V100
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PHPWord, a pure PHP library for reading and writing word processing documents.

Copyright (c) 2010-2016 PHPWord.
Copyright (c) 2010-2025 PHPWord.

PHPWord is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3 as published by
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ The following is a basic usage example of the PHPWord library.

```php
<?php
require_once 'bootstrap.php';

// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
Expand Down
28 changes: 0 additions & 28 deletions bootstrap.php

This file was deleted.

Loading