composer installにてエラー
laravelプロジェクトで久しぶりにcomposer installをしたらエラーが出た
% composer install
PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
〜 省略 〜
Problem 40
- sebastian/resource-operations is locked to version 2.0.1 and an update of this package was not requested.
- sebastian/resource-operations 2.0.1 requires php ^7.1 -> your php version (8.1.9) does not satisfy that requirement.
Problem 41
- theseer/tokenizer is locked to version 1.1.3 and an update of this package was not requested.
- theseer/tokenizer 1.1.3 requires php ^7.0 -> your php version (8.1.9) does not satisfy that requirement.
Problem 42
- webmozart/assert is locked to version 1.9.0 and an update of this package was not requested.
- webmozart/assert 1.9.0 requires php ^5.3.3 || ^7.0 -> your php version (8.1.9) does not satisfy that requirement.
Problem 43
- laravel/framework v5.8.38 requires php ^7.1.3 -> your php version (8.1.9) does not satisfy that requirement.
- laravel/tinker v1.0.10 requires illuminate/console ~5.1|^6.0 -> satisfiable by laravel/framework[v5.8.38].
- laravel/tinker is locked to version v1.0.10 and an update of this package was not requested.
composer versionは2.1.3
composer versionは2.1.3
version確認の時も以下エラーが表示された。
% composer --version
PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Composer version 2.1.3 2021-06-09 16:31:20
解決
バージョンアップコマンドにて解決
% composer self-update
You are already using the latest available Composer version 2.4.2 (stable channel).
2.1.3 -> 2.4.2にアップされた。
ちなみにバージョンを指定したい場合は以下のようにバージョンを指定してあげればいいらしい。
composer self-update 2.4.1