psalm / psalm-plugin-laravel

A Psalm plugin for Laravel
MIT License
293 stars 68 forks source link

Not Installing working with composer in Laravel 11 #384

Open ricardosierra opened 1 month ago

ricardosierra commented 1 month ago

Describe the bug A clear and concise description of what the bug is.

The command: "composer require --dev psalm/plugin-laravel -W" not working

My composer.json:

"require": {
    "php": "^8.2|^8.3",
    "ext-gd": "*",
    "ext-json": "*",
    "ext-mbstring": "*",
    "laravel/framework": "^11.0",
    "laravel/sanctum": "^4.0",
    "laravel/tinker": "^2.9",
    "mll-lab/laravel-graphiql": "^3.2",
    "rebing/graphql-laravel": "^9.5"
  },
  "require-dev": {
    "fakerphp/faker": "^1.23",
    "laravel/pint": "^1.13",
    "laravel/sail": "^1.26",
    "mockery/mockery": "^1.6",
    "nunomaduro/collision": "^8.0",
    "phpstan/phpstan": "^1.10",
    "phpunit/phpunit": "^11.0.1",
    "spatie/laravel-ignition": "^2.4"
  },

Additional context Composer response:

Problem 1                                                                                                                                                                                                                                   
    - Conclusion: don't install phpunit/phpunit 11.1.3 (conflict analysis result)                                                                                                                                                             
    - psalm/plugin-laravel[0.0.5, ..., 0.4] require orchestra/testbench ^3.5 -> satisfiable by orchestra/testbench[v3.5.0, ..., v3.9.4].                                                                                                      
    - psalm/plugin-laravel[0.0.1, ..., 0.0.4] require orchestra/testbench ^3.7 -> satisfiable by orchestra/testbench[v3.7.0, ..., v3.9.4].                                                                                                    
    - psalm/plugin-laravel[0.5, ..., 0.7, 1.0.1, ..., 1.1.0] require orchestra/testbench ^3.5 || ^4.0 -> satisfiable by orchestra/testbench[v3.5.0, ..., v3.9.4, v4.0.0, ..., v4.18.0].                                                       
    - psalm/plugin-laravel[1.2.0, ..., v1.4.0] require orchestra/testbench ^3.8 || ^4.0 || ^5.0 -> satisfiable by orchestra/testbench[v3.8.0, ..., v3.9.4, v4.0.0, ..., v4.18.0, v5.0.0, ..., v5.20.0].                                       
    - psalm/plugin-laravel 1.1.1 requires orchestra/testbench ^3.5 || ^4.0 || ^5.0 -> satisfiable by orchestra/testbench[v3.5.0, ..., v3.9.4, v4.0.0, ..., v4.18.0, v5.0.0, ..., v5.20.0].                                                    
    - psalm/plugin-laravel[v1.4.1, ..., v1.5.1] require orchestra/testbench ^3.8 || ^4.0 || ^5.0 || ^6.0 -> satisfiable by orchestra/testbench[v3.8.0, ..., v3.9.4, v4.0.0, ..., v4.18.0, v5.0.0, ..., v5.20.0, v6.0.0, ..., v6.44.0].        
    - psalm/plugin-laravel v1.4.10 requires orchestra/testbench ^4.0 || ^6.0 -> satisfiable by orchestra/testbench[v4.0.0, ..., v4.18.0, v6.0.0, ..., v6.44.0].                                                                               
    - psalm/plugin-laravel[v2.2.0, ..., v2.6.0] require orchestra/testbench ^7.1 -> satisfiable by orchestra/testbench[v7.1.0, ..., v7.42.0].                                                                                                 
    - psalm/plugin-laravel[v2.1.0, ..., v2.1.1] require orchestra/testbench ^7.0 -> satisfiable by orchestra/testbench[v7.0.0, ..., v7.42.0].                                                                                                 
    - psalm/plugin-laravel[v2.0.0, ..., v2.0.2] require orchestra/testbench ^6.22 || ^7.0 -> satisfiable by orchestra/testbench[v6.22.0, ..., v6.44.0, v7.0.0, ..., v7.42.0].                                                                 
    - psalm/plugin-laravel[v1.5.2, ..., v1.6.3] require orchestra/testbench ^3.8 || ^4.0 || ^5.0 || ^6.22 || ^7.0 -> satisfiable by orchestra/testbench[v3.8.0, ..., v3.9.4, v4.0.0, ..., v4.18.0, v5.0.0, ..., v5.20.0, v6.22.0, ..., v6.44.0
, v7.0.0, ..., v7.42.0].                                                                                                                                                                                                                      
    - psalm/plugin-laravel[v2.7.1, ..., v2.8.0] require orchestra/testbench ^7.19 || ^8.0 -> satisfiable by orchestra/testbench[v7.19.0, ..., v7.42.0, v8.0.0, ..., v8.23.0].                                                                 
    - orchestra/testbench[v3.5.0, ..., v3.5.2] require laravel/framework ~5.5.0 -> found laravel/framework[v5.5.0, ..., v5.5.50] but it conflicts with your root composer.json require (^11.0).                                               
    - orchestra/testbench v3.5.3 requires laravel/framework ~5.5.20 -> found laravel/framework[v5.5.20, ..., v5.5.50] but it conflicts with your root composer.json require (^11.0).                                                          
    - orchestra/testbench[v3.5.4, ..., v3.5.6] require laravel/framework ~5.5.34 -> found laravel/framework[v5.5.34, ..., v5.5.50] but it conflicts with your root composer.json require (^11.0).                                             
    - orchestra/testbench v3.6.0 requires laravel/framework ~5.6.0 -> found laravel/framework[v5.6.0, ..., v5.6.40] but it conflicts with your root composer.json require (^11.0).                                                            
    - orchestra/testbench[v3.6.1, ..., v3.6.2] require laravel/framework ~5.6.4 -> found laravel/framework[v5.6.4, ..., v5.6.40] but it conflicts with your root composer.json require (^11.0).                                               
    - orchestra/testbench v3.6.3 requires laravel/framework ~5.6.5 -> found laravel/framework[v5.6.5, ..., v5.6.40] but it conflicts with your root composer.json require (^11.0).                                                            
    - orchestra/testbench[v3.6.4, ..., v3.6.5] require laravel/framework ~5.6.13 -> found laravel/framework[v5.6.13, ..., v5.6.40] but it conflicts with your root composer.json require (^11.0).                                             
    - orchestra/testbench[v3.6.6, ..., v3.6.7] require laravel/framework ~5.6.34 -> found laravel/framework[v5.6.34, ..., v5.6.40] but it conflicts with your root composer.json require (^11.0).                                             
    - orchestra/testbench v3.7.0 requires laravel/framework ~5.7.0 -> found laravel/framework[v5.7.0, ..., v5.7.29] but it conflicts with your root composer.json require (^11.0).                                                            
    - orchestra/testbench[v3.7.1, ..., v3.7.5] require laravel/framework ~5.7.4 -> found laravel/framework[v5.7.4, ..., v5.7.29] but it conflicts with your root composer.json require (^11.0).                                               
    - orchestra/testbench v3.7.6 requires laravel/framework ~5.7.14 -> found laravel/framework[v5.7.14, ..., v5.7.29] but it conflicts with your root composer.json require (^11.0).                                                          
    - orchestra/testbench[v3.7.7, ..., v3.7.8] require laravel/framework ~5.7.28 -> found laravel/framework[v5.7.28, v5.7.29] but it conflicts with your root composer.json require (^11.0).                                                  
    - orchestra/testbench[v6.0.0, ..., v6.7.0] require laravel/framework ^8.0 -> found laravel/framework[v8.0.0, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0).                                                
    - orchestra/testbench[v6.7.1, ..., v6.7.2] require laravel/framework ^8.18.1 -> found laravel/framework[v8.18.1, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0).                                            
    - orchestra/testbench[v6.8.0, ..., v6.9.0] require laravel/framework ^8.22.1 -> found laravel/framework[v8.22.1, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0).                                            
    - orchestra/testbench[v6.10.0, ..., v6.18.0] require laravel/framework ^8.25 -> found laravel/framework[v8.25.0, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v6.19.0 requires laravel/framework ^8.26 -> found laravel/framework[v8.26.0, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v6.20.0, ..., v6.21.1] require laravel/framework ^8.54 -> found laravel/framework[v8.54.0, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v3.8.0 requires laravel/framework ~5.8.0 -> found laravel/framework[v5.8.0, ..., v5.8.38] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v3.8.1 requires laravel/framework ~5.8.2 -> found laravel/framework[v5.8.2, ..., v5.8.38] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v3.8.2 requires laravel/framework ~5.8.3 -> found laravel/framework[v5.8.3, ..., v5.8.38] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v3.8.3, ..., v3.8.4] require laravel/framework ~5.8.19 -> found laravel/framework[v5.8.19, ..., v5.8.38] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v3.8.5, ..., v3.8.6] require laravel/framework ~5.8.35 -> found laravel/framework[v5.8.35, v5.8.36, v5.8.37, v5.8.38] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v3.9.0, ..., v3.9.1, v4.0.0, ..., v4.0.1] require laravel/framework ^6.0 -> found laravel/framework[v6.0.0, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v3.9.2, v4.2.0] require laravel/framework ^6.2 -> found laravel/framework[v6.2.0, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v3.9.3, ..., v3.9.4] require laravel/framework ^6.18.0 -> found laravel/framework[v6.18.0, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v4.1.0 requires laravel/framework ^6.1 -> found laravel/framework[v6.1.0, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v4.3.0, ..., v4.4.1] require laravel/framework ^6.4 -> found laravel/framework[v6.4.0, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v4.5.0, ..., v4.6.0] require laravel/framework ^6.9 -> found laravel/framework[v6.9.0, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v4.7.0, ..., v4.13.0] require laravel/framework ^6.18 -> found laravel/framework[v6.18.0, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v4.14.0, ..., v4.18.0] require laravel/framework ^6.20.12 -> found laravel/framework[v6.20.12, ..., v6.20.44] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v5.0.0 requires laravel/framework ^7.0 -> found laravel/framework[v7.0.0, ..., v7.30.6] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v5.0.1 requires laravel/framework ^7.0.1 -> found laravel/framework[v7.0.1, ..., v7.30.6] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v5.0.2 requires laravel/framework ^7.0.6 -> found laravel/framework[v7.0.6, ..., v7.30.6] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v5.1.0, ..., v5.2.0] require laravel/framework ^7.1 -> found laravel/framework[v7.1.0, ..., v7.30.6] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v5.3.0, ..., v5.4.0] require laravel/framework ^7.10 -> found laravel/framework[v7.10.0, ..., v7.30.6] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v5.5.0, ..., v5.12.1] require laravel/framework ^7.24 -> found laravel/framework[v7.24.0, ..., v7.30.6] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v5.13.0, ..., v5.20.0] require laravel/framework ^7.30.3 -> found laravel/framework[v7.30.3, v7.30.4, v7.30.5, v7.30.6] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v6.22.0 requires laravel/framework ^8.65 -> found laravel/framework[v8.65.0, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v6.23.0 requires laravel/framework ^8.67 -> found laravel/framework[v8.67.0, ..., v8.83.27] but it conflicts with your root composer.json require (^11.0)
    - orchestra/testbench[v8.13.0, ..., v8.17.0] require laravel/framework ^10.23.1 -> found laravel/framework[v10.23.1, ..., v10.48.12] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v8.18.0 requires laravel/framework ^10.37.3 -> found laravel/framework[v10.37.3, ..., v10.48.12] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v8.19.0 requires laravel/framework ^10.39 -> found laravel/framework[v10.39.0, ..., v10.48.12] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench[v8.20.0, ..., v8.22.3] require laravel/framework ^10.40 -> found laravel/framework[v10.40.0, ..., v10.48.12] but it conflicts with your root composer.json require (^11.0).
    - orchestra/testbench v8.23.0 requires laravel/framework ^10.48.10 -> found laravel/framework[v10.48.10, v10.48.11, v10.48.12] but it conflicts with your root composer.json require (^11.0).
    - sebastian/diff[4.0.0, ..., 4.0.1] require php ^7.3 -> your php version (8.3.7) does not satisfy that requirement. 
    - psalm/plugin-laravel[v2.10.0, ..., v2.11.0] require vimeo/psalm ^5.20 -> satisfiable by vimeo/psalm[5.20.0, ..., 5.24.0].
    - vimeo/psalm[5.22.0, ..., 5.24.0] require nikic/php-parser ^4.16 -> satisfiable by nikic/php-parser[v4.16.0, ..., v4.19.1].
    - psalm/plugin-laravel v2.9.0 requires nikic/php-parser ^4.13 -> satisfiable by nikic/php-parser[v4.13.0, ..., v4.19.1].
    - You can only install one version of a package, so only one of these can be installed: nikic/php-parser[v3.1.0, ..., v3.1.5, v4.0.2, ..., v4.19.1, v5.0.0, v5.0.1, v5.0.2].
    - vimeo/psalm[5.20.0, ..., 5.21.1] require sebastian/diff ^4.0 || ^5.0 -> satisfiable by sebastian/diff[4.0.0, ..., 4.0.6, 5.0.0, ..., 5.1.1].
    - phpunit/php-code-coverage[11.0.0, ..., 11.0.3] require nikic/php-parser ^5.0 -> satisfiable by nikic/php-parser[v5.0.0, v5.0.1, v5.0.2].
    - You can only install one version of a package, so only one of these can be installed: sebastian/diff[3.0.0, ..., 3.0.6, 4.0.0, ..., 4.0.6, 5.0.0, ..., 5.1.1, 6.0.0, 6.0.1].
    - phpunit/phpunit[11.0.1, ..., 11.0.10] require phpunit/php-code-coverage ^11.0 -> satisfiable by phpunit/php-code-coverage[11.0.0, 11.0.1, 11.0.2, 11.0.3].
    - phpunit/phpunit[11.0.1, ..., 11.0.10] require sebastian/diff ^6.0 -> satisfiable by sebastian/diff[6.0.0, 6.0.1]. 
    - Root composer.json requires phpunit/phpunit ^11.0.1 -> satisfiable by phpunit/phpunit[11.0.1, ..., 11.1.3].
    - Root composer.json requires psalm/plugin-laravel * -> satisfiable by psalm/plugin-laravel[0.0.1, ..., 0.7, 1.0.1, ..., v1.6.3, v2.0.0, ..., v2.11.0].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require psalm/plugin-laravel:*" to figure out if any version is installable, or "composer require psalm/plugin-laravel:^2.1" if you know which you need.

Or using dev-master version:

composer require --dev psalm/plugin-laravel:dev-master -W
./composer.json has been updated Running composer update psalm/plugin-laravel --with-all-dependencies Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - sebastian/diff[4.0.0, ..., 4.0.1] require php ^7.3 -> your php version (8.3.7) does not satisfy that requirement.
    - Root composer.json requires psalm/plugin-laravel dev-master -> satisfiable by psalm/plugin-laravel[dev-master].
    - Conclusion: don't install phpunit/phpunit 11.1.3 (conflict analysis result)
    - psalm/plugin-laravel dev-master requires vimeo/psalm ^5.20 -> satisfiable by vimeo/psalm[5.20.0, ..., 5.24.0].
    - vimeo/psalm[5.22.0, ..., 5.24.0] require nikic/php-parser ^4.16 -> satisfiable by nikic/php-parser[v4.16.0, ..., v4.19.1].
    - You can only install one version of a package, so only one of these can be installed: nikic/php-parser[v3.1.0, ..., v3.1.5, v4.16.0, ..., v4.19.1, v5.0.0, v5.0.1, v5.0.2].
    - vimeo/psalm[5.20.0, ..., 5.21.1] require sebastian/diff ^4.0 || ^5.0 -> satisfiable by sebastian/diff[4.0.0, ..., 4.0.6, 5.0.0, ..., 5.1.1].
    - phpunit/php-code-coverage[11.0.0, ..., 11.0.3] require nikic/php-parser ^5.0 -> satisfiable by nikic/php-parser[v5.0.0, v5.0.1, v5.0.2].
    - You can only install one version of a package, so only one of these can be installed: sebastian/diff[4.0.0, ..., 4.0.6, 5.0.0, ..., 5.1.1, 6.0.0, 6.0.1].
    - phpunit/phpunit[11.0.1, ..., 11.0.10] require phpunit/php-code-coverage ^11.0 -> satisfiable by phpunit/php-code-coverage[11.0.0, 11.0.1, 11.0.2, 11.0.3].
    - phpunit/phpunit[11.0.1, ..., 11.0.10] require sebastian/diff ^6.0 -> satisfiable by sebastian/diff[6.0.0, 6.0.1].
    - Root composer.json requires phpunit/phpunit ^11.0.1 -> satisfiable by phpunit/phpunit[11.0.1, ..., 11.1.3].

Installation failed, reverting ./composer.json to its original content.

ricardosierra commented 1 month ago

The problem is in psalm 5/master. Requires phpunit 9, and not support phpunit 11 image

alies-dev commented 1 month ago

hey @ricardosierra thanks for the report!

PHPUnit should be a dev dependency, I'm not sure why there is a conflict 🤔 . Yes, you instead Psalm as a dev dependency, but, Psalm will not instal it's dev dependencies.

neither Psalm and psalm-laravel have phpunit as non-dev dependency: Psalm: https://github.com/vimeo/psalm/blob/02943245c48c7812e5e370e574e33fe9ec623f98/composer.json#L17-L41

psalm-laravel: https://github.com/psalm/psalm-plugin-laravel/blob/ffd51399b672959331ed3ef4eaae13984474e2f0/composer.json#L13-L30

UPD: I would like to move orchestra/testbench-core to dev dependencies of this package, probably it will solve some issues (but can't guarantee it will solve this one)

alies-dev commented 1 month ago

UPD: it's caused by orchestral/testbench https://github.com/orchestral/testbench/blob/9.x/composer.json#L30

But which package requested it?

can you please install your composer dependencies with --no-dev key and then run composer why phpunit/phpunit?

ricardosierra commented 1 month ago

I can only install it if I remove phpunit 11 from my composer image

"require": { "php": "^8.2|^8.3", "ext-gd": "", "ext-json": "", "ext-mbstring": "*", "laravel/framework": "^11.0", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9", "mll-lab/laravel-graphiql": "^3.2", "rebing/graphql-laravel": "^9.5" }, "require-dev": { "barryvdh/laravel-ide-helper": "^3.0", "fakerphp/faker": "^1.23", "laravel/pint": "^1.13", "laravel/sail": "^1.26", "mockery/mockery": "^1.6", "nunomaduro/collision": "^8.0", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^11.0.1", "spatie/laravel-ignition": "^2.4", "vimeo/psalm": "^5.20", "psalm/plugin-laravel": "dev-master" },

ricardosierra commented 1 month ago

Hi @alies-dev. I can install changing phpunit for 10.5

` $ composer why phpunit/phpunit

banlek/api               0.4.0  requires (for development) phpunit/phpunit (^10.0.1|^11.0.1)               
mockery/mockery          1.6.12 conflicts                  phpunit/phpunit (<8.0)                          
nunomaduro/collision     v8.1.1 conflicts                  phpunit/phpunit (<10.5.1 || >=12.0.0)           
orchestra/testbench-core v9.1.1 conflicts                  phpunit/phpunit (<10.5.0 || 11.0.0 || >=11.2.0)`

image

ricardosierra commented 1 month ago

@alies-dev When I go back to phpunit 11, the error comes back even when I remove the mocking and collision.

image image

ThePlatinum commented 2 weeks ago

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

composer require --dev psalm/plugin-laravel -W