phpstan: Major release in nette/bootstrap is crashing PHPStan
Summary of a problem
I just ran a composer update.
Some packages were updated. Namely:
Package operations: 0 installs, 5 updates, 0 removals
- Updating phpunit/phpunit (7.5.7 => 7.5.8): Loading from cache
- Updating nette/utils (v2.5.3 => v3.0.1): Loading from cache
- Updating nette/robot-loader (v3.1.1 => v3.2.0): Checking out 0712a0e39a
- Updating nette/di (v2.4.15 => v3.0.0-RC2): Loading from cache
- Updating nette/bootstrap (v2.4.6 => v3.0.0): Loading from cache
After these upgrades, PHPStan stops running:
> php -d memory_limit=3G vendor/bin/phpstan analyse src -c phpstan.neon --level=7 --no-progress -vvv
In Expect.php line 378:
[Nette\DI\InvalidConfigurationException]
Unexpected option 'services › relativePathHelper › factory'.
It seems the upgrade of package “nette/bootstrap” is causing the issue.
Both PHPStan 0.10 and 0.11 are affected.
The problem can be temporarily fixed by adding a stronger version constraint in composer.json:
{
"require-dev" : {
"nette/bootstrap": "^2.4.6"
},
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 12
- Comments: 16 (13 by maintainers)
Commits related to this issue
- DefinitionSchema: 'class' should not overriding 'factory' in imported services [Closes phpstan/phpstan#2033] — committed to nette/di by dg 5 years ago
- Temporary fix phpstan issue https://github.com/phpstan/phpstan/issues/2033 — committed to matchish/laravel-scout-elasticsearch by matchish 5 years ago
- Processor: option 'type' will not override 'factory' of parent service (#39) for BC compatibility, 'class' will override 'factory', except class in imported services [Closes phpstan/phpstan#2033] — committed to nette/di by dg 5 years ago
I released RC3 with the fix, so it should work now.
@lookyman Good idea. The library that has a bug in the test version must be replaced. Anyone who makes a mistake in master should commit hara-kiri.
DI, bootstrap, config (neon) all go together. Anyway, there isn’t a reason to get rid of Nette. Bugs can happen to anyone and in combination with minimum-stability: dev, it’s the users that shoot themselves in the foot 😊
I prefer working on features tha find more bugs in code and make PHPStan smarter.
On Wed, 27 Mar 2019 at 08:27, Lukáš Unger notifications@github.com wrote:
–
Ondřej Mirtes
I just wanted to mention that this does seem to be fixed in
nette/didev-master, there just hasn’t been a release yet with that fix in it, so ifminimum-stabilityis set todev(even withprefer-stableset totrue)v3.0.0-RC2ofnette/diis pulled down, which has the bug in it.As others have mentioned, forcing
nette/dito anything butv3.0.0-RC2(many different ways to do that) will fix the issue.