定制 iqual/drupal-migrator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.x or core: 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 || ^11 to 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:

  1. Create a new sniff class in src/Standards/DrupalMigrator/Sniffs/Migration/
  2. Add a reference to it in src/Standards/DrupalMigrator/ruleset.xml
  3. Run composer update in the main project

统计信息

  • 总下载量: 337
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固