TYPO3 / class-alias-loader

Composer Plugin to provide aliases to PHP classes that have been renamed
MIT License
43 stars 12 forks source link

This is not compatible with PHP 5.6 anymore #18

Closed baschny closed 4 years ago

baschny commented 4 years ago

In v1.1 some features were added which are not compatible with PHP 5.6 anymore, mainly due to usage of type hints ("string"), i.e. in IncludeFile.php:

protected function getIncludeFileContent(string $includeFilePath)

Type hinting for the main scalars was only introduced in PHP 7.0. This change was not reflected in this packages main composer requirements, which still shows "php": ">=5.3.7",.

While this might sound like ancient history and irrelevant, it breaks updating on older installations (running with PHP 5.6) which still want to keep up-to-date with composer (i.e. when using ELTS versions of all software):

Generating autoload files

  [ErrorException]                                                                                                                                        
  Argument 1 passed to TYPO3\ClassAliasLoader\IncludeFile::getIncludeFileContent() must be an instance of TYPO3\ClassAliasLoader\string, string given, c  
  alled in /app/vendor/typo3/class-alias-loader/src/IncludeFile.php on line 63 and defined                                                                

Solution for my project was to pin to the older version in composer.json:

  "require": {
    "typo3/cms": "^7.6",
    "typo3/class-alias-loader": "~1.0.2",
    ...

So this issue is a request to keep the main composer.json dependencies in mind and up-to-date when adding new code, and also as a note for people stumbling over the issue and error with a proven solution.

helhum commented 4 years ago

I will fix this! This package must maintain PHP 5.3.7 compatibility for the reasons you describe

helhum commented 4 years ago

Released as 1.1.3