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
9 changes: 9 additions & 0 deletions config/sets/level/up-to-wp-6.6.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

use Fsylum\RectorWordPress\Set\WordPressLevelSetList;
use Fsylum\RectorWordPress\Set\WordPressSetList;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([WordPressSetList::WP_6_6, WordPressLevelSetList::UP_TO_WP_6_5]);
};
20 changes: 20 additions & 0 deletions config/sets/wp-6.6.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Fsylum\RectorWordPress\Rules\FuncCall\ReturnFirstArgumentRector;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');

$rectorConfig->ruleWithConfiguration(ReturnFirstArgumentRector::class, [
'wp_interactivity_process_directives_of_interactive_blocks',
'wp_render_elements_support',
]);

/*
* TODO: these are not handled currently
*
* METHODS
* - WP_Theme_JSON::set_spacing_sizes
*/
};
1 change: 1 addition & 0 deletions src/Set/WordPressLevelSetList.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ final class WordPressLevelSetList implements SetListInterface
public const UP_TO_WP_6_3 = __DIR__ . '/../../config/sets/level/up-to-wp-6.3.php';
public const UP_TO_WP_6_4 = __DIR__ . '/../../config/sets/level/up-to-wp-6.4.php';
public const UP_TO_WP_6_5 = __DIR__ . '/../../config/sets/level/up-to-wp-6.5.php';
public const UP_TO_WP_6_6 = __DIR__ . '/../../config/sets/level/up-to-wp-6.6.php';
}
1 change: 1 addition & 0 deletions src/Set/WordPressSetList.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ final class WordPressSetList implements SetListInterface
public const WP_6_3 = __DIR__ . '/../../config/sets/wp-6.3.php';
public const WP_6_4 = __DIR__ . '/../../config/sets/wp-6.4.php';
public const WP_6_5 = __DIR__ . '/../../config/sets/wp-6.5.php';
public const WP_6_6 = __DIR__ . '/../../config/sets/wp-6.6.php';
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Fsylum\RectorWordPress\Tests\Rector\Sets\Level\UpToWp65;
namespace Fsylum\RectorWordPress\Tests\Rector\Sets\Level\UpToWp66;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
Expand All @@ -9,7 +9,7 @@
/**
* @internal
*/
final class UpToWp65Test extends AbstractRectorTestCase
final class UpToWp66Test extends AbstractRectorTestCase
{
#[DataProvider('provideData')]
public function test(string $filePath): void
Expand All @@ -24,6 +24,6 @@ public static function provideData(): Iterator

public function provideConfigFilePath(): string
{
return __DIR__ . '/../../../../../config/sets/level/up-to-wp-6.5.php';
return __DIR__ . '/../../../../../config/sets/level/up-to-wp-6.6.php';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ $class2 = new WP_Site_Icon;
$class1->create_attachment_object('foo', 1);
$class2->create_attachment_object('foo', 1);

// 6.6
$foo = wp_interactivity_process_directives_of_interactive_blocks($bar);
$foo = wp_render_elements_support($bar);

?>
-----
<?php
Expand Down Expand Up @@ -690,4 +694,8 @@ $class2 = new WP_Site_Icon;
\wp_copy_parent_attachment_properties('foo', 1, 'custom-header');
\wp_copy_parent_attachment_properties('foo', 1, 'site-icon');

// 6.6
$foo = $bar;
$foo = $bar;

?>
29 changes: 29 additions & 0 deletions tests/Rector/Sets/Wp66/Wp66Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Fsylum\RectorWordPress\Tests\Rector\Sets\Wp66;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

/**
* @internal
*/
final class Wp66Test extends AbstractRectorTestCase
{
#[DataProvider('provideData')]
public function test(string $filePath): void
{
$this->doTestFile($filePath);
}

public static function provideData(): Iterator
{
return self::yieldFilesFromDirectory(__DIR__);
}

public function provideConfigFilePath(): string
{
return __DIR__ . '/../../../../config/sets/wp-6.6.php';
}
}
13 changes: 13 additions & 0 deletions tests/Rector/Sets/Wp66/test_fixture.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$foo = wp_interactivity_process_directives_of_interactive_blocks($bar);
$foo = wp_render_elements_support($bar);

?>
-----
<?php

$foo = $bar;
$foo = $bar;

?>