Giter VIP home page Giter VIP logo

Comments (2)

BrianHenryIE avatar BrianHenryIE commented on July 21, 2024

Looks like it doesn't use autoloading for all its classes:

Warning: Ambiguous class resolution, "Carbon\PHPStan\AbstractReflectionMacro" was found in both "/path/to/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php" and "/path/to/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php", the first will be used.
Warning: Ambiguous class resolution, "Carbon\PHPStan\LazyMacro" was found in both "/path/to/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php" and "/path/to/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php", the first will be used.
Warning: Ambiguous class resolution, "Carbon\MessageFormatter\LazyMessageFormatter" was found in both "/path/to/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php" and "/path/to/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php", the first will be used.
Warning: Ambiguous class resolution, "Carbon\LazyTranslator" was found in both "/path/to/vendor/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php" and "/path/to/vendor/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php", the first will be used.

briannesbitt/Carbon#2512

Strauss determines which files to copy and prefix by reading the packages' composer.json autoload keys. So since Carbon has omitted those files, Strauss doesn't pick them up. Strauss has an override_autoload setting that allows redefining packages' autoload keys.

Using this as your extra key seems to work:

"extra": {
  "strauss": {
    "target_directory": "vendor",
    "constant_prefix": "TSD_CUSTOM_VENDOR_",
    "include_modified_date": false,
    "include_author": false,
    "exclude_from_prefix": {
      "packages": [
        "yahnis-elsts/plugin-update-checker",
        "woocommerce/action-scheduler"
      ]
    },
    "override_autoload": {
      "nesbot/carbon": {
        "autoload": {
          "psr-4": {
            "Carbon\\": "src/Carbon/"
          }
        },
        "classmap": [
          "lazy"
        ]
      }
    }
  }
}

There is an issue with double-prefixing when using strauss.phar repeatedly. I haven't been using the phar myself (although long term I think it's the better way) but I will fix that sooner or later. Just FYI to expect that!

from strauss.

TussendoorHQ avatar TussendoorHQ commented on July 21, 2024

Thanks @BrianHenryIE this resolved the issue!

I understand that the double-prefixing issue is not present when we use strauss as a dependency. Is there a way to use strauss a a dependency without the issues I experienced with the composer requirement as mentioned in:
#69

If there is a sollution for that then I could prevent deleting the prefixed vendor directory everytime I have to do composer update. I tried a new script on pre-update-cmd where the vendor and composer.lock would get deleted before updating and then triggering composer install. But this pre-update-cmd script gets triggered before composer install as well so that ended up in an infinite loop.

If not then I will delete the vendor directory manually for now.

By the way; using the strauss.phar is a lot faster.

from strauss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.