Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[php-symfony] Set required PHP version ^7.1.3 #6181

Merged
merged 11 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ public void processOpts() {
additionalProperties.put("escapedInvokerPackage", invokerPackage.replace("\\", "\\\\"));
additionalProperties.put("controllerPackage", controllerPackage);
additionalProperties.put("servicePackage", servicePackage);
additionalProperties.put("testsPackage", testsPackage);
additionalProperties.put("apiTestsPackage", apiTestsPackage);
additionalProperties.put("modelTestsPackage", modelTestsPackage);
additionalProperties.put("controllerTestsPackage", controllerTestsPackage);
Expand Down Expand Up @@ -349,7 +350,7 @@ public void processOpts() {
// Testing components
supportingFiles.add(new SupportingFile("testing/phpunit.xml.mustache", "", "phpunit.xml.dist"));
supportingFiles.add(new SupportingFile("testing/pom.xml", "", "pom.xml"));
supportingFiles.add(new SupportingFile("testing/AppKernel.php", toSrcPath(testsPackage, srcBasePath), "AppKernel.php"));
supportingFiles.add(new SupportingFile("testing/AppKernel.mustache", toSrcPath(testsPackage, srcBasePath), "AppKernel.php"));
supportingFiles.add(new SupportingFile("testing/ControllerTest.mustache", toSrcPath(controllerTestsPackage, srcBasePath), "ControllerTest.php"));
supportingFiles.add(new SupportingFile("testing/test_config.yml", toSrcPath(testsPackage, srcBasePath), "test_config.yml"));

Expand All @@ -360,7 +361,8 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));

supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml"));
supportingFiles.add(new SupportingFile(".php_cs", "", ".php_cs"));
supportingFiles.add(new SupportingFile(".php_cs.dist", "", ".php_cs.dist"));
supportingFiles.add(new SupportingFile(".coveralls.yml", "", ".coveralls.yml"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));

// Type-hintable primitive types
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
service_name: travis-ci # travis-ci or travis-pro

# for php-coveralls
coverage_clover: report/logs/clover.xml
json_path: report/logs/coveralls-upload.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
!bin/symfony_requirements
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
composer.lock

# Assets and user uploads
/web/bundles/
/web/uploads/
Expand All @@ -51,4 +55,14 @@

# From root gitignore
/Tests/cache/
/Tests/logs/
/Tests/logs/

# PHP Coding Standards Fixer
# https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/UPGRADE.md#config-file
# From now you can create new configuration file: .php_cs.dist.
# This file is used if no .php_cs file was found.
# It is recommended to create .php_cs.dist file attached in your repository and add .php_cs file to .gitignore for allowing your contributors to have theirs own configuration file.
/.php_cs

# No reason to commit PHP CS Fixer cache files
/.php_cs.cache
18 changes: 0 additions & 18 deletions modules/openapi-generator/src/main/resources/php-symfony/.php_cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;

return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha'
],
'phpdoc_order' => true,
'array_syntax' => ['syntax' => 'short'],
'strict_comparison' => true,
'strict_param' => true
])
->setFinder($finder)
;
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
language: php
sudo: false
dist: trusty
php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
before_install: "composer install"
script: "vendor/bin/phpunit"
- 7.1.3
- 7.2

install:
- composer install --dev --no-interaction
script:
- mkdir -p report/logs
- php vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=report/logs/clover.xml
- php vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no

before_script:
- composer require --dev php-coveralls/php-coveralls --no-interaction

after_success:
- travis_retry php vendor/bin/php-coveralls
# or enable logging
- travis_retry php vendor/bin/php-coveralls -v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* {{bundleName}}ApiPass
*
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{invokerPackage}}\DependencyInjection\Compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* ApiServer
*
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{apiPackage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* {{bundleClassName}}
*
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{invokerPackage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Controller
*
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{controllerPackage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* {{bundleExtensionName}}
*
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{invokerPackage}}\DependencyInjection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})

## Requirements

PHP 5.4.0 and later
PHP 7.1.3 and later

## Installation & Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* {{classname}}
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{invokerPackage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{#operations}}/**
* {{controllerName}}
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{controllerPackage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,19 @@
}
],
"require": {
"php": ">=5.4",
"php": "^7.1.3",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"symfony/validator": "*",
"jms/serializer-bundle": "^2.0",
"symfony/framework-bundle": "^3.3|^4.1"
"symfony/framework-bundle": "^4.4.8"
},
"require-dev": {
"phpunit/phpunit": "~4.8",
"satooshi/php-coveralls": "~1.0",
"squizlabs/php_codesniffer": "~2.6",
"friendsofphp/php-cs-fixer": "~1.12",
"phpunit/phpunit": "^7.0",
"friendsofphp/php-cs-fixer": "^2.16.3",
"symfony/browser-kit": "*",
"symfony/yaml": "^4.4.8",
"hoa/regex": "~1.0"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* {{classname}}
*
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{modelPackage}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

namespace {{testsPackage}};

use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

Expand All @@ -8,7 +11,7 @@ class AppKernel extends Kernel
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle()
new FrameworkBundle()
);

return $bundles;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ControllerTest
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{controllerTestsPackage}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* {{classname}}Test
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{apiTestsPackage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* {{classname}}Test
*
* PHP version 5
* PHP version 7.1.3
*
* @category Class
* @package {{modelTestsPackage}}
Expand All @@ -21,6 +21,8 @@

namespace {{modelPackage}};

use PHPUnit\Framework\TestCase;

/**
* {{classname}}Test Class Doc Comment
*
Expand All @@ -31,7 +33,7 @@ namespace {{modelPackage}};
* @author openapi-generator contributors
* @link https://github.com/openapitools/openapi-generator
*/
class {{classname}}Test extends \PHPUnit_Framework_TestCase
class {{classname}}Test extends TestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
</filter>
<php>
<ini name="error_reporting" value="E_ALL" />
<server name="KERNEL_DIR" value="Tests/" />
<server name="KERNEL_CLASS" value="{{testsPackage}}\AppKernel" />
</php>
</phpunit>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
service_name: travis-ci # travis-ci or travis-pro

# for php-coveralls
coverage_clover: report/logs/clover.xml
json_path: report/logs/coveralls-upload.json
16 changes: 15 additions & 1 deletion samples/server/petstore/php-symfony/SymfonyBundle-php/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
!bin/symfony_requirements
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
composer.lock

# Assets and user uploads
/web/bundles/
/web/uploads/
Expand All @@ -51,4 +55,14 @@

# From root gitignore
/Tests/cache/
/Tests/logs/
/Tests/logs/

# PHP Coding Standards Fixer
# https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/UPGRADE.md#config-file
# From now you can create new configuration file: .php_cs.dist.
# This file is used if no .php_cs file was found.
# It is recommended to create .php_cs.dist file attached in your repository and add .php_cs file to .gitignore for allowing your contributors to have theirs own configuration file.
/.php_cs

# No reason to commit PHP CS Fixer cache files
/.php_cs.cache
18 changes: 0 additions & 18 deletions samples/server/petstore/php-symfony/SymfonyBundle-php/.php_cs

This file was deleted.

20 changes: 20 additions & 0 deletions samples/server/petstore/php-symfony/SymfonyBundle-php/.php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;

return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha'
],
'phpdoc_order' => true,
'array_syntax' => ['syntax' => 'short'],
'strict_comparison' => true,
'strict_param' => true
])
->setFinder($finder)
;
Loading