Skip to content

Commit 11dcb58

Browse files
authored
Enhancement: Executed rector PHP 8.2 set (#244)
* Enhancement: Executed rector PHP 8.2 set * Fix: Psalm
1 parent 9d0e77d commit 11dcb58

File tree

58 files changed

+396
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+396
-568
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
with:
7676
php-version: 8.3
7777
coverage: none
78-
tools: php-cs-fixer:3.42, cs2pr
78+
tools: php-cs-fixer:3.64, cs2pr
7979

8080
- name: Checkout code
8181
uses: actions/checkout@v4

config/packages/doctrine.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ doctrine:
1212
mappings:
1313
App:
1414
is_bundle: false
15-
type: annotation
15+
type: attribute
1616
dir: '%kernel.project_dir%/src/Entity'
1717
prefix: 'App\Entity'
1818
alias: App

public/config.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
exit("This script cannot be run from the CLI. Run it from a browser.\n");
55
}
66

7-
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
8-
'127.0.0.1',
9-
'::1',
10-
))) {
7+
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
118
header('HTTP/1.0 403 Forbidden');
129
exit('This script is only accessible from localhost.');
1310
}
1411

15-
require_once dirname(__FILE__).'/../app/SymfonyRequirements.php';
12+
require_once __DIR__.'/../app/SymfonyRequirements.php';
1613

1714
$symfonyRequirements = new SymfonyRequirements();
1815

public/index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
66

7-
return function (array $context) {
8-
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
9-
};
7+
return fn(array $context) => new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

src/Api/Issue/GithubIssueApi.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@
1010

1111
class GithubIssueApi implements IssueApi
1212
{
13-
private $resultPager;
14-
private $issueCommentApi;
15-
private $issueApi;
16-
private $searchApi;
17-
private $botUsername;
18-
19-
public function __construct(ResultPager $resultPager, Comments $issueCommentApi, Issue $issueApi, Search $searchApi, string $botUsername)
20-
{
21-
$this->resultPager = $resultPager;
22-
$this->issueCommentApi = $issueCommentApi;
23-
$this->issueApi = $issueApi;
24-
$this->searchApi = $searchApi;
25-
$this->botUsername = $botUsername;
13+
public function __construct(
14+
private readonly ResultPager $resultPager,
15+
private readonly Comments $issueCommentApi,
16+
private readonly Issue $issueApi,
17+
private readonly Search $searchApi,
18+
private readonly string $botUsername,
19+
) {
2620
}
2721

2822
public function open(Repository $repository, string $title, string $body, array $labels)

src/Api/Label/GithubLabelApi.php

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,14 @@ class GithubLabelApi implements LabelApi
2020
*
2121
* @var array<array-key, array<array-key, bool>>
2222
*/
23-
private $labelCache = [];
24-
25-
/**
26-
* @var Labels
27-
*/
28-
private $labelsApi;
29-
30-
/**
31-
* @var ResultPager
32-
*/
33-
private $resultPager;
34-
35-
/**
36-
* @var CacheInterface
37-
*/
38-
private $cache;
39-
40-
/**
41-
* @var LoggerInterface
42-
*/
43-
private $logger;
44-
45-
public function __construct(Labels $labelsApi, ResultPager $resultPager, CacheInterface $cache, LoggerInterface $logger)
46-
{
47-
$this->labelsApi = $labelsApi;
48-
$this->resultPager = $resultPager;
49-
$this->cache = $cache;
50-
$this->logger = $logger;
23+
private array $labelCache = [];
24+
25+
public function __construct(
26+
private readonly Labels $labelsApi,
27+
private readonly ResultPager $resultPager,
28+
private readonly CacheInterface $cache,
29+
private readonly LoggerInterface $logger,
30+
) {
5131
}
5232

5333
public function getIssueLabels($issueNumber, Repository $repository): array

src/Api/Milestone/GithubMilestoneApi.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,15 @@
1111
*/
1212
class GithubMilestoneApi implements MilestoneApi
1313
{
14-
/**
15-
* @var Milestones
16-
*/
17-
private $milestonesApi;
18-
19-
/**
20-
* @var Issue
21-
*/
22-
private $issuesApi;
23-
2414
/**
2515
* @var string[][]
2616
*/
27-
private $cache = [];
17+
private array $cache = [];
2818

29-
public function __construct(Milestones $milestonesApi, Issue $issuesApi)
30-
{
31-
$this->milestonesApi = $milestonesApi;
32-
$this->issuesApi = $issuesApi;
19+
public function __construct(
20+
private readonly Milestones $milestonesApi,
21+
private readonly Issue $issuesApi,
22+
) {
3323
}
3424

3525
private function getMilestones(Repository $repository): array
@@ -48,7 +38,7 @@ private function getMilestones(Repository $repository): array
4838
return $this->cache[$key];
4939
}
5040

51-
public function updateMilestone(Repository $repository, int $issueNumber, string $milestoneName)
41+
public function updateMilestone(Repository $repository, int $issueNumber, string $milestoneName): void
5242
{
5343
$milestoneNumber = null;
5444
foreach ($this->getMilestones($repository) as $milestone) {
@@ -77,7 +67,7 @@ public function exists(Repository $repository, string $milestoneName): bool
7767
return false;
7868
}
7969

80-
private function getCacheKey(Repository $repository)
70+
private function getCacheKey(Repository $repository): string
8171
{
8272
return sprintf('%s_%s', $repository->getVendor(), $repository->getName());
8373
}

src/Api/Milestone/MilestoneApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
interface MilestoneApi
1111
{
12-
public function updateMilestone(Repository $repository, int $issueNumber, string $milestoneName);
12+
public function updateMilestone(Repository $repository, int $issueNumber, string $milestoneName): void;
1313

1414
public function exists(Repository $repository, string $milestoneName): bool;
1515
}

src/Api/Milestone/NullMilestoneApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class NullMilestoneApi implements MilestoneApi
1010
{
11-
public function updateMilestone(Repository $repository, int $issueNumber, string $milestoneName)
11+
public function updateMilestone(Repository $repository, int $issueNumber, string $milestoneName): void
1212
{
1313
}
1414

src/Api/PullRequest/GithubPullRequestApi.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@
1111
*/
1212
class GithubPullRequestApi implements PullRequestApi
1313
{
14-
private $pullRequest;
15-
private $search;
16-
17-
public function __construct(PullRequest $pullRequest, Search $search)
18-
{
19-
$this->pullRequest = $pullRequest;
20-
$this->search = $search;
14+
public function __construct(
15+
private readonly PullRequest $pullRequest,
16+
private readonly Search $search,
17+
) {
2118
}
2219

2320
public function show(Repository $repository, $number): array
2421
{
2522
return (array) $this->pullRequest->show($repository->getVendor(), $repository->getName(), $number);
2623
}
2724

28-
public function updateTitle(Repository $repository, $number, string $title, string $body = null): void
25+
public function updateTitle(Repository $repository, $number, string $title, ?string $body = null): void
2926
{
3027
$params = ['title' => $title];
3128

0 commit comments

Comments
 (0)