humanmade / local-vip

A Composer package providing a Docker-based local development environment for use with WordPress VIP projects.
7 stars 4 forks source link

Error when installed alongside PHPCS locally. #5

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hey,

When installed using composer in a project that also wants to use PHPCS from /vendor/phpcs, an error message is generated. This prevents PHPCS from executing.

We need this functionality so we can ship our code standards with the local development environment.

Steps to reproduce:

  1. Create this composer.json:
    "name": "test/bowery",
    "description": "A local environment",
    "type": "project",
    "extra": {
        "installer-paths": {
            "wordpress": [ "johnpbloch/wordpress" ]
        },
        "local-vip": {
            "name": "test",
            "host": "example.test",
            "subdomains": true
        }
    },
    "require": {
        "johnpbloch/wordpress": "5.5.0"
    },
    "require-dev": {
        "humanmade/local-vip": "^1.3",
        "automattic/vipwpcs": "^2.3",
        "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
    }
    }
  2. Run composer install
  3. Run vendor/bin/phpcs -i

I expected to see a list of installed PHPCS standards but instead see this error:


Fatal error: Uncaught Error: Call to undefined function HM\Local_VIP\add_filter() in .../vendor/humanmade/local-vip/inc/namespace.php:15
Stack trace:
#0 .../vendor/humanmade/local-vip/local-vip.php(22): HM\Local_VIP\bootstrap()
#1 .../vendor/composer/autoload_real.php(69): require('...')
#2 .../vendor/composer/autoload_real.php(59): composerRequire2139e4122d477816d2a5e92e9c81091d('0d264f8699bc94d...', '...')
#3 .../vendor/autoload.php(7): ComposerAutoloaderInit2139e4122d477816d2a5e92e9c81091d::getLoader()
#4 .../vendor/squizlabs/php_codesniffer/autoload.php(79): include('...')
#5 [internal function]: PHP_CodeSniffer\Autoload::load('PHP_CodeSniffer...')
#6 .../vendor/squizlabs/php_codesniffer/bin/phpcs(17): spl_autoload_call('PHP_CodeSniffer...')
#7 {main}
   in .../vendor/humanmade/local-vip/inc/namespace.php on line 15

Acceptance criteria:

joeleenk commented 3 years ago

@kadamwhite could you take a look at this and see if you need any more information? 🙏 🙇‍♀️

ghost commented 3 years ago

https://github.com/humanmade/local-vip/pull/6

This fixes the issue. Not sure if you want to do it differently.

joeleenk commented 3 years ago

Closing this issue, as it was resolved in #6