Skip to content

Commit

Permalink
Support PHP 8.1 & drop PHP 7.3 (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
seferov committed Oct 20, 2022
1 parent b9511a3 commit b7f1102
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 228 deletions.
32 changes: 2 additions & 30 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,13 @@ jobs:
fail-fast: false
matrix:
php-version:
- 7.3
- 7.4
- 8.0
- 8.1

dependencies:
- highest
- lowest

exclude:
- php-version: 7.3
dependencies: lowest
- php-version: 7.4
dependencies: lowest

steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand Down Expand Up @@ -71,32 +64,15 @@ jobs:
fail-fast: false
matrix:
php-version:
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1

symfony-version:
- 4
- 5
- 6

exclude:
- php-version: 7.1
symfony-version: 5
- php-version: 7.1
symfony-version: 6
- php-version: 7.2
symfony-version: 6
- php-version: 7.3
symfony-version: 6
- php-version: 7.4
symfony-version: 6
- php-version: 7.1
symfony-version: 6
- php-version: 8.0
symfony-version: 3
- php-version: 8.0
symfony-version: 6

Expand Down Expand Up @@ -125,7 +101,3 @@ jobs:

- name: "Run acceptance tests with codeception"
run: vendor/bin/codecept run -v -g symfony-common -g symfony-${{ matrix.symfony-version }}

- name: "Run acceptance tests with codeception PHP8 only tests"
run: vendor/bin/codecept run -v -g php-8
if: matrix.php-version == '8.0'
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": "^7.1 || ^8.0",
"php": "^7.4 || ^8.0",
"ext-simplexml": "*",
"symfony/framework-bundle": "^4.0 || ^5.0 || ^6.0",
"vimeo/psalm": "^4.12"
Expand All @@ -27,7 +27,7 @@
"symfony/serializer": "^4.0 || ^5.0 || ^6.0",
"symfony/validator": "*",
"twig/twig": "^2.10 || ^3.0",
"weirdan/codeception-psalm-module": "^0.13.1"
"weirdan/codeception-psalm-module": "dev-master"
},
"autoload": {
"psr-4": {
Expand Down
32 changes: 19 additions & 13 deletions src/Test/CodeceptionModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Psalm\SymfonyPsalmPlugin\Test;

use Behat\Gherkin\Node\PyStringNode;
use Codeception\Exception\ModuleRequireException;
use Codeception\Module as BaseModule;
use Codeception\TestInterface;
Expand All @@ -21,15 +22,6 @@
*/
class CodeceptionModule extends BaseModule
{
/**
* @var mixed[]
*
* @psalm-suppress NonInvariantDocblockPropertyType
*/
protected $config = [
'default_dir' => 'tests/_run/',
];

private const DEFAULT_TWIG_TEMPLATES_DIR = 'templates';

/**
Expand All @@ -52,6 +44,13 @@ class CodeceptionModule extends BaseModule
*/
private $suppressedIssueHandlers = [];

public function _initialize(): void
{
$this->_setConfig([
'default_dir' => 'tests/_run/',
]);
}

public function _after(TestInterface $test): void
{
$this->twigCache = $this->lastCachePath = null;
Expand All @@ -69,7 +68,7 @@ public function setTheTemplateRootDirectory(string $rootDir): void
/**
* @Given I have the following :templateName template :code
*/
public function haveTheFollowingTemplate(string $templateName, string $code): void
public function haveTheFollowingTemplate(string $templateName, PyStringNode $code): void
{
$rootDirectory = rtrim($this->config['default_dir'], DIRECTORY_SEPARATOR);
$templatePath = (
Expand All @@ -82,7 +81,7 @@ public function haveTheFollowingTemplate(string $templateName, string $code): vo
mkdir($templateDirectory, 0755, true);
}

file_put_contents($templatePath, $code);
file_put_contents($templatePath, $code->getRaw());
}

/**
Expand Down Expand Up @@ -137,9 +136,16 @@ public function configureIgnoredIssueHandlers(string $issueHandlers): void

/**
* @Given I have Symfony plugin enabled
*/
public function configureCommonPsalmconfigEmpty(): void
{
$this->configureCommonPsalmconfig(new PyStringNode([], 0));
}

/**
* @Given I have Symfony plugin enabled with the following config :configuration
*/
public function configureCommonPsalmconfig(string $configuration = ''): void
public function configureCommonPsalmconfig(PyStringNode $configuration): void
{
$suppressedIssueHandlers = implode("\n", array_map(function (string $issueHandler) {
return "<$issueHandler errorLevel=\"info\"/>";
Expand All @@ -161,7 +167,7 @@ public function configureCommonPsalmconfig(string $configuration = ''): void
<plugins>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin">
$configuration
{$configuration->getRaw()}
</pluginClass>
</plugins>
<issueHandlers>
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/acceptance/AuthenticatorInterface.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@symfony-common
@symfony-4 @symfony-5
Feature: AuthenticatorInterface

Background:
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/acceptance/ServiceSubscriber.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@symfony-4 @symfony-5 @symfony-6
@symfony-common
Feature: Service Subscriber

Background:
Expand Down Expand Up @@ -26,7 +26,7 @@ Feature: Service Subscriber
$this->container = $container;
}
public static function getSubscribedServices()
public static function getSubscribedServices(): array
{
return [
// takes container.xml into account
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/acceptance/TestContainerService.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@symfony-4 @symfony-5 @symfony-6
@symfony-5 @symfony-6
Feature: Test Container service

Background:
Expand All @@ -21,7 +21,7 @@ Feature: Test Container service
{
public function testService(): void
{
$service = static::$container->get('dummy_private_service');
$service = static::getContainer()->get('dummy_private_service');
trim($service->foo());
}
}
Expand All @@ -42,7 +42,7 @@ Feature: Test Container service
{
public function testService(): void
{
$service = static::$container->get('dummy_private_service');
$service = static::getContainer()->get('dummy_private_service');
trim($service->foo());
}
}
Expand Down
175 changes: 0 additions & 175 deletions tests/acceptance/acceptance/TwigTaintingWithCachedTemplates.feature

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@symfony-common
@symfony-4 @symfony-5
Feature: Serializer interface
Detect SerializerInterface::deserialize() result type

Expand Down

0 comments on commit b7f1102

Please sign in to comment.