iqual / drupal-migrator
Custom PHP CodeSniffer coding standard for Drupal migration
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:phpcodesniffer-standard
pkg:composer/iqual/drupal-migrator
Requires
- php: >=8.1
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2025-10-22 19:48:31 UTC
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