Skip to content
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
10 changes: 10 additions & 0 deletions config/nextcloud-25/nextcloud-25-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@
use Nextcloud\Rector\Rector\OcpUtilAddScriptRector;
use Nextcloud\Rector\ValueObject\LegacyGetterToOcpServerGet;
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\StaticCall\RenameStaticMethodRector;
use Rector\Renaming\ValueObject\RenameStaticMethod;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rules([
OcServerToOcpServerRector::class,
OcpUtilAddScriptRector::class,
]);

$rectorConfig->ruleWithConfiguration(RenameStaticMethodRector::class, [
// Deprecated since 4.0.0
new RenameStaticMethod('OC_Helper', 'computerFileSize', 'OCP\Util', 'computerFileSize'),
// Deprecated since 4.0.0
new RenameStaticMethod('OC_Helper', 'humanFileSize', 'OCP\Util', 'humanFileSize'),
]);

$rectorConfig->ruleWithConfiguration(
LegacyGetterToOcpServerGetRector::class,
[
Expand Down
33 changes: 33 additions & 0 deletions tests/Set/Fixture/test_fixture_oc_helper.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Nextcloud\Rector\Test\Set\Fixture;

class SomeClass
{
public function foo()
{
$size = \OC_Helper::humanFileSize(1223);
$size2 = \OC_Helper::computerFileSize('12 KB');
$size3 = \OC_Helper::humanFileSize($size2);
$size2 = \OC_Helper::computerFileSize($size);
}
}

?>
-----
<?php

namespace Nextcloud\Rector\Test\Set\Fixture;

class SomeClass
{
public function foo()
{
$size = \OCP\Util::humanFileSize(1223);
$size2 = \OCP\Util::computerFileSize('12 KB');
$size3 = \OCP\Util::humanFileSize($size2);
$size2 = \OCP\Util::computerFileSize($size);
}
}

?>