Closed dingo-d closed 4 years ago
FixWpStubs::php73Polyfill
I think you have taken all of the example phpstan config file :)
my config file looks like this:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
level: max
inferPrivatePropertyTypeFromConstructor: true
paths:
- %currentWorkingDirectory%/src/
excludes_analyse:
- %rootDir%/../../../vendor/
- %rootDir%/../../../node_modules/
- %rootDir%/../../../bin/
- %rootDir%/../../../src/Core/CompiledContainer.php
autoload_files:
- %currentWorkingDirectory%/vendor/autoload.php
ignoreErrors:
# Uses func_get_args()
- '#Function apply_filters invoked with [34567] parameters, 2 required\.#'
- '#Constant ASSETS_MANIFEST not found\.#'
When I removed vendor, lock and reinstalled it, without woocommerce stubs, it started working 🤷♂️
Installing it, again, gives error
Using version ^4.1 for php-stubs/woocommerce-stubs
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 1 update, 0 removals
- Updating php-stubs/wordpress-stubs (v5.1.1 => v5.4.0): Downloading (100%)
- Installing php-stubs/woocommerce-stubs (v4.1.0): Downloading (100%)
Package jeremeamia/superclosure is abandoned, you should avoid using it. Use opis/closure instead.
Writing lock file
Generating optimized autoload files
Deprecation Notice: Class tad\WPBrowser\Configuration\Configuration located in ./vendor/lucatume/wp-browser/src/tad/WPBrowser/Environment/Configuration.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.5/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class WP_CLI located in ./vendor/wp-cli/wp-cli/php/class-wp-cli.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.5/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class WP_CLI_Command located in ./vendor/wp-cli/wp-cli/php/class-wp-cli-command.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.5/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
29 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> PHPStan\WordPress\Composer\FixWpStubs::php73Polyfill
Removing duplicate is_countable() ...
Script PHPStan\WordPress\Composer\FixWpStubs::php73Polyfill handling the post-update-cmd event terminated with an exception
Installation failed, reverting ./composer.json to its original content.
[ErrorException]
file_get_contents(/Users/denis.zoljom/vagrant-local/www/personal/wordpress-test/public_html/wp-content/plugins/woo-solo-api/vendor/giacocorsiglia/
wordpress-stubs/wordpress-stubs.php): failed to open stream: No such file or directory
require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
I was wrong, sorry.
The fix call is in the example composer config: https://github.com/szepeviktor/phpstan-wordpress/blob/master/example/composer.json
Please remove that.
That fix was for giacocorsiglia/wordpress-stubs
, php-stubs/wordpress-stubs
does not contain deprecated, compat etc. code.
Cool, that solved that issue. But for some reason phpstan still requires files from the giacocorsiglia/wordpress-stubs
package.
Note: Using configuration file /phpstan.neon.
Warning: require_once(/vendor/giacocorsiglia/wordpress-stubs/wordpress-stubs.php): failed to open stream: No such file or directory in /vendor/phpstan/phpstan/src/Command/CommandHelper.php on line 257
Fatal error: require_once(): Failed opening required '/vendor/giacocorsiglia/wordpress-stubs/wordpress-stubs.php' (include_path='.:/usr/local/Cellar/valet-php@7.2/7.2.30_3/share/valet-php@7.2/pear') in /vendor/phpstan/phpstan/src/Command/CommandHelper.php on line 257
PHP Warning: require_once(/vendor/giacocorsiglia/wordpress-stubs/wordpress-stubs.php): failed to open stream: No such file or directory in /vendor/phpstan/phpstan/src/Command/CommandHelper.php on line 257
PHP Fatal error: require_once(): Failed opening required '/vendor/giacocorsiglia/wordpress-stubs/wordpress-stubs.php' (include_path='.:/usr/local/Cellar/valet-php@7.2/7.2.30_3/share/valet-php@7.2/pear') in /vendor/phpstan/phpstan/src/Command/CommandHelper.php on line 257
my composer.json
looks like this:
"require-dev": {
"brain/monkey": "^2.4",
"codeception/module-asserts": "^1.1",
"codeception/module-cli": "^1.0",
"codeception/module-db": "^1.0",
"codeception/module-filesystem": "^1.0",
"codeception/module-phpbrowser": "^1.0",
"codeception/module-webdriver": "^1.0",
"codeception/util-universalframework": "^1.0",
"codedungeon/phpunit-result-printer": "^0.20.1",
"dealerdirect/phpcodesniffer-composer-installer": "^0.6",
"lucatume/wp-browser": "^2.3",
"pcov/clobber": "^2.0",
"php-stubs/woocommerce-stubs": "^4.1",
"phpcompatibility/php-compatibility": "^9.0",
"phpcompatibility/phpcompatibility-wp": "^2.0",
"phpunit/phpunit": "^7.0",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "^3.5.0",
"szepeviktor/phpstan-wordpress": "^0.2.0"
},
it may be because of "szepeviktor/phpstan-wordpress": "^0.2.0"
See https://github.com/szepeviktor/phpstan-wordpress/blob/0.2.1/composer.json#L8
I was using that before creating the php-stubs org.
Use the latest version: ^0.6.0
I haven't noticed the 0.6 version 😱 I'll update it asap! Thanks for the help, really appreciate it!
Once a month issue composer outdated -D
in all your projects: The Update Day
I'm trying to add the WooCommerce stubs using
composer require --dev php-stubs/woocommerce-stubs
but I keep getting an errorAny idea why would this happen?