Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run migration rules on PHP 8 #5717

Merged
merged 1 commit into from
Jun 4, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
execute-deployment: 'yes'

- operating-system: 'ubuntu-20.04'
php-version: '7.4'
php-version: '8.0'
job-description: 'with migration rules'
execute-migration-rules: 'yes' # should be checked on highest supported PHP version

Expand Down
3 changes: 3 additions & 0 deletions src/Cache/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function __construct($directoryName)
$this->directoryName = $directoryName;
}

/**
* {@inheritdoc}
*/
public function getRelativePathTo($file)
{
$file = $this->normalizePath($file);
Expand Down
2 changes: 2 additions & 0 deletions src/Cache/FileCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public function __destruct()
/**
* This class is not intended to be serialized,
* and cannot be deserialized (see __wakeup method).
*
* @return array
*/
public function __sleep()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Console/Output/ProcessOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public function __destruct()
/**
* This class is not intended to be serialized,
* and cannot be deserialized (see __wakeup method).
*
* @return array
*/
public function __sleep()
{
Expand Down
2 changes: 2 additions & 0 deletions src/FileRemoval.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function __destruct()
/**
* This class is not intended to be serialized,
* and cannot be deserialized (see __wakeup method).
*
* @return array
*/
public function __sleep()
{
Expand Down
8 changes: 3 additions & 5 deletions src/Fixer/PhpUnit/PhpUnitSizeClassFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private function makeDocBlockMultiLineIfNeeded(DocBlock $doc, Tokens $tokens, $d
*/
private function splitUpDocBlock($lines, Tokens $tokens, $docBlockIndex)
{
$lineContent = $this->getSingleLineDocBlockEntry($lines);
$lineContent = $this->getSingleLineDocBlockEntry($lines[0]);
$lineEnd = $this->whitespacesConfig->getLineEnding();
$originalIndent = WhitespacesAnalyzer::detectIndent($tokens, $tokens->getNextNonWhitespace($docBlockIndex));

Expand All @@ -172,13 +172,11 @@ private function splitUpDocBlock($lines, Tokens $tokens, $docBlockIndex)
}

/**
* @param Line|Line[]|string $line
*
* @return string
*/
private function getSingleLineDocBlockEntry($line)
private function getSingleLineDocBlockEntry(Line $line)
{
$line = $line[0];
$line = $line->getContent();
$line = str_replace('*/', '', $line);
$line = trim($line);
$line = str_split($line);
Expand Down
2 changes: 2 additions & 0 deletions src/Linter/ProcessLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public function __destruct()
/**
* This class is not intended to be serialized,
* and cannot be deserialized (see __wakeup method).
*
* @return array
*/
public function __sleep()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Runner/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@ public function fix()
? new FileCachingLintingIterator($fileFilteredFileIterator, $this->linter)
: new FileLintingIterator($fileFilteredFileIterator, $this->linter);

/** @var \SplFileInfo $file */
foreach ($collection as $file) {
$fixInfo = $this->fixFile($file, $collection->currentLintingResult());

// we do not need Tokens to still caching just fixed file - so clear the cache
Tokens::clearCache();

if ($fixInfo) {
$name = $this->directory->getRelativePathTo($file);
$name = $this->directory->getRelativePathTo($file->__toString());
$changed[$name] = $fixInfo;

if ($this->stopOnViolation) {
Expand Down