ramsey,
@ramsey@phpc.social avatar

vimeo/psalm version 5 requires nikic/php-parser ^4.16

phpunit/phpunit version 11 requires phpunit/php-code-coverage ^11.0

phpunit/php-code-coverage version 11 requires sebastian/lines-of-code ^3.0

sebastian/lines-of-code version 3 requires nikic/php-parser ^5.0

End result: can’t upgrade to PHPUnit 11 if using Psalm.

😭🐼

stephenyeargin,

@ramsey PHP doing its best NodeJS impression there.

outofcontrol,
@outofcontrol@phpc.social avatar

@ramsey Looked at psalm once but stuck with phpstan in the end. Sounds like maybe my inner brain was ahead of the curve.

elazar,
@elazar@phpc.social avatar

@outofcontrol @ramsey The crux of the problem is that two different versions of the same library can't be loaded into the same PHP process at once. Seems like this should be a solvable problem in terms of Composer allowing the installation of multiple versions and the autoloader erroring out if it attempts to load more than one version into the same process?

outofcontrol,
@outofcontrol@phpc.social avatar

@elazar @ramsey I am very naive on composer things, but, would having an environment trigger be useful here? Having a dev, testing, staging, production etc versions for autoloading?

outofcontrol,
@outofcontrol@phpc.social avatar

@elazar @ramsey I guess we sort of do already, with the require and require dev. But that seems limited.

heiglandreas,
@heiglandreas@phpc.social avatar

@ramsey Use PHARs or use dedicated composer.jsons for tools.

Never. Ever. Tie. Production. Code. To. Tool. Versions.

ramsey,
@ramsey@phpc.social avatar

@heiglandreas I know. In this case, the package is a dev tool that relies on other dev tools.

heiglandreas,
@heiglandreas@phpc.social avatar

@ramsey That's almost worse, when a tool prohibits another tool. Same solution though: PHARs or separate composer.json per tool 🤷

ramsey,
@ramsey@phpc.social avatar

@heiglandreas I know. It just gets a little complicated: I integrated PHPUnit directly in a REPL, so you can write assertions directly from the terminal.

Synchro,
@Synchro@phpc.social avatar

@ramsey I just dropped psalm in one of my packages because of this. I’m also sticking with phpstan.

pierstoval,
@pierstoval@mastodon.social avatar

@ramsey If it was the node.js ecosystem, you might do it, but you would have 6 different versions of nikic/php-parser installed, as well as at least 4 different versions of many other dependencies 🙃

yivi,

@ramsey I'm sure you absolutely know this, but just mentioning that installing PHPUnit and/or Psalm with composer as project dependencies is generally not the best.

If possible, tools like this are better installed as PHAR package, or using tools like bamarni/composer-bin-plugin.

https://docs.phpunit.de/en/10.5/installation.html#phar-or-composer

https://github.com/bamarni/composer-bin-plugin

pieceofthepie,
@pieceofthepie@n8e.dev avatar

@yivi @ramsey

I always thought Symfony's way of installing PHPUnit was weird but in this case I can see it makes perfect sense.

jaapio,
@jaapio@phpc.social avatar

@ramsey psalm also has a composer package that installs a phar. "psalm/phar" that will help you to avoid these issues

Shoty,

@ramsey is there any reason to install them locally to the proiect? I install them globally as phar archives. I switched to this approach years ago specifically to fix issues like this

tjdraper,
@tjdraper@phpc.social avatar

@ramsey this type of thing is among the many reasons I gave up Psalm

ramsey,
@ramsey@phpc.social avatar

@tjdraper I still use both Psalm and PHPStan, but more-and-more, I think I only need one or the other, and PHPStan is the one I’m leaning toward.

tjdraper, (edited )
@tjdraper@phpc.social avatar

@ramsey I wouldn’t give up PHPStan, which is what led me to give up Psalm. It’s hard to keep the two from fighting sometimes.

ramsey,
@ramsey@phpc.social avatar

@tjdraper I wonder if I can figure out how to get a similar badge like this for PHPStan? https://shepherd.dev/github/ramsey/composer-repl-lib

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ethstaker
  • DreamBathrooms
  • everett
  • magazineikmin
  • Durango
  • InstantRegret
  • rosin
  • Youngstown
  • love
  • slotface
  • GTA5RPClips
  • kavyap
  • mdbf
  • ngwrru68w68
  • megavids
  • thenastyranch
  • tacticalgear
  • cubers
  • modclub
  • osvaldo12
  • cisconetworking
  • tester
  • khanakhh
  • normalnudes
  • provamag3
  • anitta
  • Leos
  • JUstTest
  • All magazines