Skip to content

Commit

Permalink
Bump to PHP 8.2 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jan 3, 2024
1 parent 35232b3 commit c40feb1
Show file tree
Hide file tree
Showing 25 changed files with 71 additions and 72 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ jobs:
name: 'Tests'
run: vendor/bin/phpunit

-
name: 'Check Commented Code'
run: vendor/bin/easy-ci check-commented-code src tests --ansi

-
name: 'Check Active Classes'
run: vendor/bin/class-leak check src --ansi
Expand All @@ -49,10 +45,11 @@ jobs:

steps:
- uses: actions/checkout@v3

# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
coverage: none

# composer install cache - https://github.com/ramsey/composer-install
Expand Down
15 changes: 6 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
"description": "Set of Symplify rules for PHP_CodeSniffer and PHP CS Fixer.",
"license": "MIT",
"require": {
"php": ">=8.1",
"php": ">=8.2",
"nette/utils": "^3.2",
"friendsofphp/php-cs-fixer": "^3.40",
"friendsofphp/php-cs-fixer": "^3.45",
"symplify/rule-doc-generator-contracts": "^11.1"
},
"require-dev": {
"symplify/easy-coding-standard": "^12.0.11",
"squizlabs/php_codesniffer": "^3.7.2",
"phpunit/phpunit": "^10.2",
"squizlabs/php_codesniffer": "^3.8.0",
"phpunit/phpunit": "^10.5",
"symplify/rule-doc-generator": "^12.0",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10.26",
"rector/rector": "^0.17.7",
"symplify/easy-ci": "^11.3",
"phpstan/phpstan": "^1.10.50",
"rector/rector": "^0.18",
"symplify/phpstan-extensions": "^11.2",
"tomasvotruba/unused-public": "^0.3",
"tomasvotruba/type-coverage": "^0.2",
"tomasvotruba/class-leak": "^0.2",
"tracy/tracy": "^2.10"
},
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ parameters:
- '#Constant T_OPEN_CURLY_BRACKET|T_START_NOWDOC not found#'
- '#Parameter \#1 \$index of method PhpCsFixer\\Tokenizer\\Tokens\:\:getNextTokenOfKind\(\) expects int, int\|null given#'
- '#Method Symplify\\CodingStandard\\TokenRunner\\Traverser\\ArrayBlockInfoFinder\:\:reverseTokens\(\) should return array<PhpCsFixer\\Tokenizer\\Token> but returns array<int, PhpCsFixer\\Tokenizer\\Token\|null>#'

# false positive
-
message: '#Parameter \#1 \$sequence of method PhpCsFixer\\Tokenizer\\Tokens\:\:findSequence\(\) expects non\-empty\-array<int, array\{0\: int, 1\?\: string\}\|PhpCsFixer\\Tokenizer\\Token\|string>, array<PhpCsFixer\\Tokenizer\\Token> given#'
path: src/Fixer/Strict/BlankLineAfterStrictTypesFixer.php
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_82,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::CODING_STYLE,
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Strict/BlankLineAfterStrictTypesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function fix(SplFileInfo $fileInfo, Tokens $tokens): void
return;
}

$semicolonPosition = (int) array_key_last($sequenceLocation);
$semicolonPosition = array_key_last($sequenceLocation);

// empty file
if (! isset($tokens[$semicolonPosition + 2])) {
Expand Down
6 changes: 3 additions & 3 deletions src/TokenAnalyzer/ParamNewliner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
use Symplify\CodingStandard\TokenRunner\Transformer\FixerTransformer\TokensNewliner;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class ParamNewliner
final readonly class ParamNewliner
{
public function __construct(
private readonly BlockFinder $blockFinder,
private readonly TokensNewliner $tokensNewliner,
private BlockFinder $blockFinder,
private TokensNewliner $tokensNewliner,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/TokenRunner/Analyzer/FixerAnalyzer/ArrayAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
use PhpCsFixer\Tokenizer\Tokens;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class ArrayAnalyzer
final readonly class ArrayAnalyzer
{
public function __construct(
private readonly TokenSkipper $tokenSkipper
private TokenSkipper $tokenSkipper
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/TokenRunner/Analyzer/FixerAnalyzer/IndentDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
use PhpCsFixer\Tokenizer\Tokens;
use PhpCsFixer\WhitespacesFixerConfig;

final class IndentDetector
final readonly class IndentDetector
{
public function __construct(
private readonly WhitespacesFixerConfig $whitespacesFixerConfig
private WhitespacesFixerConfig $whitespacesFixerConfig
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/TokenRunner/Analyzer/FixerAnalyzer/TokenSkipper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Symplify\CodingStandard\TokenRunner\Exception\TokenNotFoundException;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class TokenSkipper
final readonly class TokenSkipper
{
public function __construct(
private readonly BlockFinder $blockFinder
private BlockFinder $blockFinder
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/TokenRunner/Arrays/ArrayItemNewliner.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use Symplify\CodingStandard\TokenRunner\Analyzer\FixerAnalyzer\ArrayAnalyzer;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class ArrayItemNewliner
final readonly class ArrayItemNewliner
{
public function __construct(
private readonly ArrayAnalyzer $arrayAnalyzer,
private readonly WhitespacesFixerConfig $whitespacesFixerConfig
private ArrayAnalyzer $arrayAnalyzer,
private WhitespacesFixerConfig $whitespacesFixerConfig
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver;
use Symplify\CodingStandard\TokenRunner\Contract\DocBlock\MalformWorkerInterface;

final class MissingParamNameMalformWorker implements MalformWorkerInterface
final readonly class MissingParamNameMalformWorker implements MalformWorkerInterface
{
/**
* @var string
Expand All @@ -33,7 +33,7 @@ final class MissingParamNameMalformWorker implements MalformWorkerInterface
private const PARAM_WITH_NAME_REGEX = '#@param(.*?)\$[\w]+(.*?)\n#';

public function __construct(
private readonly DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver
private DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver;
use Symplify\CodingStandard\TokenRunner\Contract\DocBlock\MalformWorkerInterface;

final class ParamNameTypoMalformWorker implements MalformWorkerInterface
final readonly class ParamNameTypoMalformWorker implements MalformWorkerInterface
{
/**
* @var string
Expand All @@ -21,7 +21,7 @@ final class ParamNameTypoMalformWorker implements MalformWorkerInterface
private const PARAM_NAME_REGEX = '#@param(\s+)(?<callable>callable)?(.*?)(?<paramName>\$\w+)#';

public function __construct(
private readonly DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver
private DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;
use Symplify\CodingStandard\TokenRunner\ValueObjectFactory\LineLengthAndPositionFactory;

final class FirstLineLengthResolver
final readonly class FirstLineLengthResolver
{
public function __construct(
private readonly LineLengthAndPositionFactory $lineLengthAndPositionFactory
private LineLengthAndPositionFactory $lineLengthAndPositionFactory
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use Symplify\CodingStandard\TokenRunner\TokenFinder;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class LineLengthCloserTransformer
final readonly class LineLengthCloserTransformer
{
public function __construct(
private readonly CallAnalyzer $callAnalyzer,
private readonly TokenFinder $tokenFinder
private CallAnalyzer $callAnalyzer,
private TokenFinder $tokenFinder
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
use Symplify\CodingStandard\TokenRunner\Analyzer\FixerAnalyzer\CallAnalyzer;
use Symplify\CodingStandard\TokenRunner\Exception\TokenNotFoundException;

final class LineLengthOpenerTransformer
final readonly class LineLengthOpenerTransformer
{
public function __construct(
private readonly CallAnalyzer $callAnalyzer
private CallAnalyzer $callAnalyzer
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
use Symplify\CodingStandard\TokenRunner\Enum\LineKind;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class LineLengthTransformer
final readonly class LineLengthTransformer
{
public function __construct(
private readonly LineLengthResolver $lineLengthResolver,
private readonly TokensInliner $tokensInliner,
private readonly FirstLineLengthResolver $firstLineLengthResolver,
private readonly TokensNewliner $tokensNewliner
private LineLengthResolver $lineLengthResolver,
private TokensInliner $tokensInliner,
private FirstLineLengthResolver $firstLineLengthResolver,
private TokensNewliner $tokensNewliner
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
use Symplify\CodingStandard\TokenRunner\Analyzer\FixerAnalyzer\TokenSkipper;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class TokensInliner
final readonly class TokensInliner
{
public function __construct(
private readonly TokenSkipper $tokenSkipper
private TokenSkipper $tokenSkipper
) {
}

Expand Down
12 changes: 6 additions & 6 deletions src/TokenRunner/Transformer/FixerTransformer/TokensNewliner.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;
use Symplify\CodingStandard\TokenRunner\Whitespace\IndentResolver;

final class TokensNewliner
final readonly class TokensNewliner
{
public function __construct(
private readonly LineLengthCloserTransformer $lineLengthCloserTransformer,
private readonly TokenSkipper $tokenSkipper,
private readonly LineLengthOpenerTransformer $lineLengthOpenerTransformer,
private readonly WhitespacesFixerConfig $whitespacesFixerConfig,
private readonly IndentResolver $indentResolver
private LineLengthCloserTransformer $lineLengthCloserTransformer,
private TokenSkipper $tokenSkipper,
private LineLengthOpenerTransformer $lineLengthOpenerTransformer,
private WhitespacesFixerConfig $whitespacesFixerConfig,
private IndentResolver $indentResolver
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/TokenRunner/Traverser/ArrayBlockInfoFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;
use Symplify\CodingStandard\TokenRunner\ValueObject\TokenKinds;

final class ArrayBlockInfoFinder
final readonly class ArrayBlockInfoFinder
{
public function __construct(
private readonly BlockFinder $blockFinder
private BlockFinder $blockFinder
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/TokenRunner/ValueObject/BlockInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Symplify\CodingStandard\TokenRunner\ValueObject;

final class BlockInfo
final readonly class BlockInfo
{
public function __construct(
private readonly int $start,
private readonly int $end
private int $start,
private int $end
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/TokenRunner/ValueObject/LineLengthAndPosition.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Symplify\CodingStandard\TokenRunner\ValueObject;

final class LineLengthAndPosition
final readonly class LineLengthAndPosition
{
public function __construct(
private readonly int $lineLength,
private readonly int $currentPosition
private int $lineLength,
private int $currentPosition
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Symplify\CodingStandard\TokenRunner\Analyzer\FixerAnalyzer\TokenSkipper;
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class ArrayWrapper
final readonly class ArrayWrapper
{
/**
* @var int[]
Expand All @@ -21,9 +21,9 @@ final class ArrayWrapper
* @param Tokens<Token> $tokens
*/
public function __construct(
private readonly Tokens $tokens,
private readonly BlockInfo $blockInfo,
private readonly TokenSkipper $tokenSkipper
private Tokens $tokens,
private BlockInfo $blockInfo,
private TokenSkipper $tokenSkipper
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/TokenRunner/Whitespace/IndentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
use PhpCsFixer\WhitespacesFixerConfig;
use Symplify\CodingStandard\TokenRunner\Analyzer\FixerAnalyzer\IndentDetector;

final class IndentResolver
final readonly class IndentResolver
{
public function __construct(
private readonly IndentDetector $indentDetector,
private readonly WhitespacesFixerConfig $whitespacesFixerConfig
private IndentDetector $indentDetector,
private WhitespacesFixerConfig $whitespacesFixerConfig
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/TokenRunner/Wrapper/FixerWrapper/ArrayWrapperFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;
use Symplify\CodingStandard\TokenRunner\ValueObject\Wrapper\FixerWrapper\ArrayWrapper;

final class ArrayWrapperFactory
final readonly class ArrayWrapperFactory
{
public function __construct(
private readonly TokenSkipper $tokenSkipper
private TokenSkipper $tokenSkipper
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/ValueObject/BlockInfoMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use Symplify\CodingStandard\TokenRunner\ValueObject\BlockInfo;

final class BlockInfoMetadata
final readonly class BlockInfoMetadata
{
public function __construct(
private readonly string $blockType,
private readonly BlockInfo $blockInfo
private string $blockType,
private BlockInfo $blockInfo
) {
}

Expand Down

0 comments on commit c40feb1

Please sign in to comment.