Skip to content

Commit f7f1514

Browse files
authored
Merge pull request #25 from InteractionDesignFoundation/phpcs4
PHPCS 4
2 parents 681c62b + 1d93771 commit f7f1514

15 files changed

+58
-20
lines changed

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/.cache export-ignore
12
/.github export-ignore
3+
/.editorconfig export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
26
/tests export-ignore
37
/phpunit.xml.dist export-ignore
8+
/psalm.xml export-ignore
9+
/psalm-baseline.xml export-ignore
10+
/renovate.json export-ignore

.github/workflows/format_php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup PHP
2222
uses: shivammathur/setup-php@v2
2323
with:
24-
php-version: 8.2
24+
php-version: 8.4
2525
coverage: none
2626
tools: cs2pr
2727
- name: Get Composer cache directory

.github/workflows/psalm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup PHP
2525
uses: shivammathur/setup-php@v2
2626
with:
27-
php-version: 8.2
27+
php-version: 8.4
2828
coverage: none
2929

3030
- name: Get Composer cache directory

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
- "lowest"
2626
- "highest"
2727
php-version:
28-
- "8.2"
2928
- "8.3"
29+
- "8.4"
3030
operating-system:
3131
- "ubuntu-latest"
3232

.github/workflows/validator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
23-
php-version: 8.2
23+
php-version: 8.4
2424
coverage: none
2525

2626
- name: Get Composer cache directory
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace IxDFCodingStandard\Helpers;
4+
5+
/** Created based on \SlevomatCodingStandard\Helpers to have a SSoT for this internal API */
6+
final class ClassHelper extends \SlevomatCodingStandard\Helpers\ClassHelper
7+
{
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace IxDFCodingStandard\Helpers;
4+
5+
/** Created based on \SlevomatCodingStandard\Helpers to have a SSoT for this internal API */
6+
final class TokenHelper extends \SlevomatCodingStandard\Helpers\TokenHelper
7+
{
8+
public const array NAME_TOKEN_CODES = parent::NAME_TOKEN_CODES;
9+
}

IxDFCodingStandard/Sniffs/Classes/ForbidMethodDeclarationSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace IxDFCodingStandard\Sniffs\Classes;
44

5+
use IxDFCodingStandard\Helpers\ClassHelper;
56
use PHP_CodeSniffer\Files\File;
67
use PHP_CodeSniffer\Sniffs\Sniff;
7-
use SlevomatCodingStandard\Helpers\ClassHelper;
88

99
final class ForbidMethodDeclarationSniff implements Sniff
1010
{

IxDFCodingStandard/Sniffs/Functions/MissingOptionalArgumentSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace IxDFCodingStandard\Sniffs\Functions;
44

5+
use IxDFCodingStandard\Helpers\TokenHelper;
56
use PHP_CodeSniffer\Files\File;
67
use PHP_CodeSniffer\Sniffs\Sniff;
78
use PHP_CodeSniffer\Util\Tokens;
8-
use SlevomatCodingStandard\Helpers\TokenHelper;
99

1010
/** Inspired by {@see \SlevomatCodingStandard\Sniffs\Functions\StrictCallSniff}. */
1111
final class MissingOptionalArgumentSniff implements Sniff
@@ -21,7 +21,7 @@ final class MissingOptionalArgumentSniff implements Sniff
2121
/** @return array<int, (int|string)> */
2222
public function register(): array
2323
{
24-
return TokenHelper::ONLY_NAME_TOKEN_CODES;
24+
return TokenHelper::NAME_TOKEN_CODES;
2525
}
2626

2727
/** @inheritDoc */

IxDFCodingStandard/Sniffs/Laravel/BladeTemplateExtractor.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use BadMethodCallException;
66

7+
/** phpcs:disable IxDFCodingStandard.Laravel.NonExistingBladeTemplate.TemplateNotFound */
78
final class BladeTemplateExtractor
89
{
910
private const INVALID_METHOD_CALL = 'Invalid method call';
@@ -53,7 +54,7 @@ public function getBladeTemplateName(string $tokenContent): string
5354
throw new BadMethodCallException(self::INVALID_METHOD_CALL);
5455
}
5556

56-
return (string) $matches[2];
57+
return $matches[2];
5758
}
5859

5960
public function getConditionalBladeTemplateName(string $tokenContent): string
@@ -69,7 +70,7 @@ public function getConditionalBladeTemplateName(string $tokenContent): string
6970
throw new BadMethodCallException(self::INVALID_METHOD_CALL);
7071
}
7172

72-
return (string) $matches[2];
73+
return $matches[2];
7374
}
7475

7576
public function getEachBladeTemplateName(string $tokenContent): string
@@ -85,7 +86,7 @@ public function getEachBladeTemplateName(string $tokenContent): string
8586
throw new BadMethodCallException(self::INVALID_METHOD_CALL);
8687
}
8788

88-
return (string) $matches[1];
89+
return $matches[1];
8990
}
9091

9192
public function getFirstBladeTemplateName(string $tokenContent): string
@@ -101,6 +102,6 @@ public function getFirstBladeTemplateName(string $tokenContent): string
101102
throw new BadMethodCallException(self::INVALID_METHOD_CALL);
102103
}
103104

104-
return (string) $matches[2];
105+
return $matches[2];
105106
}
106107
}

0 commit comments

Comments
 (0)