Skip to content

Commit

Permalink
Merge pull request #71 from ujamii/task/drop-old-php
Browse files Browse the repository at this point in the history
Task/drop old php
  • Loading branch information
mgrundkoetter authored Nov 9, 2023
2 parents 5829292 + 4aba49a commit 16a55c1
Show file tree
Hide file tree
Showing 35 changed files with 197 additions and 282 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@2.19.1
uses: shivammathur/setup-php@2.27.1
with:
php-version: '7.4'
php-version: '8.1'
tools: composer
extensions: dom, simplexml

Expand All @@ -42,13 +42,13 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
php: ['8.1', '8.2', '8.3']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@2.19.1
uses: shivammathur/setup-php@2.27.1
with:
php-version: ${{ matrix.php }}
tools: composer
Expand All @@ -70,7 +70,7 @@ jobs:
- name: Run test suite
run: composer run phpunit

- uses: codecov/[email protected].1
- uses: codecov/[email protected].4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage/clover.xml
Expand All @@ -86,12 +86,12 @@ jobs:

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

- name: Setup PHP
uses: shivammathur/setup-php@2.19.1
uses: shivammathur/setup-php@2.27.1
with:
php-version: '7.4'
php-version: '8.1'
tools: composer
coverage: none

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# OpenImmo PHP library

[![Packagist](https://img.shields.io/packagist/v/ujamii/openimmo.svg?colorB=green&style=flat)](https://packagist.org/packages/ujamii/openimmo)
[![Minimum PHP Version](https://img.shields.io/badge/php-7.4%2B-8892BF.svg?style=flat)](https://php.net/)
[![Minimum PHP Version](https://img.shields.io/badge/php-8.1%2B-8892BF.svg?style=flat)](https://php.net/)
[![Continuous Integration](https://github.com/ujamii/openimmo/actions/workflows/php.yml/badge.svg)](https://github.com/ujamii/openimmo/actions)
[![codecov](https://codecov.io/gh/ujamii/openimmo/branch/master/graph/badge.svg?token=97D799UX1B)](https://codecov.io/gh/ujamii/openimmo)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fujamii%2Fopenimmo%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/ujamii/openimmo/master)

OpenImmo and the OpenImmo logo are registered trademarks of the [OpenImmo e.V.](http://www.openimmo.de)
Neither is this package an official distribution nor am I associated with this organisation!

This library just wraps the OpenImmo XML format with some PHP7/8 classes.
This library just wraps the OpenImmo XML format with some PHP8 classes.
If you need support for PHP <= 8.1, see version 1.x of this package. Version 2 is for PHP >=8.2 only.

There is an official library available at http://www.openimmo.de/go.php/p/22/support20.htm which costs 95 EUR excl. VAT and is PHP5 only.
To completely convince you, you will only be allowed to see the code **after** you have paid and they have a no-refund policy.
Expand Down Expand Up @@ -118,7 +119,7 @@ foreach ($openImmo->getAnbieter() as $anbieter) {

Although the OpenImmo standard just describes an XML version, there may be cases when you want to generate JSON from the given data.
Sadly, there is [an issue](https://github.com/schmittjoh/serializer/issues/1251) with custom types, scalar values and JSON serialization in the JMS serializer.
Nevertheless it is still possible to write JSON format with the [Symfony serializer component](https://symfony.com/doc/current/components/serializer.html).
However, it is still possible to write JSON format with the [Symfony serializer component](https://symfony.com/doc/current/components/serializer.html).

```shell
composer require symfony/serializer
Expand Down
4 changes: 2 additions & 2 deletions build/config/infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"configDir": ".\/"
},
"logs": {
"text": "./build/coverage/infection-full.log",
"summary": "./build/coverage/infection-summary.log",
"text": "../coverage/infection-full.log",
"summary": "../coverage/infection-summary.log",
"github": true,
"stryker": {
"badge": "master"
Expand Down
24 changes: 11 additions & 13 deletions build/config/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateClassConstantRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(SetList::DEAD_CODE);
return static function (RectorConfig $rectorConfig): void {
// register single rule
$rectorConfig->rule(TypedPropertyFromStrictConstructorRector::class);

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SKIP, [
RemoveUnusedPrivateClassConstantRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class
// here we can define, what sets of rules will be applied
// tip: use "SetList" class to autocomplete sets with your IDE
$rectorConfig->sets([
SetList::CODE_QUALITY,
SetList::DEAD_CODE
]);
};
};
27 changes: 10 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,32 @@
}
],
"require": {
"php": ">=7.4",
"php": ">=8.1",
"ext-dom": "*",
"ext-simplexml": "*",
"jms/serializer": "^2.1 || ^3.5",
"cweagans/composer-patches": "^1.7 || ^2.0"
},
"extra": {
"platform": {
"php": "8.1"
},
"patches": {
"goetas-webservices/xsd-reader": {
"Fix https://github.com/goetas-webservices/xsd-reader/issues/50": "patches/SchemaReader-ComplexTypeMixed-Issue-3.patch"
}
}
},
"repositories": [
{
"type": "git",
"url": "https://github.com/bnf/php-code-generator.git"
},
{
"type": "git",
"url": "https://github.com/AlexAzartsev/php-code-formatter.git"
}
],
"require-dev": {
"ext-json": "*",
"goetas-webservices/xsd-reader": "^0.3",
"phpunit/phpunit": ">=7.5",
"goetas-webservices/xsd-reader": "^0.4",
"phpunit/phpunit": ">=7.5 <10",
"phpstan/phpstan": "^1.0",
"infection/infection": ">=0.16",
"friendsofphp/php-cs-fixer": "^2.18 || ^3.0",
"rector/rector": ">=0.9",
"friendsofphp/php-cs-fixer": "^3.0",
"rector/rector": ">=0.18",
"symfony/serializer": "^5.3",
"nette/php-generator": "^3.6 || ^4.0"
"nette/php-generator": "^4.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -64,7 +57,7 @@
"@php-cs-fixer"
],
"phpunit": "vendor/bin/phpunit -c build/config/phpunit.xml.dist",
"phpstan": "vendor/bin/phpstan analyse -c build/config/phpstan.neon",
"phpstan": "vendor/bin/phpstan --memory-limit=1G analyse -c build/config/phpstan.neon",
"rector": "vendor/bin/rector process src tests -c build/config/rector.php --xdebug",
"php-cs-fixer": "vendor/bin/php-cs-fixer fix --config build/config/cs.php",
"infection": "vendor/bin/infection --only-covered --configuration=./build/config/infection.json.dist --threads=8 --min-msi=99",
Expand Down
2 changes: 1 addition & 1 deletion generate-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
$xsdFile = './example/openimmo_127b.xsd';

$apiGenerator = new \Ujamii\OpenImmo\Generator\ApiGenerator();
$apiGenerator->generateApiClasses($xsdFile);
$apiGenerator->generateApiClasses($xsdFile);
2 changes: 1 addition & 1 deletion src/API/Anhaenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function __construct(
array $anhang = [],
array $userDefinedSimplefield = [],
array $userDefinedAnyfield = [],
array $userDefinedExtend = []
array $userDefinedExtend = [],
) {
$this->anhang = $anhang;
$this->userDefinedSimplefield = $userDefinedSimplefield;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Anhang.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function __construct(
?string $anhangtitel = null,
string $format = '',
?Check $check = null,
?Daten $daten = null
?Daten $daten = null,
) {
$this->location = $location;
$this->gruppe = $gruppe;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Ausbaustufe.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function __construct(
?bool $ausbauhaus = null,
?bool $schluesselfertigmitkeller = null,
?bool $schluesselfertigohnebodenplatte = null,
?bool $schluesselfertigmitbodenplatte = null
?bool $schluesselfertigmitbodenplatte = null,
) {
$this->bausatzhaus = $bausatzhaus;
$this->ausbauhaus = $ausbauhaus;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Bad.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function __construct(
?bool $wanne = null,
?bool $fenster = null,
?bool $bidet = null,
?bool $pissoir = null
?bool $pissoir = null,
) {
$this->dusche = $dusche;
$this->wanne = $wanne;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Heizungsart.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function __construct(
?bool $etage = null,
?bool $zentral = null,
?bool $fern = null,
?bool $fussboden = null
?bool $fussboden = null,
) {
$this->ofen = $ofen;
$this->etage = $etage;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Objektkategorie.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function __construct(
?Objektart $objektart = null,
array $userDefinedSimplefield = [],
array $userDefinedAnyfield = [],
array $userDefinedExtend = []
array $userDefinedExtend = [],
) {
$this->nutzungsart = $nutzungsart;
$this->vermarktungsart = $vermarktungsart;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Openimmo.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function __construct(
?Uebertragung $uebertragung = null,
array $anbieter = [],
array $userDefinedSimplefield = [],
array $userDefinedAnyfield = []
array $userDefinedAnyfield = [],
) {
$this->uebertragung = $uebertragung;
$this->anbieter = $anbieter;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Serviceleistungen.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function __construct(
?bool $catering = null,
?bool $reinigung = null,
?bool $einkauf = null,
?bool $wachdienst = null
?bool $wachdienst = null,
) {
$this->betreutesWohnen = $betreutesWohnen;
$this->catering = $catering;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Stellplatzart.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function __construct(
?bool $carport = null,
?bool $freiplatz = null,
?bool $parkhaus = null,
?bool $duplex = null
?bool $duplex = null,
) {
$this->garage = $garage;
$this->tiefgarage = $tiefgarage;
Expand Down
7 changes: 5 additions & 2 deletions src/API/StpCarport.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ public function setAnzahl(?int $anzahl): StpCarport
return $this;
}

public function __construct(?float $stellplatzmiete = null, ?float $stellplatzkaufpreis = null, ?int $anzahl = null)
{
public function __construct(
?float $stellplatzmiete = null,
?float $stellplatzkaufpreis = null,
?int $anzahl = null,
) {
$this->stellplatzmiete = $stellplatzmiete;
$this->stellplatzkaufpreis = $stellplatzkaufpreis;
$this->anzahl = $anzahl;
Expand Down
7 changes: 5 additions & 2 deletions src/API/StpDuplex.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ public function setAnzahl(?int $anzahl): StpDuplex
return $this;
}

public function __construct(?float $stellplatzmiete = null, ?float $stellplatzkaufpreis = null, ?int $anzahl = null)
{
public function __construct(
?float $stellplatzmiete = null,
?float $stellplatzkaufpreis = null,
?int $anzahl = null,
) {
$this->stellplatzmiete = $stellplatzmiete;
$this->stellplatzkaufpreis = $stellplatzkaufpreis;
$this->anzahl = $anzahl;
Expand Down
7 changes: 5 additions & 2 deletions src/API/StpFreiplatz.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ public function setAnzahl(?int $anzahl): StpFreiplatz
return $this;
}

public function __construct(?float $stellplatzmiete = null, ?float $stellplatzkaufpreis = null, ?int $anzahl = null)
{
public function __construct(
?float $stellplatzmiete = null,
?float $stellplatzkaufpreis = null,
?int $anzahl = null,
) {
$this->stellplatzmiete = $stellplatzmiete;
$this->stellplatzkaufpreis = $stellplatzkaufpreis;
$this->anzahl = $anzahl;
Expand Down
7 changes: 5 additions & 2 deletions src/API/StpGarage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ public function setAnzahl(?int $anzahl): StpGarage
return $this;
}

public function __construct(?float $stellplatzmiete = null, ?float $stellplatzkaufpreis = null, ?int $anzahl = null)
{
public function __construct(
?float $stellplatzmiete = null,
?float $stellplatzkaufpreis = null,
?int $anzahl = null,
) {
$this->stellplatzmiete = $stellplatzmiete;
$this->stellplatzkaufpreis = $stellplatzkaufpreis;
$this->anzahl = $anzahl;
Expand Down
7 changes: 5 additions & 2 deletions src/API/StpParkhaus.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ public function setAnzahl(?int $anzahl): StpParkhaus
return $this;
}

public function __construct(?float $stellplatzmiete = null, ?float $stellplatzkaufpreis = null, ?int $anzahl = null)
{
public function __construct(
?float $stellplatzmiete = null,
?float $stellplatzkaufpreis = null,
?int $anzahl = null,
) {
$this->stellplatzmiete = $stellplatzmiete;
$this->stellplatzkaufpreis = $stellplatzkaufpreis;
$this->anzahl = $anzahl;
Expand Down
7 changes: 5 additions & 2 deletions src/API/StpTiefgarage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ public function setAnzahl(?int $anzahl): StpTiefgarage
return $this;
}

public function __construct(?float $stellplatzmiete = null, ?float $stellplatzkaufpreis = null, ?int $anzahl = null)
{
public function __construct(
?float $stellplatzmiete = null,
?float $stellplatzkaufpreis = null,
?int $anzahl = null,
) {
$this->stellplatzmiete = $stellplatzmiete;
$this->stellplatzkaufpreis = $stellplatzkaufpreis;
$this->anzahl = $anzahl;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Vermarktungsart.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function __construct(
bool $kauf = false,

Check warning on line 94 in src/API/Vermarktungsart.php

View workflow job for this annotation

GitHub Actions / Tests on PHP 8.1

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $this->leasing = $leasing; return $this; } - public function __construct(bool $kauf = false, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) + public function __construct(bool $kauf = true, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) { $this->kauf = $kauf; $this->mietePacht = $mietePacht;

Check warning on line 94 in src/API/Vermarktungsart.php

View workflow job for this annotation

GitHub Actions / Tests on PHP 8.2

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $this->leasing = $leasing; return $this; } - public function __construct(bool $kauf = false, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) + public function __construct(bool $kauf = true, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) { $this->kauf = $kauf; $this->mietePacht = $mietePacht;

Check warning on line 94 in src/API/Vermarktungsart.php

View workflow job for this annotation

GitHub Actions / Tests on PHP 8.3

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $this->leasing = $leasing; return $this; } - public function __construct(bool $kauf = false, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) + public function __construct(bool $kauf = true, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) { $this->kauf = $kauf; $this->mietePacht = $mietePacht;
bool $mietePacht = false,

Check warning on line 95 in src/API/Vermarktungsart.php

View workflow job for this annotation

GitHub Actions / Tests on PHP 8.1

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $this->leasing = $leasing; return $this; } - public function __construct(bool $kauf = false, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) + public function __construct(bool $kauf = false, bool $mietePacht = true, ?bool $erbpacht = null, ?bool $leasing = null) { $this->kauf = $kauf; $this->mietePacht = $mietePacht;

Check warning on line 95 in src/API/Vermarktungsart.php

View workflow job for this annotation

GitHub Actions / Tests on PHP 8.2

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $this->leasing = $leasing; return $this; } - public function __construct(bool $kauf = false, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) + public function __construct(bool $kauf = false, bool $mietePacht = true, ?bool $erbpacht = null, ?bool $leasing = null) { $this->kauf = $kauf; $this->mietePacht = $mietePacht;

Check warning on line 95 in src/API/Vermarktungsart.php

View workflow job for this annotation

GitHub Actions / Tests on PHP 8.3

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $this->leasing = $leasing; return $this; } - public function __construct(bool $kauf = false, bool $mietePacht = false, ?bool $erbpacht = null, ?bool $leasing = null) + public function __construct(bool $kauf = false, bool $mietePacht = true, ?bool $erbpacht = null, ?bool $leasing = null) { $this->kauf = $kauf; $this->mietePacht = $mietePacht;
?bool $erbpacht = null,
?bool $leasing = null
?bool $leasing = null,
) {
$this->kauf = $kauf;
$this->mietePacht = $mietePacht;
Expand Down
2 changes: 1 addition & 1 deletion src/API/Versteigerung.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function __construct(
?\DateTime $zvtermin = null,
?\DateTime $zusatztermin = null,
?string $amtsgericht = null,
?float $verkehrswert = null
?float $verkehrswert = null,
) {
$this->zwangsversteigerung = $zwangsversteigerung;
$this->aktenzeichen = $aktenzeichen;
Expand Down
Loading

0 comments on commit 16a55c1

Please sign in to comment.