Coder Social home page Coder Social logo

Comments (2)

xabbuh avatar xabbuh commented on June 26, 2024

Maybe related to #56875? Does the fix proposed for that one help here too?

from symfony.

jderusse avatar jderusse commented on June 26, 2024

Maybe related to #56875? Does the fix proposed for that one help here too?

This is not related.

Here is simplified change in the implementation: (I removed the logic about isIgnored and wildcard groups)

https://github.com/symfony/symfony/pull/51514/files#diff-8183be74478a13fcda2e17124d559a29013d10f119805a6623a8a396edb70c76R48

foreach ($properties as $property) {
  if (null === $groups || array_intersect($groups, $property->getGroups())) {
    yield $property;
  }
}

note: array_intersect([], $property->getGroups()) returns nothing, that's why in previous implementation the list of properties was empty when the groups was [].

new implementation

$groups ??= [];
$groupsHasBeenDefined = [] !== $groups;

foreach ($properties as $property) {
  if (!$groupsHasBeenDefined || array_intersect($groups, $property->getGroups())) {
    yield $property;
  }
}

So all properties are included:

  • before: When groups is null
  • after: When groups is an empty [] (null is converted to [])

I can open a PR, I was just wondering if the initial behavior was expected or a bug

from symfony.

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.