LoginSignup
17
11

More than 3 years have passed since last update.

Laravel composer update で abandoned されたパッケージの警告問題を解消する

Last updated at Posted at 2021-04-22

環境

  • PHP 7.4.15
  • Laravel 7.30.4
  • Composer 2.0.9
  • PHPUnit 8.5.15

composer update

$ composer update

Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.

パッケージがアーカイブされてます🥺

Faker

以前の記事で軽く紹介しましたが、fzaninotto/Fakerのアーカイブされてます。
新しいリポジトリはこちらです。fakerphp/faker

$ composer remove --dev fzaninotto/faker
$ composer require --dev fakerphp/faker

執筆時点では fakerphp/faker: 1.14.1 がインストールされました。

$ php artisan db:seed

シーディング実行して壊れてないか確認します。
開発用のツールなので、動いてくれればまぁ良いでしょう。

PHPUnit

これについてはPHPUnit8からPHPUnit9でバージョンアップする必要があります。

$ composer remove --dev phpunit/phpunit
$ composer require --dev phpunit/phpunit

our requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/phpunit[9.5.0, ..., 9.5.x-dev] require sebastian/diff ^4.0.3 -> found sebastian/diff[dev-master, 4.0.3, 4.0.4, 4.0.x-dev (alias of dev-master)] but the package is fixed to 3.0.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires phpunit/phpunit ^9.5 -> satisfiable by phpunit/phpunit[9.5.0, ..., 9.5.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

おお...エラー出た><。

$ composer require --dev --with-all-dependencies phpunit/phpunit
$ ./vendor/bin/phpunit --version
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

エラーメッセージで言われてる通り、依存パッケージも含めてアップグレードを試します。
執筆時点では phpunit/phpunit 9.5.4 がインストールされました。

テストが壊れてないか確認します。

$ php artisan test

こちらも開発用のツールなので、動けば良いでしょう。

確認

$ composer update

警告メッセージが出なくなったのでokです。

17
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
11