Skip to content

Commit 33080d6

Browse files
authored
Merge pull request #9 from fsylum/feature-wp-6.6
Feature: Add support for WordPress 6.6
2 parents 5498a27 + 8817265 commit 33080d6

File tree

8 files changed

+84
-3
lines changed

8 files changed

+84
-3
lines changed

config/sets/level/up-to-wp-6.6.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
use Fsylum\RectorWordPress\Set\WordPressLevelSetList;
4+
use Fsylum\RectorWordPress\Set\WordPressSetList;
5+
use Rector\Config\RectorConfig;
6+
7+
return static function (RectorConfig $rectorConfig): void {
8+
$rectorConfig->sets([WordPressSetList::WP_6_6, WordPressLevelSetList::UP_TO_WP_6_5]);
9+
};

config/sets/wp-6.6.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use Fsylum\RectorWordPress\Rules\FuncCall\ReturnFirstArgumentRector;
4+
use Rector\Config\RectorConfig;
5+
6+
return static function (RectorConfig $rectorConfig): void {
7+
$rectorConfig->import(__DIR__ . '/../config.php');
8+
9+
$rectorConfig->ruleWithConfiguration(ReturnFirstArgumentRector::class, [
10+
'wp_interactivity_process_directives_of_interactive_blocks',
11+
'wp_render_elements_support',
12+
]);
13+
14+
/*
15+
* TODO: these are not handled currently
16+
*
17+
* METHODS
18+
* - WP_Theme_JSON::set_spacing_sizes
19+
*/
20+
};

src/Set/WordPressLevelSetList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ final class WordPressLevelSetList implements SetListInterface
5555
public const UP_TO_WP_6_3 = __DIR__ . '/../../config/sets/level/up-to-wp-6.3.php';
5656
public const UP_TO_WP_6_4 = __DIR__ . '/../../config/sets/level/up-to-wp-6.4.php';
5757
public const UP_TO_WP_6_5 = __DIR__ . '/../../config/sets/level/up-to-wp-6.5.php';
58+
public const UP_TO_WP_6_6 = __DIR__ . '/../../config/sets/level/up-to-wp-6.6.php';
5859
}

src/Set/WordPressSetList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ final class WordPressSetList implements SetListInterface
5555
public const WP_6_3 = __DIR__ . '/../../config/sets/wp-6.3.php';
5656
public const WP_6_4 = __DIR__ . '/../../config/sets/wp-6.4.php';
5757
public const WP_6_5 = __DIR__ . '/../../config/sets/wp-6.5.php';
58+
public const WP_6_6 = __DIR__ . '/../../config/sets/wp-6.6.php';
5859
}

tests/Rector/Sets/Level/UpToWp65/UpToWp65Test.php renamed to tests/Rector/Sets/Level/UpToWp66/UpToWp66Test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Fsylum\RectorWordPress\Tests\Rector\Sets\Level\UpToWp65;
3+
namespace Fsylum\RectorWordPress\Tests\Rector\Sets\Level\UpToWp66;
44

55
use Iterator;
66
use PHPUnit\Framework\Attributes\DataProvider;
@@ -9,7 +9,7 @@
99
/**
1010
* @internal
1111
*/
12-
final class UpToWp65Test extends AbstractRectorTestCase
12+
final class UpToWp66Test extends AbstractRectorTestCase
1313
{
1414
#[DataProvider('provideData')]
1515
public function test(string $filePath): void
@@ -24,6 +24,6 @@ public static function provideData(): Iterator
2424

2525
public function provideConfigFilePath(): string
2626
{
27-
return __DIR__ . '/../../../../../config/sets/level/up-to-wp-6.5.php';
27+
return __DIR__ . '/../../../../../config/sets/level/up-to-wp-6.6.php';
2828
}
2929
}

tests/Rector/Sets/Level/UpToWp65/test_fixture.php.inc renamed to tests/Rector/Sets/Level/UpToWp66/test_fixture.php.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ $class2 = new WP_Site_Icon;
368368
$class1->create_attachment_object('foo', 1);
369369
$class2->create_attachment_object('foo', 1);
370370

371+
// 6.6
372+
$foo = wp_interactivity_process_directives_of_interactive_blocks($bar);
373+
$foo = wp_render_elements_support($bar);
374+
371375
?>
372376
-----
373377
<?php
@@ -690,4 +694,8 @@ $class2 = new WP_Site_Icon;
690694
\wp_copy_parent_attachment_properties('foo', 1, 'custom-header');
691695
\wp_copy_parent_attachment_properties('foo', 1, 'site-icon');
692696

697+
// 6.6
698+
$foo = $bar;
699+
$foo = $bar;
700+
693701
?>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Fsylum\RectorWordPress\Tests\Rector\Sets\Wp66;
4+
5+
use Iterator;
6+
use PHPUnit\Framework\Attributes\DataProvider;
7+
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
8+
9+
/**
10+
* @internal
11+
*/
12+
final class Wp66Test extends AbstractRectorTestCase
13+
{
14+
#[DataProvider('provideData')]
15+
public function test(string $filePath): void
16+
{
17+
$this->doTestFile($filePath);
18+
}
19+
20+
public static function provideData(): Iterator
21+
{
22+
return self::yieldFilesFromDirectory(__DIR__);
23+
}
24+
25+
public function provideConfigFilePath(): string
26+
{
27+
return __DIR__ . '/../../../../config/sets/wp-6.6.php';
28+
}
29+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$foo = wp_interactivity_process_directives_of_interactive_blocks($bar);
4+
$foo = wp_render_elements_support($bar);
5+
6+
?>
7+
-----
8+
<?php
9+
10+
$foo = $bar;
11+
$foo = $bar;
12+
13+
?>

0 commit comments

Comments
 (0)