Skip to content

Commit

Permalink
Merge pull request #328 from veewee/php80
Browse files Browse the repository at this point in the history
Add php80 support
  • Loading branch information
veewee authored Nov 27, 2020
2 parents 433f07a + 17d679d commit df22bfa
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 175 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/grumphp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: GrumPHP

on: [push, pull_request]
jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.3', '7.4', '8.0']
composer-options: ['', '--prefer-lowest']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }} with ${{ matrix.composer-options }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
tools: 'composer:v2'
extensions: pcov, mbstring, posix
- name: Check Versions
run: |
php -v
php -m
composer --version
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
- name: Set git variables
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: Run the tests
run: php vendor/bin/grumphp run --no-interaction
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

31 changes: 16 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,43 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.3 || ^8.0",
"ext-dom": "*",
"ext-xml": "*",
"psr/event-dispatcher": "^1.0",
"psr/log": "^1.0",
"symfony/console": "~3.4 || ~4.0 || ~5.0",
"symfony/event-dispatcher": "~3.4 || ~4.0 || ~5.0",
"symfony/filesystem": "~3.4 || ~4.0 || ~5.0",
"symfony/options-resolver": "~3.4 || ~4.0 || ~5.0"
"symfony/console": "~4.0 || ~5.0",
"symfony/event-dispatcher": "~4.0 || ~5.0",
"symfony/filesystem": "~4.0 || ~5.0",
"symfony/options-resolver": "~4.0 || ~5.0"
},
"require-dev": {
"ext-soap": "*",
"guzzlehttp/guzzle": "^6.4.1",
"guzzlehttp/promises": "^1.3.1",
"guzzlehttp/psr7": "^1.6.1",
"guzzlehttp/guzzle": "^7.2.0",
"guzzlehttp/promises": "^1.4.0",
"guzzlehttp/psr7": "^1.7.0",
"laminas/laminas-code": "^3.5.0",
"nyholm/psr7": "^1.3",
"phpdocumentor/reflection-docblock": "^5.2.2",
"php-http/client-common": "^2.1",
"php-http/discovery": "^1.7",
"php-http/guzzle6-adapter": "^2.0.1",
"php-http/httplug": "^2.1",
"php-http/message": "^1.8",
"php-http/message-factory": "^1.0",
"php-http/mock-client": "^1.3",
"php-parallel-lint/php-parallel-lint": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"php-vcr/php-vcr": "1.4.5",
"phpro/grumphp-shim": "~0.19.0",
"phpspec/phpspec": "~6.1",
"phpstan/phpstan": "^0.11.19",
"phpunit/phpunit": "~8.5",
"phpro/grumphp-shim": "~1.2.0",
"phpspec/phpspec": "~7.0",
"phpspec/prophecy-phpunit": "^2.0.1",
"phpstan/phpstan": "^0.12.57",
"phpunit/phpunit": "~9.4",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0.1",
"robrichards/wse-php": "^2.0.3",
"robrichards/xmlseclibs": "^3.0",
"squizlabs/php_codesniffer": "~3.5",
"symfony/validator": "~3.4 || ~4.0 || ~5.0"
"symfony/validator": "~4.0 || ~5.0"
},
"suggest": {
"ext-soap": "If you want to use PHP's ext-soap driver.",
Expand Down
2 changes: 1 addition & 1 deletion grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ grumphp:
phpunit: ~
phplint: ~
phpstan:
level: 3
level: 4
configuration: "phpstan.neon"
ignore_patterns:
- "spec/"
Expand Down
5 changes: 1 addition & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
parameters:
level: 4
ignoreErrors:
# Soapclient reflection is quite broken
- '#Call to an undefined static method SoapClient::__construct().#'
# This is something we hope to fix in PHP 7.4
# https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters
- '#Call to an undefined method Phpro\\.*(Context|RuleSet)Interface.*$#'
# Symfony BC code makes phpstan cry:
- '#^Method Symfony\\(Contracts|Component)\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) invoked with 2 parameters, 1 required\.$#'
# When using old Symfony versions (3.4), the event contracts wont be included in the codebase:
- '#(.*)Symfony\\Contracts\\EventDispatcher\\Event(DispatcherInterface)?(.*)#'
2 changes: 1 addition & 1 deletion src/Phpro/SoapClient/CodeGenerator/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @package Phpro\SoapClient\CodeGenerator\Config
*/
class Config implements ConfigInterface
final class Config implements ConfigInterface
{
/**
* @var string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @package Phpro\SoapClient\Exception
*/
class InvalidArgumentException extends \InvalidArgumentException
final class InvalidArgumentException extends \InvalidArgumentException
{
public static function engineNotConfigured(): self
{
Expand Down
7 changes: 1 addition & 6 deletions src/Phpro/SoapClient/Exception/MiddlewareException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
namespace Phpro\SoapClient\Exception;

use Http\Client\Exception;
use Throwable;

class MiddlewareException extends RuntimeException
{
public static function fromHttPlugException(Exception $exception): self
{
if ($exception instanceof Throwable) {
return new self($exception->getMessage(), $exception->getCode(), $exception);
}

return new self('Something went wrong: '.get_class($exception));
return new self($exception->getMessage(), $exception->getCode(), $exception);
}
}
2 changes: 1 addition & 1 deletion src/Phpro/SoapClient/Soap/Driver/ExtSoap/AbusedClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function createFromOptions(ExtSoapOptions $options): self

public function __doRequest($request, $location, $action, $version, $oneWay = 0)
{
$this->storedRequest = new SoapRequest($request, $location, $action, $version, $oneWay);
$this->storedRequest = new SoapRequest($request, $location, $action, $version, (int) $oneWay);

return $this->storedResponse ? $this->storedResponse->getResponse() : '';
}
Expand Down
8 changes: 4 additions & 4 deletions src/Phpro/SoapClient/Soap/Handler/HttPlugHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Phpro\SoapClient\Soap\Handler;

use Http\Client\Common\PluginClient;
use Http\Client\HttpClient;
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\MessageFactoryDiscovery;
use Http\Discovery\StreamFactoryDiscovery;
Expand All @@ -16,11 +15,12 @@
use Phpro\SoapClient\Soap\HttpBinding\LastRequestInfo;
use Phpro\SoapClient\Soap\HttpBinding\SoapRequest;
use Phpro\SoapClient\Soap\HttpBinding\SoapResponse;
use Psr\Http\Client\ClientInterface;

class HttPlugHandle implements HandlerInterface, MiddlewareSupportingInterface
{
/**
* @var HttpClient
* @var ClientInterface
*/
private $client;

Expand All @@ -40,7 +40,7 @@ class HttPlugHandle implements HandlerInterface, MiddlewareSupportingInterface
private $middlewares = [];

public function __construct(
HttpClient $client,
ClientInterface $client,
Psr7Converter $converter,
CollectLastRequestInfoMiddleware $lastRequestInfoCollector
) {
Expand All @@ -54,7 +54,7 @@ public static function createWithDefaultClient(): HttPlugHandle
return self::createForClient(HttpClientDiscovery::find());
}

public static function createForClient(HttpClient $client): HttPlugHandle
public static function createForClient(ClientInterface $client): HttPlugHandle
{
return new self(
$client,
Expand Down
2 changes: 2 additions & 0 deletions src/Phpro/SoapClient/Xml/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public static function fromStream(StreamInterface $stream): Xml
$xml = new DOMDocument();
$xml->loadXML($stream->getContents());

/** @phpstan-ignore-next-line */
return new static($xml);
}

Expand All @@ -105,6 +106,7 @@ public static function fromString(string $content)
$xml = new DOMDocument();
$xml->loadXML($content);

/** @phpstan-ignore-next-line */
return new static($xml);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace PhproTest\SoapClient\Integration\Soap\Driver\ExtSoap\Engine;

use Http\Adapter\Guzzle6\Client;
use GuzzleHttp\Client;
use Phpro\SoapClient\Soap\Driver\ExtSoap\AbusedClient;
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapDriver;
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapOptions;
Expand Down Expand Up @@ -63,7 +63,7 @@ protected function configureForWsdl(string $wsdl)
)
),
$this->handler = HttPlugHandle::createForClient(
Client::createWithConfig(['headers' => ['User-Agent' => 'testing/1.0']])
new Client(['headers' => ['User-Agent' => 'testing/1.0']])
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
use Phpro\SoapClient\Soap\TypeConverter;
use Phpro\SoapClient\Wsdl\Provider\WsdlProviderInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ExtSoapOptionsTest extends TestCase
{
use ProphecyTrait;

/**
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@
*/
class FluentSetterAssemblerTest extends TestCase
{
/**
* @param string $version
* @return bool
*/
function laminasOlderOrEqual($version)
{
$laminasCodeVersion = \PackageVersions\Versions::getVersion('laminas/laminas-code');
$laminasCodeVersion = substr($laminasCodeVersion, 0, strpos($laminasCodeVersion, '@'));

return version_compare($laminasCodeVersion, $version, '>=');
}

/**
* @test
*/
Expand Down Expand Up @@ -156,9 +144,6 @@ public function setProp1(\$prop1)
*/
public function it_generates_return_types()
{
if (!$this->laminasOlderOrEqual('3.3.0')) {
$this->markTestSkipped('laminas-code not new enough');
}
$assembler = new FluentSetterAssembler((new FluentSetterAssemblerOptions())->withReturnType());
$context = $this->createContextWithAnUnknownType();
$assembler->assemble($context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@
*/
class GetterAssemblerTest extends TestCase
{
/**
* @param string $version
* @return bool
*/
function laminasOlderOrEqual($version)
{
$laminasCodeVersion = \PackageVersions\Versions::getVersion('laminas/laminas-code');
$laminasCodeVersion = substr($laminasCodeVersion, 0, strpos($laminasCodeVersion, '@'));

return version_compare($laminasCodeVersion, $version, '>=');
}

/**
* @test
*/
Expand Down Expand Up @@ -86,9 +74,6 @@ public function getProp1()
*/
public function it_assembles_with_return_type()
{
if (!$this->laminasOlderOrEqual('3.3.0')) {
$this->markTestSkipped('laminas/laminas-code 3.3.0 required');
}
$options = (new GetterAssemblerOptions())
->withReturnType();
$assembler = new GetterAssembler($options);
Expand Down
Loading

0 comments on commit df22bfa

Please sign in to comment.