From 3c8ffb6f3e3e41b38ee392382db3aee0d01451df Mon Sep 17 00:00:00 2001 From: Janez Urevc Date: Wed, 22 Jul 2026 14:36:51 +0200 Subject: [PATCH 1/2] Prepare 2.0.0: PHP ^8.2, portphp ^2.0, GitHub Actions Breaking major: drop PHP < 8.2 and portphp 1.x. Add void return types, Dependabot, modern README. --- .gitattributes | 2 -- .github/dependabot.yml | 13 ++++++++ .github/workflows/checks.yml | 60 ++++++++++++++++++++++++++++++++++++ .scrutinizer.yml | 7 ----- .travis.yml | 28 ----------------- README.md | 29 ++++------------- UPGRADE-2.0.md | 6 ++++ composer.json | 15 +++++---- phpspec.yml.ci | 10 ------ phpspec.yml.dist | 6 ++-- src/XmlWriter.php | 8 ++--- 11 files changed, 99 insertions(+), 85 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/checks.yml delete mode 100644 .scrutinizer.yml delete mode 100644 .travis.yml create mode 100644 UPGRADE-2.0.md delete mode 100644 phpspec.yml.ci diff --git a/.gitattributes b/.gitattributes index 5841755..82ef09d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,8 +2,6 @@ spec/ export-ignore .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore -.scrutinizer.yml export-ignore -.travis.yml export-ignore CONTRIBUTING.md export-ignore phpspec.yml.ci export-ignore phpspec.yml.dist export-ignore diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f7b8104 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 5 + - package-ecosystem: composer + directory: / + schedule: + interval: monthly + open-pull-requests-limit: 5 + versioning-strategy: widen diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..5881fb2 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,60 @@ +name: Checks + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + test: + strategy: + fail-fast: false + matrix: + php-versions: [ '8.2', '8.3', '8.4', '8.5' ] + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + tools: composer:v2 + + - name: Validate Composer metadata + run: | + if [ -f composer.lock ]; then + composer validate --strict --no-interaction + else + composer validate --strict --no-check-lock --no-interaction + fi + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + + - name: Cache Composer packages + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json', '**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer-${{ matrix.php-versions }}- + + - name: Install dependencies + run: | + if [ -f composer.lock ]; then + composer install --prefer-dist --no-progress --no-interaction + else + composer update --prefer-dist --no-progress --no-interaction + fi + + - name: Run phpspec + run: vendor/bin/phpspec run --config phpspec.yml.dist diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index acbda73..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,7 +0,0 @@ -checks: - php: - code_rating: true - duplication: true - -tools: - external_code_coverage: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d2a5011..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: php - -php: - - 5.6 - - 7.0 - - 7.1 - - hhvm - -matrix: - allow_failures: - - php: 7.0 - - php: hhvm - include: - - php: 5.6 - env: - - COMPOSER_FLAGS="--prefer-lowest --prefer-stable" - - COVERAGE=true - - PHPSPEC_FLAGS="--config phpspec.yml.ci" - -install: - - travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction - -script: - - vendor/bin/phpspec run ${PHPSPEC_FLAGS} - -after_script: - - if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi - - if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/README.md b/README.md index 2c04154..233676f 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,27 @@ -# portphp/xml-adapter +# portphp/xml [![Latest Version](https://img.shields.io/github/release/portphp/xml.svg?style=flat-square)](https://github.com/portphp/xml/releases) -[![Build Status](https://travis-ci.org/portphp/xml.svg)](https://travis-ci.org/portphp/xml) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/portphp/xml/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/portphp/xml/?branch=master) -[![Code Coverage](https://scrutinizer-ci.com/g/portphp/xml/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/portphp/xml/?branch=master) +[![CI](https://github.com/portphp/xml/actions/workflows/checks.yml/badge.svg?branch=master)](https://github.com/portphp/xml/actions/workflows/checks.yml) +[![PHP Version](https://img.shields.io/packagist/php-v/portphp/xml.svg?style=flat-square)](https://packagist.org/packages/portphp/xml) + +**Requirements:** PHP ^8.2 (tested on 8.2–8.5). Requires `portphp/portphp` ^2.0. XML writer for Port. ## Installation -Open a command console, enter your project directory and execute the -following command to download the latest stable version of this package: - ```bash $ composer require portphp/xml ``` -This command requires you to have Composer installed globally, as explained -in the [installation chapter](https://getcomposer.org/doc/00-intro.md) -of the Composer documentation. - ## Documentation -Documentation is available at https://docs.portphp.org. +Documentation is available at https://portphp.readthedocs.io. ## Issues and feature requests Please report issues and request features at https://github.com/portphp/portphp/issues. -## Contributing - -Contributions are very welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for -details. Thanks to [everyone who has contributed](https://github.com/portphp/xml/graphs/contributors) -already. - -## Security - -If you discover any security-related issues, please contact us at -security@portphp.org.sec - ## License This package is licensed under the [MIT license](LICENSE). diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md new file mode 100644 index 0000000..7f1c65e --- /dev/null +++ b/UPGRADE-2.0.md @@ -0,0 +1,6 @@ +# Upgrade from 1.x to 2.0 + +- Minimum PHP is **8.2** (`^8.2`). +- Requires `portphp/portphp` **^2.0**. +- Writer methods use `: void` return types from the core interfaces. +- CI is GitHub Actions (Travis/Scrutinizer removed). diff --git a/composer.json b/composer.json index 93e0d4b..aca5fa8 100644 --- a/composer.json +++ b/composer.json @@ -18,18 +18,18 @@ }, { "name": "Community contributors", - "homepage": "https://github.com/portphp/xml-adapter/graphs/contributors" + "homepage": "https://github.com/portphp/xml/graphs/contributors" } ], "support": { "issues": "https://github.com/portphp/portphp/issues", - "source": "https://github.com/portphp/xml-adapter", - "docs": "https://portphp.readthedocs.org" + "source": "https://github.com/portphp/xml", + "docs": "https://portphp.readthedocs.io" }, "require": { - "php": ">=5.4.0", - "portphp/portphp": "^1.0.0", - "ext-xmlwriter": "*" + "php": "^8.2", + "ext-xmlwriter": "*", + "portphp/portphp": "^2.0" }, "autoload": { "psr-4": { @@ -37,8 +37,7 @@ } }, "require-dev": { - "phpspec/phpspec": "^2.2", - "henrikbjorn/phpspec-code-coverage" : "^1.0" + "phpspec/phpspec": "^8.0" }, "extra": { "branch-alias": { diff --git a/phpspec.yml.ci b/phpspec.yml.ci deleted file mode 100644 index 2bf344b..0000000 --- a/phpspec.yml.ci +++ /dev/null @@ -1,10 +0,0 @@ -suites: - xml_suite: - namespace: Port\Xml - psr4_prefix: Port\Xml -formatter.name: pretty -extensions: - - PhpSpec\Extension\CodeCoverageExtension -code_coverage: - format: clover - output: coverage.clover diff --git a/phpspec.yml.dist b/phpspec.yml.dist index a263e3a..69a5836 100644 --- a/phpspec.yml.dist +++ b/phpspec.yml.dist @@ -1,5 +1,5 @@ suites: - xml_suite: - namespace: Port\Xml - psr4_prefix: Port\Xml + default: + namespace: Port\Xml + psr4_prefix: Port\Xml formatter.name: pretty diff --git a/src/XmlWriter.php b/src/XmlWriter.php index 02782da..e5b961f 100644 --- a/src/XmlWriter.php +++ b/src/XmlWriter.php @@ -64,7 +64,7 @@ public function __construct( /** * {@inheritdoc} */ - public function prepare() + public function prepare(): void { $this->xmlWriter->openUri($this->file); $this->xmlWriter->startDocument($this->version, $this->encoding); @@ -74,7 +74,7 @@ public function prepare() /** * {@inheritdoc} */ - public function writeItem(array $item) + public function writeItem(array $item): void { $this->xmlWriter->startElement($this->itemElement); @@ -88,7 +88,7 @@ public function writeItem(array $item) /** * {@inheritdoc} */ - public function finish() + public function finish(): void { $this->xmlWriter->endElement(); $this->xmlWriter->endDocument(); @@ -98,7 +98,7 @@ public function finish() /** * {@inheritdoc} */ - public function flush() + public function flush(): void { $this->xmlWriter->flush(); } From 4bebfbb8667ce725af794f882170ec37a1d58e25 Mon Sep 17 00:00:00 2001 From: Janez Urevc Date: Wed, 22 Jul 2026 14:52:23 +0200 Subject: [PATCH 2/2] Remove stale phpspec.yml.ci export-ignore entry --- .gitattributes | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 82ef09d..33a3422 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,5 +3,4 @@ spec/ export-ignore .gitattributes export-ignore .gitignore export-ignore CONTRIBUTING.md export-ignore -phpspec.yml.ci export-ignore phpspec.yml.dist export-ignore