Skip to content

Commit 131cc6b

Browse files
committed
Upgrade PHP Code Sniffer
1 parent fdfc304 commit 131cc6b

11 files changed

+35
-23
lines changed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"league/commonmark": "^2.3",
2323
"nette/php-generator": "^4.0.0",
2424
"psr/log": "^3.0.0",
25-
"squizlabs/php_codesniffer": "3.*",
25+
"squizlabs/php_codesniffer": "^3.9.1",
2626
"symfony/console": "^6.1",
2727
"twig/markdown-extra": "^3.4",
2828
"twig/twig": "^3.0.0"

Diff for: composer.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/Builder/MeetupCollection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function count(): int
5757
return count($this->array);
5858
}
5959

60-
public function append(MeetupEntry $meetup)
60+
public function append(MeetupEntry $meetup): void
6161
{
6262
$this->array[] = $meetup;
6363
}

Diff for: src/Builder/Processor/HTMLProcessor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
abstract class HTMLProcessor extends AbstractProcessor
1111
{
12-
protected function writeHtml(string $html, string $filename, DateTimeImmutable $modifiedTime = null)
12+
protected function writeHtml(string $html, string $filename, DateTimeImmutable $modifiedTime = null): void
1313
{
1414
$destination = "$this->outputDirectory/$filename";
1515
$path = substr($destination, 0, strlen(basename($destination)) * -1);

Diff for: src/Builder/Processor/HomepageProcessor.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use DateTimeImmutable;
88
use MergePHP\Website\Builder\MeetupCollection;
9-
use MergePHP\Website\Meetups;
109
use Psr\Log\LoggerInterface;
1110
use Twig\Environment;
1211

Diff for: src/Builder/Processor/MissingLinkProcessor.php

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function __construct(
2020
public function run(): void
2121
{
2222
$this->logger->info('Checking for missing YouTube links');
23-
$buckets = [];
2423

2524
foreach ($this->meetups->withOnlyPast() as $meetup) {
2625
if ($meetup->instance->getYouTubeLink() === null) {

Diff for: src/Builder/SiteBuilderService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
class SiteBuilderService
2929
{
30-
protected const APP_ROOT = __DIR__ . '/../..';
30+
protected const string APP_ROOT = __DIR__ . '/../..';
3131
private Environment $twig;
3232

3333
public function __construct(protected string $outputDirectory, protected LoggerInterface $logger)

Diff for: src/Generator/MeetupGeneratorService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(public string $directory)
2323
}
2424
}
2525

26-
protected const SUGGESTED_DATE_FORMAT = 'Y-m-d';
26+
protected const string SUGGESTED_DATE_FORMAT = 'Y-m-d';
2727

2828
public function getSuggestedDate(string $baseDate = 'now'): string
2929
{

Diff for: tests/Builder/Processor/RssFeedProcessorTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
class RssFeedProcessorTest extends TestCase
1919
{
20-
private const MEETUP_DATE_STRING = '2000-01-01T00:00:00+00:00';
21-
private const MODIFIED_DATE_STRING = '2000-01-02T00:00:00+00:00';
22-
private const EXPECTED_FILENAME = 'vfs://root/atom.xml';
23-
private const FIXTURES_DIR = __DIR__ . '/../../fixtures/';
20+
private const string MEETUP_DATE_STRING = '2000-01-01T00:00:00+00:00';
21+
private const string MODIFIED_DATE_STRING = '2000-01-02T00:00:00+00:00';
22+
private const string EXPECTED_FILENAME = 'vfs://root/atom.xml';
23+
private const string FIXTURES_DIR = __DIR__ . '/../../fixtures/';
2424

2525
public function setUp(): void
2626
{

Diff for: tests/Generator/MeetupGeneratorCommandTest.php

+19-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,26 @@
1414
class MeetupGeneratorCommandTest extends TestCase
1515
{
1616
// generate args simulate what the user types in to the command line
17-
private const GENERATE_1_ARGS = ['Title', 'Description', null , 'Name', 'Bio', null];
18-
private const GENERATE_2_ARGS = ['Title', 'Description', '2023-01-01', 'Name', 'Bio', null];
19-
private const GENERATE_3_ARGS = ['Title', 'Description', '2023-01-01', 'Name', 'Bio', 'https://example.com/f.jpg'];
17+
private const array GENERATE_1_ARGS = ['Title', 'Description', null , 'Name', 'Bio', null];
18+
private const array GENERATE_2_ARGS = ['Title', 'Description', '2023-01-01', 'Name', 'Bio', null];
19+
private const array GENERATE_3_ARGS = [
20+
'Title',
21+
'Description',
22+
'2023-01-01',
23+
'Name',
24+
'Bio',
25+
'https://example.com/f.jpg'
26+
];
2027
// command args are what the generator command expects to be called with given a certain set of generate args
21-
private const COMMAND_1_2_ARGS = ['Title', 'Description', '2023-01-01', 'Name', 'Bio', null];
22-
private const COMMAND_3_ARGS = ['Title', 'Description', '2023-01-01', 'Name', 'Bio', 'https://example.com/f.jpg'];
28+
private const array COMMAND_1_2_ARGS = ['Title', 'Description', '2023-01-01', 'Name', 'Bio', null];
29+
private const array COMMAND_3_ARGS = [
30+
'Title',
31+
'Description',
32+
'2023-01-01',
33+
'Name',
34+
'Bio',
35+
'https://example.com/f.jpg'
36+
];
2337

2438
private CommandTester $commandTester;
2539

Diff for: tests/Generator/MeetupGeneratorServiceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class MeetupGeneratorServiceTest extends TestCase
1212
{
1313
private MeetupGeneratorService $generator;
14-
private const FIXTURES_DIR = __DIR__ . '/../fixtures/';
14+
private const string FIXTURES_DIR = __DIR__ . '/../fixtures/';
1515

1616
public function setUp(): void
1717
{

0 commit comments

Comments
 (0)