Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to PHPStan 1.7 #243

Merged
merged 1 commit into from May 27, 2022

Conversation

shochdoerfer
Copy link
Member

No description provided.

@shochdoerfer shochdoerfer added this to the 0.22.0 milestone May 23, 2022
@shochdoerfer
Copy link
Member Author

The upgrade is currently blocked by an issue with bitExpert\PHPStan\Magento\Autoload\Cache\FileCacheStorage where mkdir() seems to fail to create the needed directory structure.

@shochdoerfer shochdoerfer changed the title Upgrade to PHPStan 1.7 WIP: Upgrade to PHPStan 1.7 May 23, 2022
@shochdoerfer
Copy link
Member Author

Maybe it will be possible to migrate the whole autoloader magic to PHPStan's BetterReflection\SourceLocator implementation.

@shochdoerfer
Copy link
Member Author

shochdoerfer commented May 24, 2022

For reference, this is the issue I opened in the phpstan repo: phpstan/phpstan#7293

@shochdoerfer
Copy link
Member Author

Current plan: Refactor the autoloaders. Get rid of the cache and remove the laminas-code dependency in the extension attribute & extension interface autoloaders as those also seem to cause issues with the BetterReflection reflection logic used by PHPStan 1.7.

It seems important to make the autoloader implementations as dump as possible and as independent as possible. All dependencies need to be injected and not instantiated manually as this causes a problem with laminas-code.

@shochdoerfer
Copy link
Member Author

This is a lot more complicated than expected. After removing the cache and the laminas-code dependency, I got stuck with a problem in the ExtensionAttributeDataProvider. The BetterReflection autoloader magic in PHPStan does not allow the instantiation of new objects (I assume unknown classes - as in not already loaded classes).

Hitting a dead-end road with this. Need to look for alternatives how to hook into PHPStan.

@shochdoerfer
Copy link
Member Author

Eval()ing code in the autoloaders also does not work, an error I get now is Interface "Magento\Framework\Api\ExtensionAttributesInterface" not found in file. I don't see a way to dynamically load classes that don't exist anymore.

@shochdoerfer
Copy link
Member Author

Problem fixed in PHPStan core 1.7.2.

@shochdoerfer shochdoerfer merged commit 40a6efc into bitExpert:master May 27, 2022
@shochdoerfer shochdoerfer changed the title WIP: Upgrade to PHPStan 1.7 Upgrade to PHPStan 1.7 May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant