Skip to content

Commit

Permalink
minor #5717 Run migration rules on PHP 8 (kubawerlos, keradus)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.19 branch.

Discussion
----------

Run migration rules on PHP 8

Commits
-------

25e67e3 Run migration rules on PHP 8
  • Loading branch information
keradus committed Jun 4, 2021
2 parents 8d9a5e6 + 25e67e3 commit 3180450
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
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

0 comments on commit 3180450

Please sign in to comment.