Skip to content

Commit

Permalink
Merge branch 'support-redefine-php8' into support-redefine
Browse files Browse the repository at this point in the history
  • Loading branch information
siggi-k authored Mar 15, 2024
2 parents 099de69 + ce31242 commit 0e37140
Show file tree
Hide file tree
Showing 62 changed files with 4,072 additions and 1,420 deletions.
6 changes: 6 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# These are supported funding model platforms

github: goetas
patreon: goetas
custom: https://www.goetas.com/
130 changes: 130 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build and test
on: [push, pull_request]

jobs:
build:
name: Build (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Get composer cache directory
id: composer-cache
run: |
dir="$(composer config cache-files-dir)"
echo "dir=$dir" >> $GITHUB_OUTPUT
- 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 composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

test:
name: Tests (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
php-versions: ['8.1', '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3

# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP with PCOV
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: php-cs-fixer, phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
coverage: pcov
#ini-values: post_max_size=256M, max_execution_time=180

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

- name: Run unit tests with coverage
run: ./vendor/bin/phpunit

- name: Determine coverage badge
uses: timkrase/phpunit-coverage-badge@main
with:
push_badge: true
repo_token: ${{ secrets.GITHUB_TOKEN }}

qa-phpstan:
name: QA - Run phpstan (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3

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

- name: Run phpstan
run: ./vendor/bin/phpstan analyse -c ./phpstan.neon --level 6 src

qa-psalm:
name: QA - Run psalm (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3

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

- name: Run psalm
run: ./vendor/bin/psalm

qa-phpcpd:
name: QA - Run phpcpd (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3

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

- name: Run phpcpd
run: ./vendor/bin/phpcpd ./src/

qa-cs-fixer:
name: QA - Run php-cs-fixer (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3

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

- name: Run php-cs-fixer
run: ./vendor/bin/php-cs-fixer fix --verbose --allow-risky=yes --dry-run --config ".php-cs-fixer.dist"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ vendor/
/.php_cs.cache
/phpunit/
/composer.lock
/.phpunit.result.cache
/.php-cs-fixer.cache
41 changes: 41 additions & 0 deletions .php-cs-fixer.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

// see also https://github.com/symfony/symfony/blob/6.1/.php-cs-fixer.dist.php

return (new PhpCsFixer\Config())
->setRules([
'@PHP81Migration' => true,
'@PHPUnit84Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'combine_nested_dirname' => true,
'concat_space' => ['spacing' => 'one'],
'fopen_flags' => false,
'mb_str_functions' => true,
'native_constant_invocation' => false,
'native_function_invocation' => false,
'no_short_bool_cast' => true,
'nullable_type_declaration_for_default_null_value' => true,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_to_comment' => false, // for custom annotations (e.g. php-translation)
'phpdoc_to_param_type' => true,
'phpdoc_to_return_type' => true,
'php_unit_test_annotation' => false, // breaks "@depends App\Something::testFooBar()"
'protected_to_private' => false,
'simplified_null_return' => true,
'no_unreachable_default_argument_value' => false,
])
->setRiskyAllowed(true)
->setFinder(
(new PhpCsFixer\Finder())
->in([
'src',
'tests'
])
->notPath('#/Fixtures/#')
->notPath('#/vendor/#')
)
->setCacheFile('.php-cs-fixer.cache')
;
17 changes: 0 additions & 17 deletions .php_cs.dist

This file was deleted.

23 changes: 0 additions & 23 deletions .scrutinizer.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
[![Build Status](https://travis-ci.org/goetas-webservices/xsd-reader.svg?branch=master)](https://travis-ci.org/goetas-webservices/xsd-reader)
[![Code Coverage](https://scrutinizer-ci.com/g/goetas-webservices/xsd-reader/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/goetas-webservices/xsd-reader/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/goetas-webservices/xsd-reader/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/goetas-webservices/xsd-reader/?branch=master)
[![Build status](https://github.com/goetas-webservices/xsd-reader/workflows/Build%20and%20test/badge.svg)](https://github.com/goetas-webservices/xsd-reader/actions?query=workflow%3A"Build+and+test")
![Code Coverage Badge](./coverage_badge.svg)


PHP XSD Reader
==============
# PHP XSD Reader

Read any [XML Schema](http://www.w3.org/XML/Schema) (XSD) programmatically with PHP.


Installation
------------
## Installation

The recommended way to install the `xsd-reader` via [Composer](https://getcomposer.org/):

```bash
composer require 'goetas-webservices/xsd-reader'
```

Getting started
---------------
## Getting started

```php
use GoetasWebservices\XML\XSDReader\SchemaReader;

$reader = new SchemaReader();
$schema = $reader->readFile("http://www.example.com/exaple.xsd");
$schema = $reader->readFile("http://www.example.com/example.xsd");

// $schema is instance of GoetasWebservices\XML\XSDReader\Schema\Schema;

// Now you can navigate the entire schema structure

foreach ($schema->getSchemas() as $innerSchema){
foreach ($schema->getSchemas() as $innerSchema) {

}
foreach ($schema->getTypes() as $type){
foreach ($schema->getTypes() as $type) {

}
foreach ($schema->getElements() as $element){
foreach ($schema->getElements() as $element) {

}
foreach ($schema->getGroups() as $group){
foreach ($schema->getGroups() as $group) {

}
foreach ($schema->getAttributes() as $attr){
foreach ($schema->getAttributes() as $attr) {

}
foreach ($schema->getAttributeGroups() as $attrGroup){
foreach ($schema->getAttributeGroups() as $attrGroup) {

}
```
## Note

The code in this project is provided under the
[MIT](https://opensource.org/licenses/MIT) license.
For professional support
contact [[email protected]](mailto:[email protected])
## Note

The code in this project is provided under the
[MIT](https://opensource.org/licenses/MIT) license.
For professional support
contact [[email protected]](mailto:[email protected])
or visit [https://www.goetas.com](https://www.goetas.com)
Loading

0 comments on commit 0e37140

Please sign in to comment.