Search code examples
phpcomposer-phpversionversioning

Required dependencies not updating


I'm updating some packages with composer. I'm using Laravel5.6 in my project.

The one that I'm trying is PHPStan to version 0.10.7. My current version is 0.9.2.

The problem

When I try to update, it shows a success message, but when checking the outdate packages output, it is still OUTDATED.

What I've tried

Using composer why-not phpstan/phpstan 0.10.7 gave me the following output:

laravel/laravel  my-branch-test  requires (for development)  phpstan/phpstan (^0.9.2)                      
phpstan/phpstan  0.10.7          requires                    nikic/php-parser (^4.0.2)                     
laravel/laravel  my-branch-test  does not require            nikic/php-parser (but v3.1.5 is installed)    
phpstan/phpstan  0.10.7          requires                    phpstan/phpdoc-parser (^0.3)                  
laravel/laravel  my-branch-test  does not require            phpstan/phpdoc-parser (but 0.2 is installed)  

Then I tried to update nikic/php-parser and phpdoc-parser and re-run composer update phpstan/phpstan but it gave me the same result of before. (not updating)

UPDATE: running composer update phpstan/phpstan --with-dependencies gave me the following output:(but still didn't updated phpstan)

composer update phpstan/phpstan --with-dependencies
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)                              
Package operations: 0 installs, 11 updates, 0 removals
  - Updating ocramius/package-versions (1.2.0 => 1.3.0): Loading from cache
  - Updating symfony/finder (v4.1.4 => v4.2.1): Loading from cache
  - Updating symfony/polyfill-mbstring (v1.9.0 => v1.10.0): Loading from cache
  - Updating jean85/pretty-package-versions (1.1 => 1.2): Loading from cache
  - Updating nette/utils (v2.4.9 => v2.5.3): Loading from cache
  - Updating nette/php-generator (v3.0.2 => v3.0.5): Loading from cache
  - Updating nette/neon (v2.4.2 => v2.4.3): Loading from cache
  - Updating nette/di (v2.4.10 => v2.4.14): Loading from cache
  - Updating nette/bootstrap (v2.4.5 => v2.4.6): Loading from cache
  - Updating nette/finder (v2.4.1 => v2.4.2): Loading from cache
  - Updating nette/robot-loader (v3.0.3 => v3.1.0): Loading from cache
Package sebastian/git is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: caffeinated/modules
Discovered Package: fideloper/proxy
Discovered Package: jenssegers/agent
Discovered Package: laravel/tinker
Discovered Package: rap2hpoutre/laravel-log-viewer
Discovered Package: rcrowe/twigbridge
Package manifest generated successfully.
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class

Code

In my composer.json file, the package is listed as:

"require-dev": {
    "phpstan/phpstan": "^0.9.2",

Any ideas?


Solution

  • The problem here was that others packages that I was using were using the nikic/php-parser package too, but considering only non-breaking changes (nikic/php-parser":"^3.0"), "blocking" the upgrade to > 4.0.

    Because of composer can't install two versions of the same package, my solution was not updating phpstan for now.

    I will wait for the libs that require nikic/php-parser to update their requirements to 4.0 and up or will change these packages in the future.