Skip to content

Commit b285578

Browse files
authoredJan 7, 2025··
Added support for PHP 8.4 (#2660)
1 parent f24aabc commit b285578

File tree

505 files changed

+1207
-5910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

505 files changed

+1207
-5910
lines changed
 

‎.github/workflows/php.yml

+98-139
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,124 @@
1-
name: CI
2-
on:
3-
pull_request:
4-
push:
5-
branches:
6-
- master
1+
name: PHPWord
2+
on: [push, pull_request]
73
jobs:
8-
test:
4+
php-cs-fixer:
5+
name: PHP CS Fixer
96
runs-on: ubuntu-latest
10-
strategy:
11-
matrix:
12-
php-version:
13-
- "7.1.3"
14-
- "7.2"
15-
- "7.3"
16-
- "7.4"
17-
- "8.0"
18-
- "8.1"
19-
- "8.2"
20-
- "8.3"
21-
22-
name: PHP ${{ matrix.php-version }}
23-
247
steps:
25-
- name: Checkout
26-
uses: actions/checkout@v3
27-
28-
- name: Setup PHP, with composer and extensions
8+
- name: Setup PHP
299
uses: shivammathur/setup-php@v2
3010
with:
31-
php-version: ${{ matrix.php-version }}
32-
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
33-
coverage: none
34-
35-
- name: Get composer cache directory
36-
id: composer-cache
37-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
38-
39-
- name: Cache composer dependencies
40-
uses: actions/cache@v3
41-
with:
42-
path: ${{ steps.composer-cache.outputs.dir }}
43-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
44-
restore-keys: ${{ runner.os }}-composer-
45-
46-
- name: Remove lock for old EOL PHP versions
47-
if: matrix.php-version == '7.1.3' || matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4'
48-
run: rm composer.lock && composer config platform.php ${{ matrix.php-version }}
11+
php-version: '8.3'
12+
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
13+
- uses: actions/checkout@v2
4914

50-
- name: Install dependencies
51-
run: composer install --no-progress --prefer-dist --optimize-autoloader
15+
- name: Validate composer config
16+
run: composer validate --strict
5217

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

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

59-
- name: Configure matchers
60-
uses: mheap/phpunit-matcher-action@v1
24+
- name: Run PHPCSFixer
25+
run: php-cs-fixer fix --dry-run --diff
6126

62-
- name: Test with PHPUnit
63-
run: ./vendor/bin/phpunit --no-coverage
64-
65-
php-cs-fixer:
27+
phpmd:
28+
name: PHP Mess Detector
6629
runs-on: ubuntu-latest
6730
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v3
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.4'
35+
extensions: gd, xml, zip
36+
- uses: actions/checkout@v2
7037

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

79-
- name: Get composer cache directory
80-
id: composer-cache
81-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
82-
83-
- name: Cache composer dependencies
84-
uses: actions/cache@v3
85-
with:
86-
path: ${{ steps.composer-cache.outputs.dir }}
87-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
88-
restore-keys: ${{ runner.os }}-composer-
89-
90-
- name: Install dependencies
91-
run: composer install --no-progress --prefer-dist --optimize-autoloader
92-
93-
- name: Code style with PHP-CS-Fixer
94-
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
41+
- name: Run phpmd
42+
run: ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude "src/PhpWord/Shared/PCLZip/*"
9543

9644
phpstan:
45+
name: PHP Static Analysis
9746
runs-on: ubuntu-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
# Disabled PHPStan in '7.1'
51+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
9852
steps:
99-
- name: Checkout
100-
uses: actions/checkout@v3
53+
- name: Setup PHP
54+
uses: shivammathur/setup-php@v2
55+
with:
56+
php-version: ${{ matrix.php }}
57+
extensions: gd, xml, zip
58+
- uses: actions/checkout@v2
10159

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

110-
- name: Get composer cache directory
111-
id: composer-cache
112-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
113-
114-
- name: Cache composer dependencies
115-
uses: actions/cache@v3
116-
with:
117-
path: ${{ steps.composer-cache.outputs.dir }}
118-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
119-
restore-keys: ${{ runner.os }}-composer-
63+
- name: Run phpstan
64+
run: ./vendor/bin/phpstan analyse -c phpstan.neon.dist
12065

121-
- name: Install dependencies
122-
run: composer install --no-progress --prefer-dist --optimize-autoloader
123-
124-
- name: Static analysis with PHPStan
125-
run: ./vendor/bin/phpstan analyse
126-
127-
coverage:
66+
phpunit:
67+
name: PHPUnit ${{ matrix.php }}
12868
runs-on: ubuntu-latest
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
12973
steps:
130-
- name: Checkout
131-
uses: actions/checkout@v3
132-
with:
133-
fetch-depth: 0
74+
- name: Setup PHP
75+
uses: shivammathur/setup-php@v2
76+
with:
77+
php-version: ${{ matrix.php }}
78+
extensions: gd, xml, zip
79+
coverage: ${{ (matrix.php == '7.3') && 'xdebug' || 'none' }}
80+
81+
- uses: actions/checkout@v2
82+
83+
- name: Composer Install
84+
run: composer install --ansi --prefer-dist --no-interaction --no-progress
85+
86+
- name: Run phpunit
87+
if: matrix.php != '7.3'
88+
run: ./vendor/bin/phpunit -c phpunit.xml.dist --no-coverage
89+
90+
- name: Run phpunit
91+
if: matrix.php == '7.3'
92+
run: ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/clover.xml
93+
94+
- name: Upload coverage results to Coveralls
95+
if: matrix.php == '7.3'
96+
env:
97+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
run: |
99+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
100+
chmod +x php-coveralls.phar
101+
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv
102+
103+
samples:
104+
name: Check samples
105+
runs-on: ubuntu-latest
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
110+
steps:
111+
- name: Setup PHP
112+
uses: shivammathur/setup-php@v2
113+
with:
114+
php-version: ${{ matrix.php }}
115+
extensions: gd, xml, zip
116+
coverage: xdebug
134117

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

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

146-
- name: Cache composer dependencies
147-
uses: actions/cache@v3
148-
with:
149-
path: ${{ steps.composer-cache.outputs.dir }}
150-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
151-
restore-keys: ${{ runner.os }}-composer-
152-
153-
- name: Install dependencies
154-
run: composer install --no-progress --prefer-dist --optimize-autoloader
155-
156-
- name: Run phpunit
157-
run: ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/clover.xml
158-
159-
- name: Upload coverage results to Coveralls
160-
env:
161-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162-
run: |
163-
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
164-
chmod +x php-coveralls.phar
165-
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv
123+
- name: Generate samples files
124+
run: composer run samples

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/composer.lock
2+
3+
14
.DS_Store
25
._*
36
.Spotlight-V100

0 commit comments

Comments
 (0)
Please sign in to comment.