Open kylehuynh205 opened 1 year ago
The contrib modules were tested against PHP 8.1 using Phan. A complete set of log messages can be found in analysis.txt
. The other text files are named after their respective modules and contain errors specific to that module. The files in phan_logs/deprecated
contain deprecation-related errors only. (Some 8.2 deprecation warnings are included as well).
Edit: The zip file also contains logs for assign_calc and Views URL Path Arguments
To generate these logs:
return [
// Supported values: '5.6'
, '7.0'
, '7.1'
, '7.2'
, '7.3'
,
// '7.4'
, '8.0'
, '8.1'
, null
.
'target_php_version' => 8.1,
// directories to parse and analyze
'directory_list' => [
'web/modules/contrib',
'web/core/lib/Drupal',
'vendor'
],
'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
'exclude_analysis_directory_list' => [
'web/core/lib/Drupal',
'vendor/'
],
'analyzed_file_extensions' => [
'php',
]
];
3. Create `isle-dc/codebase/generate_phan.sh`
```bash
#!/bin/bash
src=web/modules/contrib # directory to analyze
dest=phan_logs # output directory
depdest=$dest/deprecated
mkdir -p $dest
mkdir -p $depdest
# get phan output
output=$dest/analysis.txt
# ./vendor/bin/phan -o $output
# generate separate files for each module
for module in $src/*; do
msgs=$dest/$(basename "$module").txt
deponly=$depdest/$(basename "$module").txt
grep "$module" $output > $msgs
# get lines containing deprecation messages
grep 'PhanDeprecated' $msgs > $deponly
# remove file if empty (no logs)
if [[ -z $(grep '[^[:space:]]' $msgs) ]]; then
rm $msgs
fi
if [[ -z $(grep '[^[:space:]]' $deponly) ]]; then
rm $deponly
fi
echo $module
done
isle-dc/codebase
./generate_phan.sh
** If permission denied, check if you have execute permissions by running ls -l generate_phan.sh
. If not, run chmod +x generate_phan.sh
.
I did a quick search through the logs for deprecation warnings and there don't seem to be any specific to PHP 8.1, though there were some module specific deprecation warnings (i.e. facets, group, migrate_plus). The contrib modules were analyzed using rule level 9 and PHPStan Deprecation Rules.
The contrib modules were tested using the PHPCompatibility (dev) coding standard with PHP 8.1. There weren't any PHP 8.1 deprecation warnings, but there were a few messages about the soft reserved keyword resource
which was added in PHP 7.0 being used as part of a namespace.
These logs contain only Drupal 10 deprecation errors without any additional code analysis or code checking. This differs from the drupal-check logs which include code analysis, coding style and PHPDoc errors.
References: mglaman/drupal-check: Rollback update to PHPStan level 2 for deprecation analysis was used to set up PHPStan for drupal deprecation checking.
drupal_check_logs.zip (includes logs for assign_calc and views_url_path_arguments)
The zip file above contains the output of running drupal-check. Each text file is named after its respective module.
To generate these logs:
Install drupal-check
Create isle-dc/codebase/generate.sh
#!/bin/bash
dir="web/modules/contrib" target="drupal_check_logs" # output directory
mkdir -p $target
for module in $dir/*; do out=$target/$(basename "$module").txt ./vendor/bin/drupal-check -d $module > $out done
3. Run script inside codebase
```bash
isle-dc/codebase$ ./generate.sh
Task list for review
Checking PHP 8.1 Errors: (task complete)
https://docs.google.com/spreadsheets/d/1BpmG4V_6tfpmPsmeYon62ty9q-_9fEKQYffL4wSjYKs/edit?usp=sharing
Checking Drupal 10 Errors:
Download and run build for islandora lite isle-dc with islandora_lite_2023: https://github.com/digitalutsc/isle-dc/tree/islandora_lite_2023
Tools:
Other sources:
https://www.drupal.org/docs/upgrading-drupal/prepare-major-upgrade/deprecation-checking-and-correction-tools-to-prepare-for-a-new-drupal-major-version