Skip to content

Commit 9e014e4

Browse files
committed
Update psalm to 6.x and minimum PHP to 8.1
1 parent e88599f commit 9e014e4

21 files changed

+58
-20
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@ jobs:
4040
matrix:
4141
os: [ubuntu-latest]
4242
php_version:
43-
- 7.2
44-
- 7.3
45-
- 7.4
46-
- 8.0
4743
- 8.1
4844
- 8.2
4945
- 8.3
46+
- 8.4
5047
dependencies_level:
5148
- --prefer-lowest
5249
- ""
@@ -90,7 +87,7 @@ jobs:
9087
run: vendor/bin/phpstan analyse --no-progress
9188
- name: Run psalm
9289
if: ${{ matrix.os != 'windows-latest' }}
93-
run: vendor/bin/psalm --show-info=true
90+
run: vendor/bin/psalm
9491
- name: Run phan
9592
if: ${{ matrix.os != 'windows-latest' }}
9693
run: vendor/bin/phan

.phan/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'MO4',
2424
'tests',
2525
'vendor/squizlabs/php_codesniffer',
26+
'vendor/symfony/polyfill-php83',
2627
],
2728

2829
// A directory list that defines files that will be excluded

MO4/Library/PregLibrary.php

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

1717
use PHP_CodeSniffer\Exceptions\RuntimeException;
1818

19-
class PregLibrary
19+
final class PregLibrary
2020
{
2121
/**
2222
* Split string by a regular expression

MO4/Sniffs/Arrays/ArrayDoubleArrowAlignmentSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
* @license http://spdx.org/licenses/MIT MIT License
3131
*
3232
* @link https://github.com/mayflower/mo4-coding-standard
33+
*
34+
* @psalm-api
3335
*/
3436
class ArrayDoubleArrowAlignmentSniff implements Sniff
3537
{
@@ -51,6 +53,7 @@ class ArrayDoubleArrowAlignmentSniff implements Sniff
5153
*
5254
* @see Tokens.php
5355
*/
56+
#[\Override]
5457
public function register(): array
5558
{
5659
return $this->arrayTokens;
@@ -67,6 +70,7 @@ public function register(): array
6770
*
6871
* @return void
6972
*/
73+
#[\Override]
7074
public function process(File $phpcsFile, $stackPtr): void
7175
{
7276
$tokens = $phpcsFile->getTokens();

MO4/Sniffs/Arrays/MultiLineArraySniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
* @license http://spdx.org/licenses/MIT MIT License
2828
*
2929
* @link https://github.com/mayflower/mo4-coding-standard
30+
*
31+
* @psalm-api
3032
*/
3133
class MultiLineArraySniff implements Sniff
3234
{
@@ -48,6 +50,7 @@ class MultiLineArraySniff implements Sniff
4850
*
4951
* @see Tokens.php
5052
*/
53+
#[\Override]
5154
public function register(): array
5255
{
5356
return $this->arrayTokens;
@@ -64,6 +67,7 @@ public function register(): array
6467
*
6568
* @return void
6669
*/
70+
#[\Override]
6771
public function process(File $phpcsFile, $stackPtr): void
6872
{
6973
$tokens = $phpcsFile->getTokens();

MO4/Sniffs/Commenting/PropertyCommentSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
* @license http://spdx.org/licenses/MIT MIT License
3333
*
3434
* @link https://github.com/mayflower/mo4-coding-standard
35+
*
36+
* @psalm-api
3537
*/
3638
class PropertyCommentSniff extends AbstractScopeSniff
3739
{
@@ -75,6 +77,7 @@ public function __construct()
7577
*
7678
* @throws RuntimeException
7779
*/
80+
#[\Override]
7881
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope): void
7982
{
8083
$find = [
@@ -243,6 +246,7 @@ protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScop
243246
*
244247
* @return void
245248
*/
249+
#[\Override]
246250
protected function processTokenOutsideScope(File $phpcsFile, $stackPtr): void
247251
{
248252
}

MO4/Sniffs/Formatting/AlphabeticalUseStatementsSniff.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
* @license http://spdx.org/licenses/MIT MIT License
3434
*
3535
* @link https://github.com/mayflower/mo4-coding-standard
36+
*
37+
* @psalm-api
3638
*/
3739
class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
3840
{
@@ -87,6 +89,7 @@ class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
8789
*
8890
* @return void
8991
*/
92+
#[\Override]
9093
public function process(File $phpcsFile, $stackPtr): void
9194
{
9295
if (!\in_array($this->order, self::SUPPORTED_ORDERING_METHODS, true)) {
@@ -292,7 +295,8 @@ private function findNewDestination(File $phpcsFile, int $stackPtr, string $impo
292295
{
293296
$tokens = $phpcsFile->getTokens();
294297

295-
$line = $tokens[$stackPtr]['line'];
298+
$line = $tokens[$stackPtr]['line'];
299+
/** @var int|bool $prevLine */
296300
$prevLine = false;
297301
$prevPtr = $stackPtr;
298302

MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* @license http://spdx.org/licenses/MIT MIT License
3535
*
3636
* @link https://github.com/mayflower/mo4-coding-standard
37+
*
38+
* @psalm-api
3739
*/
3840
class UnnecessaryNamespaceUsageSniff implements Sniff
3941
{
@@ -54,6 +56,7 @@ class UnnecessaryNamespaceUsageSniff implements Sniff
5456
*
5557
* @see Tokens.php
5658
*/
59+
#[\Override]
5760
public function register(): array
5861
{
5962
return [T_CLASS];
@@ -75,6 +78,7 @@ public function register(): array
7578
*
7679
* @throws RuntimeException
7780
*/
81+
#[\Override]
7882
public function process(File $phpcsFile, $stackPtr): void
7983
{
8084
$docCommentTags = [
@@ -381,6 +385,7 @@ private function checkShorthandPossible(File $phpcsFile, array $useStatements, s
381385
if (true === $isDocBlock) {
382386
$tokens = $phpcsFile->getTokens();
383387
$oldContent = $tokens[$startPtr]['content'];
388+
/** @var string $newContent */
384389
$newContent = \str_replace($className, $replacement, $oldContent);
385390
$phpcsFile->fixer->replaceToken($startPtr, $newContent);
386391
} else {

MO4/Sniffs/Strings/VariableInDoubleQuotedStringSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
* @license http://spdx.org/licenses/MIT MIT License
3030
*
3131
* @link https://github.com/mayflower/mo4-coding-standard
32+
*
33+
* @psalm-api
3234
*/
3335
class VariableInDoubleQuotedStringSniff implements Sniff
3436
{
@@ -39,6 +41,7 @@ class VariableInDoubleQuotedStringSniff implements Sniff
3941
*
4042
* @see Tokens.php
4143
*/
44+
#[\Override]
4245
public function register(): array
4346
{
4447
return [T_DOUBLE_QUOTED_STRING];
@@ -58,6 +61,7 @@ public function register(): array
5861
*
5962
* @return void
6063
*/
64+
#[\Override]
6165
public function process(File $phpcsFile, $stackPtr): void
6266
{
6367
$varRegExp = '/\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/';

MO4/Sniffs/WhiteSpace/ConstantSpacingSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
* @license http://spdx.org/licenses/MIT MIT License
2828
*
2929
* @link https://github.com/mayflower/mo4-coding-standard
30+
*
31+
* @psalm-api
3032
*/
3133
class ConstantSpacingSniff implements Sniff
3234
{
@@ -46,6 +48,7 @@ class ConstantSpacingSniff implements Sniff
4648
*
4749
* @see Tokens.php
4850
*/
51+
#[\Override]
4952
public function register(): array
5053
{
5154
return $this->arrayTokens;
@@ -62,6 +65,7 @@ public function register(): array
6265
*
6366
* @return void
6467
*/
68+
#[\Override]
6569
public function process(File $phpcsFile, $stackPtr): void
6670
{
6771
$tokens = $phpcsFile->getTokens();

0 commit comments

Comments
 (0)