Giter VIP home page Giter VIP logo

Comments (11)

defunctl avatar defunctl commented on August 22, 2024

Just ran into something similar as well,

If you use composer's files autoload, it's broken when using Strauss with namespaced functions, e.g.

{
	"autoload": {
		"files": [
			"functions.php"
		]
	},
}

from strauss.

danieliser avatar danieliser commented on August 22, 2024

@defunctl we got around it temporarily by not using declared use function ... but rather prefixing each call with the FQN

from strauss.

BrianHenryIE avatar BrianHenryIE commented on August 22, 2024

I think this is a duplicate / related of #65 ... both are about namespaced functions.

I have some failing tests written from a when I tried to fix it, but haven't revisited yet:
https://github.com/brianhenryie/strauss/compare/master...BrianHenryIE:strauss:issue-65?expand=1

from strauss.

BrianHenryIE avatar BrianHenryIE commented on August 22, 2024

@danieliser That should be fixed in master now: aab2bf6

@defunctl I'm not sure what your issue really is. The autoloader type should be unrelated to this issue. Can you check does master fix your problem and if not, open a detailed issue?

from strauss.

danieliser avatar danieliser commented on August 22, 2024

@BrianHenryIE - Awesome, will give it a try later today. Thanks for fixing that for us.

from strauss.

defunctl avatar defunctl commented on August 22, 2024

@BrianHenryIE not sure if it's the same issue, but master still isn't working for me.

Here's a repo detailing the problem, happy to add a new issue if it's not related: https://github.com/defunctl/strauss-test

from strauss.

BrianHenryIE avatar BrianHenryIE commented on August 22, 2024

@defunctl Run composer dump-autoload after running Strauss for Composer to reindex the files it loads. After you ran it with "delete_vendor_packages": true it was still looking for /vendor/composer/../ralouphie/getallheaders/src/getallheaders.php.

from strauss.

defunctl avatar defunctl commented on August 22, 2024

@defunctl Run composer dump-autoload after running Strauss for Composer to reindex the files it loads. After you ran it with "delete_vendor_packages": true it was still looking for /vendor/composer/../ralouphie/getallheaders/src/getallheaders.php.

Nice, that worked!

Shouldn't Strauss just do that after it deletes the vendor packages?

Edit: or perhaps just update the docs to include that step?

e.g.

	"scripts": {
		"strauss": [
			"vendor/bin/strauss",
			"@composer dump-autoload"
		],

from strauss.

BrianHenryIE avatar BrianHenryIE commented on August 22, 2024

I'll certainly update the documentation. Strauss should do it, maybe, I'm not sure are there cases where you would not want it. I guess I could make it conditional on the delete_vendor_packages being true and if someone reports it as problematic, I could revert it. I don't use Composer's own autoloader in plugins so haven't thought about this much. I would like to add some command line output as Strauss runs, maybe it could be documented there too.

from strauss.

defunctl avatar defunctl commented on August 22, 2024

@BrianHenryIE let me know if I can help in any way. I could take a stab at improving the documentation, if you're able to tell me a little more about how you personally use it, and if it should be the preferred way to configure Strauss.

Perhaps were all just not using it the most optimal way?

Thanks for all your hard work, it's appreciated.

from strauss.

BrianHenryIE avatar BrianHenryIE commented on August 22, 2024

@defunctl TBH, I'm not using it the way I think it should be used! Instead, I'm using it the way I've always been using it.

There are a few open issues related to this, but I think ideally people would download the strauss.phar and after running composer install --no-dev, use it to prefix the contents of /vendor/ without moving/copying anything.

There's at least one related bug right now, where running strauss.phar twice results in double-prefixed namespaces. I haven't looked into fixing it at all yet.

Whenever I do that, I'd like to look at prefixing the uses of prefixed libraries inside existing code. I.e. make adopting Strauss easy for any codebase. Typically, I'm working on new plugins, so I haven't tried this yet. It should be trivial.

I've added a sentence to the README about composer dump-autoload, thanks. 18a7884

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.