Giter VIP home page Giter VIP logo

Comments (3)

Spreeuw avatar Spreeuw commented on August 22, 2024

@BrianHenryIE as a more general question, would you say polyfills like these should be excluded from Strauss treatments?

Considering that for example this Normalizer polyfill defines missing global functions like normalizer_is_normalized and normalizer_normalize only when they're not defined in the first place, and that those functions aren't renamed themselves (or contained in a namespace)

from strauss.

BrianHenryIE avatar BrianHenryIE commented on August 22, 2024

I didn't mean to close this. Still more work to do!

from strauss.

BrianHenryIE avatar BrianHenryIE commented on August 22, 2024

OK, @alexmigf , the actual bug is fixed.

But as @Spreeuw points out, this might not be worth prefixing.

bootstrap.php operates in the global namespace. Strauss adds prefixes to existing namespaces, it does not add a namespace to files with none in them (although that's an interesting idea and could work as an alternative to prefixing classnames).

So when our plugin autoloader runs, Symphony's boostrap is going to check for a global normalizer_is_normalized() function, and add it if absent. If another plugin has loaded an older (or newer) version of polyfill-intl-normalizer, normalizer_is_normalized() will already be defined and that code used.

So the problem Strauss aims to solve is not correctly addressed here. And I don't think there is any benefit to prefixing the namespace.

I've seen suggestions for unit testing global functions by redefining them inside the project root namespace. i.e. Normalizer_Test\normalizer_is_normalized(). I think if normalizer_is_normalized() is called within the Normalizer_Test namespace, it will call normalizer_is_normalized() if available and Normalizer_Test\normalizer_is_normalized() otherwise.

I'll leave this open for discussion and until I test that idea out.

This is the config for excluding it, and this may end up being the default configuration:

{
    "require": {
        "symfony/polyfill-intl-normalizer": "^1.23"
    },
    "extra": {
        "strauss": {
            "exclude_from_prefix": {
                "packages": [
                        "symfony/polyfill-intl-normalizer"
                ]
            }
        }
    }
}

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.