Skip to content

Commit

Permalink
IBX-8538: Added rule for fieldtype configuration const change (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou authored Sep 6, 2024
1 parent eef2813 commit 8acd06a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/contracts/Sets/ibexa-50.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
use Rector\Renaming\ValueObject\RenameClassConstFetch;
use Rector\Renaming\ValueObject\RenameProperty;

Expand Down Expand Up @@ -79,4 +80,22 @@
'more_than' => 2,
]
);

$rectorConfig->ruleWithConfiguration(
RenameClassConstFetchRector::class,
[
new RenameClassAndConstFetch(
'Ibexa\Bundle\FieldTypePage\DependencyInjection\Compiler\BlockDefinitionConfigurationCompilerPass',
'EXTENSION_CONFIG_KEY',
'Ibexa\Bundle\FieldTypePage\DependencyInjection\IbexaFieldTypePageExtension',
'EXTENSION_NAME'
),
new RenameClassAndConstFetch(
'Ibexa\Bundle\FieldTypePage\DependencyInjection\Compiler\AbstractConfigurationAwareCompilerPass',
'EXTENSION_CONFIG_KEY',
'Ibexa\Bundle\FieldTypePage\DependencyInjection\IbexaFieldTypePageExtension',
'EXTENSION_NAME'
),
]
);
};
37 changes: 37 additions & 0 deletions tests/lib/Sets/Ibexa50/Fixture/fieldtype_page_const.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Ibexa\Rector\Tests\Sets\Ibexa50\Fixture;

use Ibexa\Bundle\FieldTypePage\DependencyInjection\Compiler\BlockDefinitionConfigurationCompilerPass;

class Foo {
public function foo(): array
{
return [
BlockDefinitionConfigurationCompilerPass::EXTENSION_CONFIG_KEY,
\Ibexa\Bundle\FieldTypePage\DependencyInjection\Compiler\AbstractConfigurationAwareCompilerPass::EXTENSION_CONFIG_KEY
];
}

}

?>
-----
<?php

namespace Ibexa\Rector\Tests\Sets\Ibexa50\Fixture;

use Ibexa\Bundle\FieldTypePage\DependencyInjection\Compiler\BlockDefinitionConfigurationCompilerPass;

class Foo {
public function foo(): array
{
return [
\Ibexa\Bundle\FieldTypePage\DependencyInjection\IbexaFieldTypePageExtension::EXTENSION_NAME,
\Ibexa\Bundle\FieldTypePage\DependencyInjection\IbexaFieldTypePageExtension::EXTENSION_NAME
];
}

}

?>

0 comments on commit 8acd06a

Please sign in to comment.