Skip to content

Commit fdb5512

Browse files
committed
SDK-1814: Support PHP 8
1 parent ad92b4a commit fdb5512

9 files changed

+24
-16
lines changed

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ jobs:
4747
- travis_retry composer install --no-interaction --prefer-source --dev
4848
script:
4949
- composer test
50+
- <<: *compatibility
51+
php: "8.0snapshot"
52+
install:
53+
# Remove php-cs-fixer until compatible with PHP 8
54+
- travis_retry composer remove --dev --no-interaction friendsofphp/php-cs-fixer
55+
- travis_retry composer self-update
56+
- travis_retry composer install --no-interaction --prefer-source --dev
57+
before_script:
58+
- echo 'xdebug.mode=coverage' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
59+
script:
60+
- composer test
5061
- <<: *test
5162
stage: Analyze
5263
name: Sonarcloud

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"homepage": "https://yoti.com",
1010
"license": "MIT",
1111
"require": {
12-
"php": "^7.1",
12+
"php": "^7.1 || ^8.0",
1313
"ext-json": "*",
1414
"google/protobuf": "^3.10",
1515
"phpseclib/phpseclib": "^2.0",

tests/Http/RequestBuilderTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,9 @@ public function testWithUnsupportedMethod()
296296
public function testWithHeaderInvalidValue()
297297
{
298298
$this->expectException(\TypeError::class);
299-
$this->expectExceptionMessage('must be of the type string');
299+
$this->expectExceptionMessage(sprintf('%s::withHeader()', RequestBuilder::class));
300300

301-
(new RequestBuilder())
302-
->withBaseUrl(self::SOME_BASE_URL)
303-
->withPemFilePath(TestData::PEM_FILE)
304-
->withHeader('Custom', ['invalid value'])
305-
->withMethod('GET')
306-
->build();
301+
(new RequestBuilder())->withHeader('Custom', ['invalid value']);
307302
}
308303

309304
/**

tests/Profile/ExtraData/AttributeDefinitionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testGetName()
4141
public function testInvalidName($invalidName)
4242
{
4343
$this->expectException(\TypeError::class);
44-
$this->expectExceptionMessage('must be of the type string');
44+
$this->expectExceptionMessage(sprintf('%s::__construct()', AttributeDefinition::class));
4545

4646
new AttributeDefinition($invalidName);
4747
}

tests/Profile/ExtraData/AttributeIssuanceDetailsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public function testGetIssuingAttributes()
8080
*/
8181
public function testInvalidToken($invalidToken)
8282
{
83-
$this->expectException(\TypeError::class, 'must be of the type string');
83+
$this->expectException(\TypeError::class);
84+
$this->expectExceptionMessage(sprintf('%s::__construct()', AttributeIssuanceDetails::class));
8485

8586
new AttributeIssuanceDetails($invalidToken);
8687
}

tests/ShareUrl/DynamicScenarioBuilderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yoti\Test\ShareUrl;
66

7+
use Yoti\ShareUrl\DynamicScenario;
78
use Yoti\ShareUrl\DynamicScenarioBuilder;
89
use Yoti\ShareUrl\Extension\ExtensionBuilder;
910
use Yoti\ShareUrl\Policy\DynamicPolicy;
@@ -94,7 +95,7 @@ public function testBuild()
9495
public function testBuildWithoutCallback()
9596
{
9697
$this->expectException(\TypeError::class);
97-
$this->expectExceptionMessage('must be of the type string');
98+
$this->expectExceptionMessage(sprintf('%s::__construct()', DynamicScenario::class));
9899

99100
(new DynamicScenarioBuilder())
100101
->withPolicy($this->createMock(DynamicPolicy::class))

tests/ShareUrl/Policy/DynamicPolicyBuilderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testWithAgeDerivedAttributesWithConstraints()
300300
public function testWithAgeOverIntegersOnly()
301301
{
302302
$this->expectException(\TypeError::class);
303-
$this->expectExceptionMessage('must be of the type int');
303+
$this->expectExceptionMessage(sprintf('%s::withAgeOver()', DynamicPolicyBuilder::class));
304304

305305
(new DynamicPolicyBuilder())
306306
->withDateOfBirth()
@@ -316,7 +316,7 @@ public function testWithAgeOverIntegersOnly()
316316
public function testWithAgeUnderIntegersOnly()
317317
{
318318
$this->expectException(\TypeError::class);
319-
$this->expectExceptionMessage('must be of the type int');
319+
$this->expectExceptionMessage(sprintf('%s::withAgeUnder()', DynamicPolicyBuilder::class));
320320

321321
(new DynamicPolicyBuilder())
322322
->withDateOfBirth()
@@ -527,7 +527,7 @@ public function testWithNoPinAuthAfterRemoval()
527527
public function testWithNonIntegerAuthType()
528528
{
529529
$this->expectException(\TypeError::class);
530-
$this->expectExceptionMessage('must be of the type int');
530+
$this->expectExceptionMessage(sprintf('%s::withWantedAuthType()', DynamicPolicyBuilder::class));
531531

532532
(new DynamicPolicyBuilder())
533533
->withWantedAuthType('99')

tests/ShareUrl/Policy/WantedAttributeBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testEmptyName()
6565
public function testNonStringName()
6666
{
6767
$this->expectException(\TypeError::class);
68-
$this->expectExceptionMessage('must be of the type string');
68+
$this->expectExceptionMessage(sprintf('%s::withName()', WantedAttributeBuilder::class));
6969

7070
(new WantedAttributeBuilder())
7171
->withName(['some array'])

tests/Util/DateTimeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function testEmptyTimestamp($emptyDateString, $exceptionMessage, $type)
133133
public function emptyTimestampProvider()
134134
{
135135
return [
136-
[ null, 'must be of the type string, null given', \TypeError::class ],
136+
[ null, sprintf('%s::stringToDateTime()', DateTime::class), \TypeError::class ],
137137
[ '', 'value cannot be empty', \InvalidArgumentException::class ],
138138
];
139139
}

0 commit comments

Comments
 (0)