Skip to content

Commit 074bf21

Browse files
committed
Apply Rector
1 parent 5765a44 commit 074bf21

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
__DIR__ . '/tests/',
1212
])
1313
->exclude('build')
14+
->exclude('Views/errors')
1415
->append([__FILE__]);
1516

1617
$overrides = [];

app/Libraries/Blog.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,8 @@ protected function readPost(string $folder, string $filename)
253253
}
254254

255255
if (! $inBody) {
256-
$key = substr($line, 0, strpos($line, ':'));
257-
$value = trim(substr($line, strpos($line, ':') + 1));
258-
259-
$post->{$key} = $value;
256+
$key = substr($line, 0, strpos($line, ':'));
257+
$post->{$key} = trim(substr($line, strpos($line, ':') + 1));
260258

261259
continue;
262260
}

tests/_support/Mock/MockGitHub.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ class MockGitHub extends GitHub
1616
/**
1717
* Whether the next API call should throw
1818
* an exception.
19-
*
20-
* @var bool
2119
*/
22-
private $throws = false;
20+
private bool $throws = false;
2321

2422
/**
2523
* Skips the need for parameters
@@ -133,10 +131,10 @@ private function repoReleasesAll(): array
133131
'assets_url' => 'https://api.github.com/repos/codeigniter4/CodeIgniter4/releases/37193785/assets',
134132
'upload_url' => 'https://uploads.github.com/repos/codeigniter4/CodeIgniter4/releases/37193785/assets{?name,label}',
135133
'html_url' => 'https://github.com/codeigniter4/CodeIgniter4/releases/tag/v4.1.1',
136-
'id' => 37193785,
134+
'id' => 37_193_785,
137135
'author' => [
138136
'login' => 'MGatner',
139-
'id' => 17572847,
137+
'id' => 17_572_847,
140138
'node_id' => 'MDQ6VXNlcjE3NTcyODQ3',
141139
'avatar_url' => 'https://avatars.githubusercontent.com/u/17572847?v=4',
142140
'url' => 'https://api.github.com/users/MGatner',
@@ -162,10 +160,10 @@ private function repoReleasesAll(): array
162160
'assets_url' => 'https://api.github.com/repos/codeigniter4/CodeIgniter4/releases/37155037/assets',
163161
'upload_url' => 'https://uploads.github.com/repos/codeigniter4/CodeIgniter4/releases/37155037/assets{?name,label}',
164162
'html_url' => 'https://github.com/codeigniter4/CodeIgniter4/releases/tag/v4.1.0',
165-
'id' => 37155037,
163+
'id' => 37_155_037,
166164
'author' => [
167165
'login' => 'MGatner',
168-
'id' => 17572847,
166+
'id' => 17_572_847,
169167
'node_id' => 'MDQ6VXNlcjE3NTcyODQ3',
170168
'avatar_url' => 'https://avatars.githubusercontent.com/u/17572847?v=4',
171169
'url' => 'https://api.github.com/users/MGatner',
@@ -197,7 +195,7 @@ private function repoContributors(): array
197195
return [
198196
[
199197
'login' => 'narfbg',
200-
'id' => 1058011,
198+
'id' => 1_058_011,
201199
'node_id' => 'MDQ6VXNlcjEwNTgwMTE=',
202200
'avatar_url' => 'https://avatars.githubusercontent.com/u/1058011?v=4',
203201
'gravatar_id' => '',
@@ -239,7 +237,7 @@ private function repoContributors(): array
239237
],
240238
[
241239
'login' => 'jim-parry',
242-
'id' => 3203951,
240+
'id' => 3_203_951,
243241
'node_id' => 'MDQ6VXNlcjMyMDM5NTE=',
244242
'avatar_url' => 'https://avatars.githubusercontent.com/u/3203951?v=4',
245243
'gravatar_id' => '',
@@ -267,14 +265,14 @@ private function repoContributors(): array
267265
private function repoShow(): array
268266
{
269267
return [
270-
'id' => 205950333,
268+
'id' => 205_950_333,
271269
'node_id' => 'MDEwOlJlcG9zaXRvcnkyMDU5NTAzMzM=',
272270
'name' => 'website2',
273271
'full_name' => 'codeigniter4projects/website2',
274272
'private' => false,
275273
'owner' => [
276274
'login' => 'codeigniter4projects',
277-
'id' => 53120982,
275+
'id' => 53_120_982,
278276
'node_id' => 'MDEyOk9yZ2FuaXphdGlvbjUzMTIwOTgy',
279277
'avatar_url' => 'https://avatars.githubusercontent.com/u/53120982?v=4',
280278
'gravatar_id' => '',
@@ -368,7 +366,7 @@ private function repoShow(): array
368366
'temp_clone_token' => null,
369367
'organization' => [
370368
'login' => 'codeigniter4projects',
371-
'id' => 53120982,
369+
'id' => 53_120_982,
372370
'node_id' => 'MDEyOk9yZ2FuaXphdGlvbjUzMTIwOTgy',
373371
'avatar_url' => 'https://avatars.githubusercontent.com/u/53120982?v=4',
374372
'gravatar_id' => '',

tests/libaries/GitHubTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
*/
1313
final class GitHubTest extends ProjectTestCase
1414
{
15-
/**
16-
* @var MockGitHub
17-
*/
18-
private $github;
15+
private MockGitHub $github;
1916

2017
protected function setUp(): void
2118
{
@@ -112,7 +109,7 @@ public function testGetRepos()
112109
$result = $this->github->getRepos();
113110

114111
$this->assertIsArray($result);
115-
$this->assertCount(count(config('GitHub')->repos), $result);
112+
$this->assertCount(is_countable(config('GitHub')->repos) ? count(config('GitHub')->repos) : 0, $result);
116113
$this->assertInstanceOf(Repo::class, $result['framework4']);
117114
}
118115

@@ -121,7 +118,7 @@ public function testGetContributors()
121118
$result = $this->github->getContributors();
122119

123120
$this->assertIsArray($result);
124-
$this->assertCount(count(config('GitHub')->repos), $result);
121+
$this->assertCount(is_countable(config('GitHub')->repos) ? count(config('GitHub')->repos) : 0, $result);
125122
$this->assertInstanceOf(Contributor::class, $result['framework4'][0]);
126123
}
127124

@@ -165,7 +162,7 @@ public function testResolving()
165162
$this->assertInstanceOf('Closure', $result);
166163

167164
// Force the resolver to run
168-
$count = count(cache()->getCacheInfo());
165+
$count = is_countable(cache()->getCacheInfo()) ? count(cache()->getCacheInfo()) : 0;
169166
$author = $release->author;
170167

171168
$this->assertIsString($author);

0 commit comments

Comments
 (0)