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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ script:
- vendor/bin/phpunit # Run tests
- vendor/bin/phpcs # Stylecheck against MO4
- vendor/bin/phpstan analyse --no-progress # Run PHPStan
- vendor/bin/psalm --show-info=false # run psalm
- vendor/bin/psalm --show-info=true # run psalm
- if [ "${DEPENDENCIES}" = "highest" ]; then vendor/bin/phan; fi; # Run phan
# Generate Code coverage report
- |
Expand Down
2 changes: 1 addition & 1 deletion MO4/Sniffs/Formatting/AlphabeticalUseStatementsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
*
* @var string
*/
private $currentFile;
private $currentFile = '';

/**
* Processes this test, when one of its tokens is encountered.
Expand Down
19 changes: 5 additions & 14 deletions MO4/Sniffs/Strings/VariableInDoubleQuotedStringSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@
*/
class VariableInDoubleQuotedStringSniff implements Sniff
{
/**
* The PHP_CodeSniffer object controlling this run.
*
* @var File
*/
private $phpCsFile;

/**
* Registers the tokens that this sniff wants to listen for.
*
Expand Down Expand Up @@ -67,8 +60,6 @@ public function register(): array
*/
public function process(File $phpcsFile, $stackPtr): void
{
$this->phpCsFile = $phpcsFile;

$varRegExp = '/\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/';

$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -104,7 +95,7 @@ public function process(File $phpcsFile, $stackPtr): void
}
}

$fix = $this->phpCsFile->addFixableError(
$fix = $phpcsFile->addFixableError(
\sprintf(
'must surround variable %s with { }',
$var
Expand All @@ -122,7 +113,8 @@ public function process(File $phpcsFile, $stackPtr): void
$pos,
$var
);
$this->fixPhpCsFile($stackPtr, $correctVariable);

$this->fixPhpCsFile($stackPtr, $correctVariable, $phpcsFile);
}
}
}
Expand All @@ -149,13 +141,12 @@ private function surroundVariableWithBraces(string $content, int $pos, string $v
*
* @param int $stackPtr stack pointer
* @param string $correctVariable correct variable
* @param File $phpCsFile PHP_CodeSniffer File object
*
* @return void
*/
private function fixPhpCsFile(int $stackPtr, string $correctVariable): void
private function fixPhpCsFile(int $stackPtr, string $correctVariable, File $phpCsFile): void
{
$phpCsFile = $this->phpCsFile;

$phpCsFile->fixer->beginChangeset();
$phpCsFile->fixer->replaceToken($stackPtr, $correctVariable);
$phpCsFile->fixer->endChangeset();
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"phpstan/phpstan": "^0.12.58",
"phpstan/phpstan-strict-rules": "^0.12.4",
"phpunit/phpunit": "^7.0",
"vimeo/psalm": "^4.4"
"psalm/plugin-phpunit": "^0.16.1",
"vimeo/psalm": "^4.5.2"
},
"require": {
"php": "~7.2 || ~8.0",
Expand Down
9 changes: 3 additions & 6 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
</ignoreFiles>
</projectFiles>

<issueHandlers>
<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />

<UndefinedClass errorLevel="info" /> <!-- somehow this is showing up in travis -->
</issueHandlers>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin" />
</plugins>
</psalm>