Problem/Motivation
We indicate compatibility back to Drupal 8.8.
Drupal 8.8 would have supported as low as PHP7.0.8.
We do not indicate our PHP compatibility level anywhere in our code. From time to time I have mistakenly thought Drupal 8.8 supported only PHP 7.1 and newer (I'm actually a bit surprised I haven't inserted more errors over the years).
Implicitly nullable parameters are deprecated in PHP8.4, and requires PHP 7.1 to resolve. However we do not need to adopt this before PHP 9. Undoing this will mean we need to deal with the current testing throwing warnings regarding deprecated function declarations. Keeping this means we need to define our PHP level as higher than the bare minimal of Drupal 8.8.
Steps to reproduce
Run phplint against the code
phplint > Syntax error found in 4 files
phplint >
phplint > ------------------------------------------------------------
phplint > Parse error: ./tests/src/Functional/S3fsImageStyleControllerLockdownTest.php:85
phplint > 83| 'scheme' => 's3',
phplint > 84| ],
phplint > > 85| );
phplint > 86| $derivative = $this->drupalGet($private_route->setAbsolute()->toString() . '/' . $this->remoteTestsFolder . '/test.png');
phplint > 87| $this->assertNotFalse(imagecreatefromstring($derivative), 's3fs.image_styles processes s3://');
phplint > Unexpected ')'
phplint > ------------------------------------------------------------
phplint > Parse error: ./src/Form/SettingsForm.php:53
phplint > 51| * The typed config manager.
phplint > 52| */
phplint > > 53| public function __construct(ConfigFactoryInterface $configFactory, S3fsServiceInterface $s3fs, ModuleHandlerInterface $module_Handler, ?TypedConfigManagerInterface $typed_config_manager = NULL) {
phplint > 54| if ($typed_config_manager == NULL) {
phplint > 55| // @phpstan-ignore-next-line
phplint > Unexpected '?', expecting variable (T_VARIABLE)
phplint > ------------------------------------------------------------
phplint > Parse error: ./src/S3fsFileSystemD103.php:65
phplint > 63| */
phplint > 64| public function __construct(
phplint > > 65| protected FileSystemInterface $decorated,
phplint > 66| protected StreamWrapperManagerInterface $streamWrapperManager,
phplint > 67| protected LoggerInterface $logger,
phplint > Unexpected 'protected' (T_PROTECTED), expecting variable (T_VARIABLE)
phplint > ------------------------------------------------------------
phplint > Parse error: ./src/S3fsFileService.php:122
phplint > 120| * S3fs logging channel.
phplint > 121| */
phplint > > 122| public function __construct(FileSystemInterface $decorated, StreamWrapperManagerInterface $stream_wrapper_manager, LoggerInterface $logger, S3fsServiceInterface $s3fs, ConfigFactoryInterface $configFactory, ModuleHandlerInterface $moduleHandler, $mimeGuesser, ?LoggerInterface $s3fsLogger = NULL) {
phplint > 123| $this->decorated = $decorated;
phplint > 124| $this->streamWrapperManager = $stream_wrapper_manager;
phplint > Unexpected '?', expecting variable (T_VARIABLE)
phplint > Exiting with 1
./src/S3fsFileService.php:122 was broken in December of 2023
./src/Form/SettingsForm.php was broken in Aug of 2024
/src/S3fsFileSystemD103.php is only for Drupal 10.3 and can be ignored.
Tests can easily be re-worked.
Proposed resolution
Restore code to work with PHP 7.0
or
Explicitly call out PHP 7.1 as minimal supported PHP
In both cases we should add testing to avoid this occurring again in the future.
Remaining tasks
User interface changes
API changes
Data model changes