Skip to content

Commit

Permalink
Support for PHP > 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiang committed Nov 26, 2024
1 parent 8f3fc40 commit 4dd9b74
Show file tree
Hide file tree
Showing 13 changed files with 155 additions and 7,450 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.gitignore export-ignore
.gitattributes export-ignore
.scrutinizer.yml export-ignore
.editorconfig export-ignore
phpunit.xml.dist export-ignore
behat.yml export-ignore
composer.lock export-ignore
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: CI

on: [push, pull_request]

jobs:
static:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Psalm
uses: docker://vimeo/psalm-github-actions
with:
security_analysis: true
report_file: results.sarif
composer_ignore_platform_reqs: true

- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif

# we may use whatever way to install phpcs, just specify the path on the next step
# however, curl seems to be the fastest
- name: Install PHP_CodeSniffer
run: |
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
php phpcs.phar --version
- uses: tinovyatkin/action-php-codesniffer@v1
with:
files: "**.php" # you may customize glob as needed
phpcs_path: php phpcs.phar
standard: phpcs.xml

unittest:
runs-on: ubuntu-latest

strategy:
matrix:
php:
- version: 7.4
coverage: false
composer-args: ''
- version: 8.0
coverage: false
composer-args: ''
- version: 8.1
coverage: false
composer-args: ''
- version: 8.2
coverage: false
composer-args: ''
- version: 8.3
coverage: true
composer-args: ''
- version: 8.4
coverage: false
composer-args: '--ignore-platform-req=php'
prefer-lowest: ['', '--prefer-lowest']

name: Unit Tests - PHP ${{ matrix.php.version }} ${{ matrix.prefer-lowest }}

steps:
- uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php.version }}

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer update --prefer-dist --no-progress --with-all-dependencies ${{ matrix.prefer-lowest }} ${{ matrix.php.composer-args }}

- name: Run test suite
if: ${{ ! matrix.php.coverage }}
run: ./vendor/bin/phpunit

- name: Run test suite with code coverage
if: ${{ matrix.php.coverage }}
run: ./vendor/bin/phpunit --coverage-clover=build/logs/clover.xml
env:
XDEBUG_MODE: coverage

- name: Upload code coverage to Scrutinizer
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml || true
36 changes: 0 additions & 36 deletions .github/workflows/static.yml

This file was deleted.

52 changes: 0 additions & 52 deletions .github/workflows/unit.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/nbproject/private/
phpunit.xml
.phpcs-cache
composer.lock
47 changes: 23 additions & 24 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
imports:
- php
- php

build:
environment:
php: 8.0.0
nodes:
analysis:
project_setup:
override:
- 'true'
tests:
override:
- php-scrutinizer-run
-
command: phpcs-run
environment:
php: 8.0.0
nodes:
analysis:
project_setup:
override:
- "true"
tests:
override:
- php-scrutinizer-run
- command: phpcs-run

filter:
excluded_paths:
- 'tests/*'
- 'bin/*'
excluded_paths:
- "tests/*"
- "bin/*"

checks:
php: true
php: true

coding_style:
php:
spaces:
around_operators:
concatenation: true
php:
spaces:
around_operators:
concatenation: true

tools:
php_cs_fixer: false
external_code_coverage:
timeout: 300
php_cs_fixer: false
external_code_coverage:
timeout: 300
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
Laminas binding for [fabiang/doctrine-dynamic](https://github.com/fabiang/doctrine-dynamic).

[![Latest Stable Version](https://poser.pugx.org/fabiang/doctrine-dynamic-laminas/version)](https://packagist.org/packages/fabiang/doctrine-dynamic-laminas)
[![PHP Version Require](http://poser.pugx.org/fabiang/doctrine-dynamic-laminas/require/php)](https://packagist.org/packages/fabiang/doctrine-dynamic-laminas)
[![License](https://poser.pugx.org/fabiang/doctrine-dynamic-laminas/license)](https://packagist.org/packages/fabiang/doctrine-dynamic-laminas)
[![Unit Tests](https://github.com/fabiang/doctrine-dynamic-laminas/actions/workflows/unit.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic-laminas/actions/workflows/unit.yml)
[![Static Code Analysis](https://github.com/fabiang/doctrine-dynamic-laminas/actions/workflows/static.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic-laminas/actions/workflows/static.yml)
[![PHP Version Require](https://poser.pugx.org/fabiang/doctrine-dynamic-laminas/require/php)](https://packagist.org/packages/fabiang/doctrine-dynamic-laminas)
[![License](https://poser.pugx.org/fabiang/doctrine-dynamic-laminas/license)](https://packagist.org/packages/fabiang/doctrine-dynamic-laminas)
[![CI](https://github.com/fabiang/doctrine-dynamic-laminas/actions/workflows/ci.yml/badge.svg)](https://github.com/fabiang/doctrine-dynamic-laminas/actions/workflows/ci.yml)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic-laminas/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic-laminas/?branch=develop)
[![Code Coverage](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic-laminas/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/fabiang/doctrine-dynamic-laminas/?branch=develop)

Expand Down
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@
}
},
"require": {
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"doctrine/doctrine-orm-module": "^3.0 || ^4.0 || ^5.1",
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"doctrine/doctrine-orm-module": "^3.0 || ^4.0 || ^5.1 || ^6.0",
"doctrine/orm": "^2.5",
"fabiang/doctrine-dynamic": "^1.0 || ^2.0",
"laminas/laminas-stdlib": "^3.12",
"laminas/laminas-eventmanager": "^3.0",
"laminas/laminas-modulemanager": "^2.9",
"laminas/laminas-mvc": "^3.0",
"laminas/laminas-servicemanager": "^3.0"
},
"require-dev": {
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"laminas/laminas-coding-standard": "^2.3",
"vimeo/psalm": "^4.23"
"phpspec/prophecy-phpunit": ">=2.3",
"phpspec/prophecy": ">=1.20",
"phpunit/phpunit": ">=9.6.21",
"laminas/laminas-coding-standard": ">=2.3",
"webmozart/assert": ">=1.11.0",
"vimeo/psalm": ">=5.26"
},
"replace": {
"fabiang/doctrine-dynamic-zf": "*"
Expand Down
Loading

0 comments on commit 4dd9b74

Please sign in to comment.