Skip to content

Commit 8fc5436

Browse files
committed
Merge branch 'release/3.0.0'
2 parents 1746756 + 8b338d0 commit 8fc5436

Some content is hidden

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

56 files changed

+1477
-907
lines changed

.docker/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
FROM php:7.1-apache
1+
FROM splitbrain/phpfarm:jessie
22

3-
RUN apt-get update \
4-
&& apt-get install -y git zip
3+
RUN apt-get update && apt-get install -y git zip
54

65
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
7-
COPY . /var/www/html
6+
COPY . /var/www/
87

9-
WORKDIR /var/www/html
8+
WORKDIR /var/www/

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
vendor/
22
composer.lock
33
phpunit.xml
4-
.idea
4+
.phpunit.result.cache

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
$finder = PhpCsFixer\Finder::create()
44
->exclude('vendor')
5+
->exclude('tests/resources')
56
->in(__DIR__);
67

78
return PhpCsFixer\Config::create()

.travis.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
11
language: php
22

3-
sudo: false
3+
jobs:
4+
include:
5+
- name: 'Tests under PHP 7.4'
6+
php: '7.4'
7+
dist: bionic
8+
- name: 'Tests under PHP 8.0'
9+
php: '8.0'
10+
dist: bionic
11+
- name: 'Tests under PHP nightly'
12+
php: 'nightly'
13+
dist: bionic
414

5-
php:
6-
- 7.1
7-
- 7.2
15+
fast_finish: true
16+
allow_failures:
17+
- php: 'nightly'
818

919
cache:
1020
directories:
1121
- $HOME/.composer/cache
1222

1323
install:
14-
- composer install
24+
- composer install
1525

1626
script:
17-
- ./vendor/phpunit/phpunit/phpunit --coverage-text --coverage-clover=coverage.clover
27+
- php -dmemory_limit=-1 -dxdebug.mode=coverage ./vendor/phpunit/phpunit/phpunit --coverage-text --coverage-clover=coverage.clover
1828

1929
after_script:
20-
- wget https://scrutinizer-ci.com/ocular.phar
21-
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
30+
- wget https://scrutinizer-ci.com/ocular.phar
31+
- php -dmemory_limit=-1 ocular.phar code-coverage:upload --format=php-clover coverage.clover
32+
33+
after_success:
34+
- bash <(curl -s https://codecov.io/bash)

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# CHANGELOG
22

3+
## 3.0.0 - 2021/01/26
4+
- use `splitbrain/phpfarm:jessie` as Docker image and fix docker image settings
5+
- Code requires PHP >= 7.4
6+
- Code cleaning
7+
- BC:
8+
- `WsdlToPhp\PhpGenerator\Element\PhpFunction::__construct` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the function return type
9+
- `WsdlToPhp\PhpGenerator\Element\PhpMethod::__construct` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type
10+
- `WsdlToPhp\PhpGenerator\Component\PhpClass::addMethod` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type
11+
- `WsdlToPhp\PhpGenerator\Component\PhpInterface::addMethod` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type
12+
- Implementation of the PHP `declare` statement
13+
- `GenerateableInterface` elements and components now implement the `__toString` method
14+
- Update READMEs
15+
- Update Travis CI settings
16+
- Update PHPUnit settings
17+
- Update LICENSE file
18+
- Version 2.0 is no more maintained
19+
320
## 2.0.0
421
- Use PHP 7.1 features
522
- Refactore code

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2012-2015 Mikaël DELSOL
1+
Copyright (c) 2012-2021 Mikaël DELSOL
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Build Status](https://api.travis-ci.org/WsdlToPhp/PhpGenerator.svg)](https://travis-ci.org/WsdlToPhp/PhpGenerator)
88
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/)
99
[![Code Coverage](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/badges/coverage.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PhpGenerator/)
10+
[![Total Downloads](https://poser.pugx.org/wsdltophp/phpgenerator/downloads)](https://packagist.org/packages/wsdltophp/phpgenerator)
1011
[![StyleCI](https://styleci.io/repos/36832375/shield)](https://styleci.io/repos/36832375)
1112
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/e55e9115-5a3f-4d37-bfd5-b01c8de579f9/mini.png)](https://insight.sensiolabs.com/projects/e55e9115-5a3f-4d37-bfd5-b01c8de579f9)
1213

@@ -20,10 +21,27 @@ This project contains two main features:
2021
- [Element](src/Element/README.md): generate basic elements
2122
- [Component](src/Component/README.md): generate structured complex elements
2223

23-
## Unit tests
24-
You can run the unit tests with the following command:
24+
## Testing using [Docker](https://www.docker.com/)
25+
Thanks to the [Docker image](https://hub.docker.com/r/splitbrain/phpfarm) of [phpfarm](https://github.com/fpoirotte/phpfarm), tests can be run locally under *any* PHP version using the cli:
26+
- php-7.4
27+
28+
First of all, you need to create your container which you can do using [docker-compose](https://docs.docker.com/compose/) by running the below command line from the root directory of the project:
29+
```bash
30+
$ docker-compose up -d --build
2531
```
26-
$ cd /path/to/src/WsdlToPhp/PhpGenerator/
27-
$ composer install
28-
$ composer test
32+
33+
You then have a container named `php_generator` in which you can run `composer` commands and `php cli` commands such as:
34+
```bash
35+
# install deps in container (using update ensure it does use the composer.lock file if there is any)
36+
$ docker exec -it php_generator php-7.4 /usr/bin/composer update
37+
# run tests in container
38+
$ docker exec -it php_generator php-7.4 -dmemory_limit=-1 vendor/bin/phpunit
2939
```
40+
41+
## FAQ
42+
43+
If you have a question, feel free to [create an issue](https://github.com/WsdlToPhp/PackageGenerator/issues/new).
44+
45+
## License
46+
47+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

UPGRADE-3.0.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# UPGRADE FROM 2.* to 3.*
2+
3+
The main change, apart from requiring PHP >= 7.4, is that `PhpFunction` and `PhpMethod` now accepts a `$returnType` parameter which impacts four locations:
4+
- `WsdlToPhp\PhpGenerator\Element\PhpFunction::__construct` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the function return type
5+
- `WsdlToPhp\PhpGenerator\Element\PhpMethod::__construct` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type
6+
- `WsdlToPhp\PhpGenerator\Component\PhpClass::addMethod` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type
7+
- `WsdlToPhp\PhpGenerator\Component\PhpInterface::addMethod` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type
8+
9+
**Previously**:
10+
```php
11+
$phpFunction = new PhpFunction('name', ['firstParameter', 'secondParameter']);
12+
13+
$phpMethod = new PhpMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC);
14+
15+
$phpClass = (new PhpClass('MyClass'))
16+
->addMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC);
17+
18+
$phpInterface = (new PhpInterface('MyInterface'))
19+
->addMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC);
20+
```
21+
22+
**Now**:
23+
```php
24+
$phpFunction = new PhpFunction('name', ['firstParameter', 'secondParameter'] /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/);
25+
26+
$phpMethod = new PhpMethod('name', ['firstParameter', 'secondParameter'], null /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/, PhpMethod::ACCESS_PUBLIC);
27+
28+
$phpClass = (new PhpClass('MyClass'))
29+
->addMethod('name', ['firstParameter', 'secondParameter'], null /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/, PhpMethod::ACCESS_PUBLIC);
30+
31+
$phpInterface = (new PhpInterface('MyInterface'))
32+
->addMethod('name', ['firstParameter', 'secondParameter'], null /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/, PhpMethod::ACCESS_PUBLIC);
33+
```

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose"
2121
},
2222
"require" : {
23-
"php" : ">=7.1"
23+
"php" : ">=7.4"
2424
},
2525
"require-dev": {
26-
"friendsofphp/php-cs-fixer": "~2.0",
27-
"phpunit/phpunit": "^4.8 || ^6.0"
26+
"friendsofphp/php-cs-fixer": "^2.0",
27+
"phpunit/phpunit": "^9"
2828
},
2929
"autoload" : {
3030
"psr-4" : {

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ services:
66
context: .
77
dockerfile: .docker/Dockerfile
88
volumes:
9-
- .:/var/www/html:rw
10-
container_name: php_generator
9+
- .:/var/www:rw
10+
container_name: php_generator

0 commit comments

Comments
 (0)