Skip to content

Commit

Permalink
Merge branch 'phpstaticcalls' of github.com:keradus/PHP-CS-Fixer into…
Browse files Browse the repository at this point in the history
… phpstaticcalls
  • Loading branch information
keradus committed Dec 21, 2023
2 parents 3294454 + d4d212b commit c3f211e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Doctrine/Annotation/DocLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ final class DocLexer

private int $peek = 0;

private ?string $regex;
private ?string $regex = null;

public function setInput(string $input): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/Fixer/Alias/BacktickToShellExecFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ private function fixBackticks(Tokens $tokens, array $backtickTokens): void
// Track indices for final override
ksort($backtickTokens);
$openingBacktickIndex = key($backtickTokens);
end($backtickTokens);
$closingBacktickIndex = key($backtickTokens);
$closingBacktickIndex = array_key_last($backtickTokens);

// Strip enclosing backticks
array_shift($backtickTokens);
Expand Down
3 changes: 1 addition & 2 deletions src/Tokenizer/Analyzer/Analysis/TypeAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ final class TypeAnalysis implements StartEndTokenAwareAnalysis

private int $endIndex;

private bool $nullable;
private bool $nullable = false;

/**
* @param ($startIndex is null ? null : int) $endIndex
*/
public function __construct(string $name, int $startIndex = null, int $endIndex = null)
{
$this->name = $name;
$this->nullable = false;

if (str_starts_with($name, '?')) {
$this->name = substr($name, 1);
Expand Down
1 change: 1 addition & 0 deletions tests/AutoReview/ProjectCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public function testThatSrcClassesNotExposeProperties(string $className): void
$exceptionPropsPerClass = [
\PhpCsFixer\AbstractPhpdocTypesFixer::class => ['tags'],
\PhpCsFixer\AbstractFixer::class => ['configuration', 'configurationDefinition', 'whitespacesConfig'],
\PhpCsFixer\Console\Command\FixCommand::class => ['defaultDescription', 'defaultName'],
AbstractProxyFixer::class => ['proxyFixers'],
];

Expand Down
2 changes: 1 addition & 1 deletion tests/Runner/RunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function testThatDiffedFileIsPassedToDiffer(): void
private function createDifferDouble(): DifferInterface
{
return new class() implements DifferInterface {
public ?\SplFileInfo $passedFile;
public ?\SplFileInfo $passedFile = null;

public function diff(string $old, string $new, \SplFileInfo $file = null): string
{
Expand Down
3 changes: 1 addition & 2 deletions tests/Test/AbstractFixerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ final public function testFixerDefinitions(): void

if ($fixerIsConfigurable) {
if (isset($configSamplesProvided['default'])) {
reset($configSamplesProvided);
self::assertSame('default', key($configSamplesProvided), sprintf('[%s] First sample must be for the default configuration.', $fixerName));
self::assertSame('default', array_key_first($configSamplesProvided), sprintf('[%s] First sample must be for the default configuration.', $fixerName));
} elseif (!isset($this->allowedFixersWithoutDefaultCodeSample[$fixerName])) {
self::assertArrayHasKey($fixerName, $this->allowedRequiredOptions, sprintf('[%s] Has no sample for default configuration.', $fixerName));
}
Expand Down

0 comments on commit c3f211e

Please sign in to comment.