iqual/drupal-migrator
Composer 安装命令:
composer require iqual/drupal-migrator
包简介
Custom PHP CodeSniffer coding standard for Drupal migration
README 文档
README
A custom PHP CodeSniffer coding standard for Drupal 11 migration tasks.
Features
This coding standard includes these custom sniffs:
RemoveAssertionsSniff
Removes deprecated assertion code from local.settings.php files:
- Removes
assert_options(ASSERT_ACTIVE, TRUE); - Removes
\Drupal\Component\Assertion\Handle::register(); - Removes the associated "Assertions." comment block
RemoveDeprecatedCoreSniff
Removes the deprecated core: property from custom *.info.yml files:
- Removes lines like
core: 8.xorcore: 9.x - The
core:property was deprecated in Drupal 8.7.7 - Should be replaced with
core_version_requirement: - Examples:
core: 8.x→ (removed)core: 9.x→ (removed)
- Only applies to files in
/custom/directories
UpdateCoreVersionSniff
Updates core_version_requirement in custom *.info.yml files:
- Adds
|| ^11to any requirement that includes Drupal 10 (with or without minor version) - Examples:
^10→^10 || ^11^10.3→^10.3 || ^11^9 || ^10→^9 || ^10 || ^11^9.5 || ^10→^9.5 || ^10 || ^11
- Only applies to files in
/custom/directories
Usage
Check for issues:
phpcs --standard=DrupalMigrator --extensions=php,yml <path>
Automatically fix issues:
phpcbf --standard=DrupalMigrator --extensions=php,yml <path>
Development
The package structure follows PHP_CodeSniffer standards:
app/packages/drupal-migrator/
├── composer.json
└── src/
└── Standards/
└── DrupalMigrator/
├── ruleset.xml
└── Sniffs/
└── Migration/
├── RemoveAssertionsSniff.php
├── RemoveDeprecatedCoreSniff.php
└── UpdateCoreVersionSniff.php
To add new sniffs:
- Create a new sniff class in
src/Standards/DrupalMigrator/Sniffs/Migration/ - Add a reference to it in
src/Standards/DrupalMigrator/ruleset.xml - Run
composer updatein the main project
统计信息
- 总下载量: 337
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-22