Skip to content

Commit 1c516f4

Browse files
committed
Upgrade to PHP 8.1 and upgrade deps
1 parent 169f9fb commit 1c516f4

19 files changed

+66
-60
lines changed

.gitattributes

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
* text=auto
2-
31
/.github export-ignore
42
/tests export-ignore
53
/.editorconfig export-ignore

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: Setono

.github/dependabot.yml

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# See https://github.com/Roave/BackwardCompatibilityCheck
2+
3+
name: "Backwards Compatibility Check"
4+
5+
on:
6+
pull_request: ~
7+
8+
jobs:
9+
backwards-compatibility-check:
10+
name: "Backwards Compatibility Check"
11+
12+
runs-on: "ubuntu-latest"
13+
14+
steps:
15+
- name: "Checkout"
16+
uses: "actions/checkout@v4"
17+
with:
18+
fetch-depth: 0
19+
20+
- name: "Setup PHP, with composer and extensions"
21+
uses: "shivammathur/setup-php@v2"
22+
with:
23+
php-version: "8.1"
24+
coverage: "none"
25+
26+
- name: "Install tool"
27+
run: "composer global require roave/backward-compatibility-check"
28+
29+
- name: "Check for BC breaks"
30+
run: "~/.composer/vendor/bin/roave-backward-compatibility-check --from=origin/${{ github.event.pull_request.base.ref }} --format=github-actions"

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Setono
3+
Copyright (c) 2025 Setono
44

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

composer-dependency-analyser.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
4+
5+
return (new Configuration())
6+
->addPathToExclude(__DIR__ . '/tests')
7+
;

composer-require-checker.json

-21
This file was deleted.

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.4",
13+
"php": ">=8.1",
1414
"ext-json": "*",
1515
"composer-runtime-api": "^2.0",
1616
"facebook/php-business-sdk": "^14.0",
@@ -26,7 +26,8 @@
2626
"nyholm/psr7": "^1.5",
2727
"phpunit/phpunit": "^9.5",
2828
"psalm/plugin-phpunit": "^0.17",
29-
"setono/code-quality-pack": "^2.2"
29+
"setono/code-quality-pack": "^2.2",
30+
"shipmonk/composer-dependency-analyser": "^1.8"
3031
},
3132
"prefer-stable": true,
3233
"autoload": {

ecs.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
declare(strict_types=1);
44

5-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
6-
use Symplify\EasyCodingStandard\ValueObject\Option;
5+
use Symplify\EasyCodingStandard\Config\ECSConfig;
76

8-
return static function (ContainerConfigurator $containerConfigurator): void {
9-
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
10-
$containerConfigurator->parameters()->set(Option::PATHS, [
11-
'src', 'tests'
7+
return static function (ECSConfig $config): void {
8+
$config->import('vendor/sylius-labs/coding-standard/ecs.php');
9+
$config->paths([
10+
'src',
11+
'tests',
1212
]);
1313
};

src/Client/Client.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function sendEvent(Event $event): void
6060

6161
$request = $requestFactory->createRequest(
6262
'POST',
63-
sprintf('https://graph.facebook.com/%s/%s/events', self::getEndpointVersion(), $pixel->id)
63+
sprintf('https://graph.facebook.com/%s/%s/events', self::getEndpointVersion(), $pixel->id),
6464
)
6565
->withHeader('Content-Type', 'application/x-www-form-urlencoded')
6666
->withHeader('Accept', 'application/json')
@@ -80,7 +80,7 @@ private function getHttpClient(): HttpClientInterface
8080
if (!class_exists(Curl::class)) {
8181
throw ClientException::missingDependency(
8282
Curl::class,
83-
sprintf('Either set the http client with %s or run composer require kriswallsmith/buzz', self::class . '::setHttpClient()')
83+
sprintf('Either set the http client with %s or run composer require kriswallsmith/buzz', self::class . '::setHttpClient()'),
8484
);
8585
}
8686

@@ -101,7 +101,7 @@ private function getRequestFactory(): RequestFactoryInterface
101101
if (!class_exists(Psr17Factory::class)) {
102102
throw ClientException::missingDependency(
103103
Psr17Factory::class,
104-
sprintf('Either set the request factory with %s or run composer require nyholm/psr7', self::class . '::setRequestFactory()')
104+
sprintf('Either set the request factory with %s or run composer require nyholm/psr7', self::class . '::setRequestFactory()'),
105105
);
106106
}
107107

@@ -122,7 +122,7 @@ private function getResponseFactory(): ResponseFactoryInterface
122122
if (!class_exists(Psr17Factory::class)) {
123123
throw ClientException::missingDependency(
124124
Psr17Factory::class,
125-
sprintf('Either set the response factory with %s or run composer require nyholm/psr7', self::class . '::setResponseFactory()')
125+
sprintf('Either set the response factory with %s or run composer require nyholm/psr7', self::class . '::setResponseFactory()'),
126126
);
127127
}
128128

@@ -143,7 +143,7 @@ private function getStreamFactory(): StreamFactoryInterface
143143
if (!class_exists(Psr17Factory::class)) {
144144
throw ClientException::missingDependency(
145145
Psr17Factory::class,
146-
sprintf('Either set the stream factory with %s or run composer require nyholm/psr7', self::class . '::setStreamFactory()')
146+
sprintf('Either set the stream factory with %s or run composer require nyholm/psr7', self::class . '::setStreamFactory()'),
147147
);
148148
}
149149

src/Event/Content.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function __construct(
1818
string $id = null,
1919
int $quantity = null,
2020
float $itemPrice = null,
21-
string $deliveryCategory = null
21+
string $deliveryCategory = null,
2222
) {
2323
$this->id = $id;
2424
$this->quantity = $quantity;

src/Exception/ClientException.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static function invalidJson(JsonException $jsonException, string $json):
1414
$message = sprintf(
1515
'The response from Meta/Facebook was not valid JSON. Given input: %s. Error was: %s',
1616
$json,
17-
$jsonException->getMessage()
17+
$jsonException->getMessage(),
1818
);
1919

2020
return new self($message, 0, $jsonException);
@@ -25,7 +25,7 @@ public static function invalidResponseFormat(string $json): self
2525
return new self(sprintf(
2626
'Expected a JSON response like %s, but got %s',
2727
'{"error":{"message":"string","type":"string","code":int,"fbtrace_id":"string"}}',
28-
$json
28+
$json,
2929
));
3030
}
3131

@@ -37,7 +37,7 @@ public static function fromErrorResponse(ErrorResponse $errorResponse): self
3737
$errorResponse->code,
3838
$errorResponse->type,
3939
$errorResponse->traceId,
40-
$errorResponse->json
40+
$errorResponse->json,
4141
);
4242

4343
return new self($message);
@@ -51,7 +51,7 @@ public static function missingDependency(string $class, string $help): self
5151
return new self(sprintf(
5252
'You have a missing dependency: %s. %s',
5353
$class,
54-
$help
54+
$help,
5555
));
5656
}
5757
}

src/Generator/FbqGenerator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function generateInit(
2323
array $pixels,
2424
array $userData = [],
2525
bool $includePageView = true,
26-
bool $includeScriptTag = true
26+
bool $includeScriptTag = true,
2727
): string {
2828
try {
2929
$json = [] !== $userData ? json_encode($userData, \JSON_THROW_ON_ERROR) : null;
@@ -57,7 +57,7 @@ public function generateTrack(Event $event, bool $includeScriptTag = true): stri
5757
$event->isCustom() ? 'trackCustom' : 'track',
5858
$event->eventName,
5959
json_encode($event->customData->getPayload(Parameters::PAYLOAD_CONTEXT_BROWSER), \JSON_THROW_ON_ERROR),
60-
$event->eventId
60+
$event->eventId,
6161
);
6262

6363
if ($includeScriptTag) {

src/Generator/FbqGeneratorInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function generateInit(
1818
array $pixels,
1919
array $userData = [],
2020
bool $includePageView = true,
21-
bool $includeScriptTag = true
21+
bool $includeScriptTag = true,
2222
): string;
2323

2424
/**

src/ValueObject/Fbc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function fromString(string $value): self
2727
throw new \InvalidArgumentException(sprintf(
2828
'The value "%s" didn\'t match the expected pattern for fbc: "%s"',
2929
$value,
30-
self::REGEXP_FBC
30+
self::REGEXP_FBC,
3131
));
3232
}
3333

src/ValueObject/Fbp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function value(): string
4040
'fb.%d.%d.%d',
4141
$this->getSubdomainIndex(),
4242
$this->getCreationTime(),
43-
$this->getRandomNumber()
43+
$this->getRandomNumber(),
4444
);
4545
}
4646

tests/Client/LiveClientTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function it_sends_event(): void
4242

4343
/**
4444
* @return array{pixelId: non-empty-string, testEventCode: non-empty-string, accessToken: non-empty-string, url: non-empty-string, email: non-empty-string}
45+
*
4546
* @psalm-suppress InvalidReturnType,MoreSpecificReturnType
4647
*/
4748
private function getTestValues(): array

tests/ValueObject/FbcTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function it_has_immutable_setters(): void
5252

5353
/**
5454
* @test
55+
*
5556
* @dataProvider wrongInputs
5657
*/
5758
public function it_handles_wrong_input(string $input): void

tests/ValueObject/FbpTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function it_has_immutable_setters(): void
4545

4646
/**
4747
* @test
48+
*
4849
* @dataProvider wrongInputs
4950
*/
5051
public function it_handles_wrong_input(string $input): void

0 commit comments

Comments
 (0)