Skip to content

Commit 088b056

Browse files
committed
refactor: update php up to 8.3 version
1 parent 869b071 commit 088b056

26 files changed

+41
-27
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^8.2",
19+
"php": "^8.3",
2020
"ext-curl": "*",
2121
"guzzlehttp/guzzle": "^7.0",
2222
"league/html-to-markdown": "^5.1",

rector.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
// Register rules for PHP 8.4 migration
1616
$rectorConfig->sets([
17-
SetList::PHP_82,
18-
LevelSetList::UP_TO_PHP_82,
17+
SetList::PHP_83,
18+
LevelSetList::UP_TO_PHP_83,
1919
]);
2020

2121
// Skip vendor directories

src/ConfigLoader/Import/WildcardPathFinder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* File extensions recognized as configuration files
1818
*/
19-
private const CONFIG_EXTENSIONS = ['yaml', 'yml', 'json', 'php'];
19+
private const array CONFIG_EXTENSIONS = ['yaml', 'yml', 'json', 'php'];
2020

2121
public function __construct(
2222
private FilesInterface $files,

src/ConfigLoader/Reader/PhpReader.php

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313
final readonly class PhpReader extends AbstractReader
1414
{
15+
#[\Override]
1516
public function read(string $path): array
1617
{
1718
$this->logger?->debug('Reading PHP config file', [

src/Console/InitCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
)]
2323
final class InitCommand extends BaseCommand
2424
{
25-
private const DEFAULT_CONFIG_NAME = 'context.yaml';
26-
private const DEFAULT_CONFIG_TYPE = 'yaml';
27-
private const SUPPORTED_TYPES = ['json', 'yaml'];
25+
private const string DEFAULT_CONFIG_NAME = 'context.yaml';
26+
private const string DEFAULT_CONFIG_TYPE = 'yaml';
27+
private const array SUPPORTED_TYPES = ['json', 'yaml'];
2828

2929
public function __construct(
3030
Container $container,

src/Console/Renderer/ModifierRenderer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
final class ModifierRenderer
1313
{
14-
private const MODIFIER_TYPES = [
14+
private const array MODIFIER_TYPES = [
1515
'php-signature' => 'PHP Signature Modifier',
1616
'php-content-filter' => 'PHP Content Filter Modifier',
1717
'sanitizer' => 'Content Sanitizer Modifier',

src/Console/SchemaCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class SchemaCommand extends BaseCommand
1616
/**
1717
* The URL where the JSON schema is hosted
1818
*/
19-
private const SCHEMA_URL = 'https://raw.githubusercontent.com/context-hub/generator/refs/heads/main/json-schema.json';
19+
private const string SCHEMA_URL = 'https://raw.githubusercontent.com/context-hub/generator/refs/heads/main/json-schema.json';
2020

2121
/**
2222
* Execute the command

src/Console/SelfUpdateCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ final class SelfUpdateCommand extends BaseCommand
2222
/**
2323
* GitHub API URL for latest release
2424
*/
25-
private const GITHUB_API_LATEST_RELEASE = 'https://api.github.com/repos/context-hub/generator/releases/latest';
25+
private const string GITHUB_API_LATEST_RELEASE = 'https://api.github.com/repos/context-hub/generator/releases/latest';
2626

2727
/**
2828
* GitHub download URL format for the PHAR file
2929
*/
30-
private const GITHUB_DOWNLOAD_URL = 'https://github.com/context-hub/generator/releases/download/%s/%s';
30+
private const string GITHUB_DOWNLOAD_URL = 'https://github.com/context-hub/generator/releases/download/%s/%s';
3131

32-
private const PHAR_PATH = '/usr/local/bin/ctx';
32+
private const string PHAR_PATH = '/usr/local/bin/ctx';
3333

3434
public function __construct(
3535
Container $container,

src/Console/VersionCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class VersionCommand extends BaseCommand
2020
/**
2121
* GitHub API URL for latest release
2222
*/
23-
private const GITHUB_API_LATEST_RELEASE = 'https://api.github.com/repos/context-hub/generator/releases/latest';
23+
private const string GITHUB_API_LATEST_RELEASE = 'https://api.github.com/repos/context-hub/generator/releases/latest';
2424

2525
public function __construct(
2626
Container $container,

src/Lib/GithubClient/GithubClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
final class GithubClient implements GithubClientInterface
1010
{
1111
/** GitHub API base URL */
12-
private const API_BASE_URL = 'https://api.github.com';
12+
private const string API_BASE_URL = 'https://api.github.com';
1313

1414
/**
1515
* @param HttpClientInterface $httpClient HTTP client for API requests

src/Lib/HttpClient/Exception/HttpRequestException.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

77
final class HttpRequestException extends HttpException
88
{
9+
#[\Override]
910
public static function requestFailed(string $url, int $statusCode): self
1011
{
1112
return new self(\sprintf('Failed to request URL "%s". Server returned status code %d', $url, $statusCode));
1213
}
1314

15+
#[\Override]
1416
public static function missingRedirectLocation(): self
1517
{
1618
return new self('Received a redirect response but no Location header was found');

src/Lib/HttpClient/Psr18Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
final readonly class Psr18Client implements HttpClientInterface
1313
{
14-
private const MAX_REDIRECTS = 5;
14+
private const int MAX_REDIRECTS = 5;
1515

1616
public function __construct(
1717
private ClientInterface $httpClient,

src/McpServer/Routing/McpResponseStrategy.php

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function __construct(
1717
private readonly LoggerInterface $logger,
1818
) {}
1919

20+
#[\Override]
2021
public function invokeRouteCallable(Route $route, ServerRequestInterface $request): ResponseInterface
2122
{
2223
try {

src/Modifier/PhpSignature.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
final class PhpSignature implements SourceModifierInterface
1919
{
20-
private const MAGIC_METHODS = [
20+
private const array MAGIC_METHODS = [
2121
'__construct',
2222
];
2323

src/Source/Composer/ComposerSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public function ignoreUnreadableDirs(): bool
156156
/**
157157
* Specify data which should be serialized to JSON
158158
*/
159+
#[\Override]
159160
public function jsonSerialize(): array
160161
{
161162
return \array_filter([

src/Source/File/FileSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ public function ignoreUnreadableDirs(): bool
240240
return $this->ignoreUnreadableDirs;
241241
}
242242

243+
#[\Override]
243244
public function jsonSerialize(): array
244245
{
245246
$result = [

src/Source/GitDiff/CommitDiffSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ public function ignoreUnreadableDirs(): bool
206206
*
207207
* @return array<string, mixed>
208208
*/
209+
#[\Override]
209210
public function jsonSerialize(): array
210211
{
211212
return \array_filter([

src/Source/GitDiff/Fetcher/CommitRangeParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/**
1313
* Predefined commit range aliases for easier configuration
1414
*/
15-
private const COMMIT_RANGE_PRESETS = [
15+
private const array COMMIT_RANGE_PRESETS = [
1616
// Basic ranges
1717
'last' => 'HEAD~1..HEAD',
1818
'last-2' => 'HEAD~2..HEAD',

src/Source/Github/GithubFileInfo.php

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function __construct(
3434
/**
3535
* Get the file content
3636
*/
37+
#[\Override]
3738
public function getContents(): string
3839
{
3940
if ($this->fetchedContent) {

src/Source/Github/GithubSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public function ignoreUnreadableDirs(): bool
197197
*
198198
* @return array<string, mixed> JSON serializable array
199199
*/
200+
#[\Override]
200201
public function jsonSerialize(): array
201202
{
202203
return \array_filter([

src/Source/SourceWithModifiers.php

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function __construct(
2222
parent::__construct(description: $description, tags: $tags);
2323
}
2424

25+
#[\Override]
2526
public function parseContent(
2627
SourceParserInterface $parser,
2728
ModifiersApplierInterface $modifiersApplier,
@@ -33,6 +34,7 @@ public function parseContent(
3334
return $parser->parse($this, $modifiersApplier);
3435
}
3536

37+
#[\Override]
3638
public function jsonSerialize(): array
3739
{
3840
return [

src/Source/Text/TextSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static function fromArray(array $data): self
3939
);
4040
}
4141

42+
#[\Override]
4243
public function jsonSerialize(): array
4344
{
4445
return \array_filter([

src/Source/Tree/TreeSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public function ignoreUnreadableDirs(): bool
194194
return true;
195195
}
196196

197+
#[\Override]
197198
public function jsonSerialize(): array
198199
{
199200
$result = [

src/Source/Url/UrlSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function hasSelector(): bool
6969
*
7070
* @psalm-return array{type: 'url', urls?: array<string>, description?: string, selector?: string}
7171
*/
72+
#[\Override]
7273
public function jsonSerialize(): array
7374
{
7475
return \array_filter([

tests/src/ConfigLoader/Import/ImportResolverTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class ImportResolverTest extends TestCase
1717
{
18-
private const FIXTURES_DIR = __DIR__ . '/../../../fixtures/ConfigLoader/Import';
18+
private const string FIXTURES_DIR = __DIR__ . '/../../../fixtures/ConfigLoader/Import';
1919

2020
private FilesInterface $files;
2121
private ConfigLoaderFactoryInterface $loaderFactory;
@@ -116,10 +116,10 @@ public function it_should_process_wildcard_imports(): void
116116
$loader = $this->createMock(ConfigLoaderInterface::class);
117117
$loader->method('isSupported')->willReturn(true);
118118

119-
if (\strpos($path, 'config1.json') !== false) {
119+
if (\str_contains($path, 'config1.json')) {
120120
$loader->method('loadRawConfig')->willReturn($wildcardConfig1);
121121
} else {
122-
if (\strpos($path, 'config2.json') !== false) {
122+
if (\str_contains($path, 'config2.json')) {
123123
$loader->method('loadRawConfig')->willReturn($wildcardConfig2);
124124
} else {
125125
$loader->method('loadRawConfig')->willReturn([]);
@@ -172,10 +172,10 @@ public function it_should_detect_circular_imports(): void
172172
$loader = $this->createMock(ConfigLoaderInterface::class);
173173
$loader->method('isSupported')->willReturn(true);
174174

175-
if (\strpos($path, 'base-config.json') !== false) {
175+
if (\str_contains($path, 'base-config.json')) {
176176
$loader->method('loadRawConfig')->willReturn($baseConfig);
177177
} else {
178-
if (\strpos($path, 'circular-import.json') !== false) {
178+
if (\str_contains($path, 'circular-import.json')) {
179179
$loader->method('loadRawConfig')->willReturn($circularConfig);
180180
} else {
181181
$loader->method('loadRawConfig')->willReturn([]);

tests/src/Source/Url/UrlSourceTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#[CoversClass(UrlSource::class)]
1414
class UrlSourceTest extends TestCase
1515
{
16-
private const SAMPLE_URLS = ['https://example.com', 'https://example.org'];
17-
private const SAMPLE_DESCRIPTION = 'Sample URL source';
18-
private const SAMPLE_SELECTOR = '.content';
19-
private const SAMPLE_HEADERS = ['Authorization' => 'Bearer token123'];
20-
private const SAMPLE_TAGS = ['api', 'documentation'];
16+
private const array SAMPLE_URLS = ['https://example.com', 'https://example.org'];
17+
private const string SAMPLE_DESCRIPTION = 'Sample URL source';
18+
private const string SAMPLE_SELECTOR = '.content';
19+
private const array SAMPLE_HEADERS = ['Authorization' => 'Bearer token123'];
20+
private const array SAMPLE_TAGS = ['api', 'documentation'];
2121

2222
/**
2323
* @return array<string, array{selector: ?string, expectedHasSelector: bool}>

0 commit comments

Comments
 (0)