Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"type": "project",
"require": {
"php": "^8.4",
"ergebnis/composer-normalize": "^2.47",
"infection/infection": "^0.31.0",
"ergebnis/composer-normalize": "^2.48.2",
"infection/infection": "^0.31.2",
"kubawerlos/composer-smaller-lock": "^1.1.0",
"kubawerlos/php-cs-fixer-config": "^5.3",
"mi-schi/phpmd-extension": "^4.3",
"phpmd/phpmd": "^2.15",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.1.20",
"phpstan/phpstan": "^2.1.23",
"phpstan/phpstan-phpunit": "^2.0.7",
"phpstan/phpstan-strict-rules": "^2.0.6",
"shipmonk/composer-dependency-analyser": "^1.8.3",
"shipmonk/dead-code-detector": "^0.13.0",
"shipmonk/phpstan-rules": "^4.1.5",
"squizlabs/php_codesniffer": "^3.13.2",
"shipmonk/dead-code-detector": "^0.13.3",
"shipmonk/phpstan-rules": "^4.2.1",
"squizlabs/php_codesniffer": "^3.13.4",
"tomasvotruba/type-coverage": "^2.0.2",
"vimeo/psalm": "^6.13.0"
"vimeo/psalm": "^6.13.1"
},
"autoload": {
"psr-4": {
Expand All @@ -32,7 +32,8 @@
"infection/extension-installer": false,
"kubawerlos/composer-smaller-lock": true,
"phpstan/extension-installer": true
}
},
"bump-after-update": true
},
"scripts": {
"analyse": [
Expand Down
349 changes: 182 additions & 167 deletions .dev-tools/composer.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Analyzer/Analysis/ConstructorAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ private function getPropertyIndex(int $index, int $openBrace): ?int
}

$propertyIndex = $this->tokens->getPrevMeaningfulToken($assignmentIndex);
\assert(\is_int($propertyIndex));

if (!$this->tokens[$propertyIndex]->isGivenKind(\T_STRING)) {
return null;
}
\assert(\is_int($propertyIndex));

$objectOperatorIndex = $this->tokens->getPrevMeaningfulToken($propertyIndex);
\assert(\is_int($objectOperatorIndex));
Expand Down
2 changes: 2 additions & 0 deletions src/Fixer/EmptyFunctionBodyFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void
$tokens->ensureWhitespaceAtIndex($openBraceIndex + 1, 0, '');

$beforeOpenBraceIndex = $tokens->getPrevNonWhitespace($openBraceIndex);
\assert(\is_int($beforeOpenBraceIndex));

if (!$tokens[$beforeOpenBraceIndex]->isGivenKind([\T_COMMENT, \T_DOC_COMMENT])) {
$tokens->ensureWhitespaceAtIndex($openBraceIndex - 1, 1, ' ');
}
Expand Down
3 changes: 3 additions & 0 deletions src/Fixer/PhpdocVarAnnotationToAssertFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ private static function getTypesToExclude(string $content): array
private static function getVariableIndex(Tokens $tokens, int $docCommentIndex): ?int
{
$prevIndex = $tokens->getPrevMeaningfulToken($docCommentIndex);
\assert(\is_int($prevIndex));

if (!$tokens[$prevIndex]->equalsAny([';', '{', '}', [\T_OPEN_TAG]])) {
return null;
}
Expand Down Expand Up @@ -252,6 +254,7 @@ private static function canBePlacedAfterExpression(Tokens $tokens, int $expressi

if ($tokens[$afterExpressionIndex]->isGivenKind(\T_NS_SEPARATOR)) {
$afterExpressionIndex = $tokens->getNextMeaningfulToken($afterExpressionIndex);
\assert(\is_int($afterExpressionIndex));
}

return !$tokens[$afterExpressionIndex]->equals([\T_STRING, 'assert'], false);
Expand Down
2 changes: 2 additions & 0 deletions src/Fixer/PromotedConstructorPropertyFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ private function promoteProperties(Tokens $tokens, int $classIndex, ConstructorA
}

$assignedPropertyIndex = $tokens->getPrevTokenOfKind($constructorPromotableAssignments[$constructorParameterName], [[\T_STRING]]);
\assert(\is_int($assignedPropertyIndex));

$oldParameterName = $tokens[$constructorParameterIndex]->getContent();
$newParameterName = '$' . $tokens[$assignedPropertyIndex]->getContent();
if ($oldParameterName !== $newParameterName && \in_array($newParameterName, $constructorParameterNames, true)) {
Expand Down
1 change: 1 addition & 0 deletions src/Fixer/StringableInterfaceFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ private static function doesHaveToStringMethod(Tokens $tokens, int $classStartIn
}

$functionNameIndex = $tokens->getNextMeaningfulToken($index);
\assert(\is_int($functionNameIndex));

if ($tokens[$functionNameIndex]->equals([\T_STRING, '__toString'], false)) {
return true;
Expand Down
4 changes: 4 additions & 0 deletions src/Fixer/TrimKeyFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void
$newInnerContent = Preg::replace('/\\s{2,}/', ' ', $innerContent);

$prevIndex = $tokens->getPrevMeaningfulToken($indexToFix);
\assert(\is_int($prevIndex));

if (!$tokens[$prevIndex]->equals('.')) {
$newInnerContent = \ltrim($newInnerContent);
}

$nextIndex = $tokens->getNextMeaningfulToken($indexToFix);
\assert(\is_int($nextIndex));

if (!$tokens[$nextIndex]->equals('.')) {
$newInnerContent = \rtrim($newInnerContent);
}
Expand Down
Loading