-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from fsylum/feature-wp65
Add support for WordPress 6.5
- Loading branch information
Showing
8 changed files
with
111 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_5, WordPressLevelSetList::UP_TO_WP_6_4]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Fsylum\RectorWordPress\Rules\MethodCall\ParameterAdderRector; | ||
use Fsylum\RectorWordPress\ValueObject\MethodParameterAdder; | ||
use Rector\Config\RectorConfig; | ||
use Rector\Transform\Rector\MethodCall\MethodCallToFuncCallRector; | ||
use Rector\Transform\ValueObject\MethodCallToFuncCall; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->import(__DIR__ . '/../config.php'); | ||
|
||
$rectorConfig->ruleWithConfiguration(ParameterAdderRector::class, [ | ||
new MethodParameterAdder('Custom_Image_Header', 'create_attachment_object', 2, 'custom-header'), | ||
new MethodParameterAdder('WP_Site_Icon', 'create_attachment_object', 2, 'site-icon'), | ||
]); | ||
|
||
$rectorConfig->ruleWithConfiguration(MethodCallToFuncCallRector::class, [ | ||
new MethodCallToFuncCall('Custom_Image_Header', 'create_attachment_object', 'wp_copy_parent_attachment_properties'), | ||
new MethodCallToFuncCall('WP_Site_Icon', 'create_attachment_object', 'wp_copy_parent_attachment_properties'), | ||
]); | ||
|
||
/* | ||
* TODO: these are not handled currently | ||
* | ||
* FUNCTIONS | ||
* - block_core_query_ensure_interactivity_dependency | ||
* - block_core_file_ensure_interactivity_dependency | ||
* - block_core_image_ensure_interactivity_dependency | ||
* | ||
* METHODS | ||
* - Translations::parenthesize_plural_exression | ||
*/ | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Fsylum\RectorWordPress\Tests\Rector\Sets\Wp65; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class Wp65Test 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.5.php'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
$class1 = new Custom_Image_Header; | ||
$class2 = new WP_Site_Icon; | ||
|
||
$class1->create_attachment_object('foo', 1); | ||
$class2->create_attachment_object('foo', 1); | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
$class1 = new Custom_Image_Header; | ||
$class2 = new WP_Site_Icon; | ||
|
||
\wp_copy_parent_attachment_properties('foo', 1, 'custom-header'); | ||
\wp_copy_parent_attachment_properties('foo', 1, 'site-icon'); | ||
|
||
?> |