Skip to content

Commit

Permalink
[BUGFIX] Fix missing arguments for random methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed Nov 20, 2020
1 parent f0021ee commit 3d2e3c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Rector/v8/v0/RandomMethodsToRandomClassRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public function refactor(Node $node): ?Node
);

if ($this->isName($node->name, self::GENERATE_RANDOM_BYTES)) {
return $this->createMethodCall($randomClass, self::GENERATE_RANDOM_BYTES);
return $this->createMethodCall($randomClass, self::GENERATE_RANDOM_BYTES, $node->args);
}

return $this->createMethodCall($randomClass, 'generateRandomHexString');
return $this->createMethodCall($randomClass, 'generateRandomHexString', $node->args);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions stubs/Core/Utility/GeneralUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ public static function getFileAbsFileName($filename): void

}

public static function generateRandomBytes(): string
public static function generateRandomBytes($bytesToReturn): string
{
return 'bytes';
}

public static function getRandomHexString(): string
public static function getRandomHexString($count): string
{
return 'hex';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

use TYPO3\CMS\Core\Utility\GeneralUtility;

$randomBytes = GeneralUtility::generateRandomBytes();
$randomHex = GeneralUtility::getRandomHexString();
$randomBytes = GeneralUtility::generateRandomBytes(8);
$count = 7;
$randomHex = GeneralUtility::getRandomHexString($count);

?>
-----
<?php

use TYPO3\CMS\Core\Crypto\Random;
use TYPO3\CMS\Core\Utility\GeneralUtility;
$randomBytes = GeneralUtility::makeInstance(Random::class)->generateRandomBytes();
$randomHex = GeneralUtility::makeInstance(Random::class)->generateRandomHexString();
$randomBytes = GeneralUtility::makeInstance(Random::class)->generateRandomBytes(8);
$count = 7;
$randomHex = GeneralUtility::makeInstance(Random::class)->generateRandomHexString($count);

0 comments on commit 3d2e3c3

Please sign in to comment.