8000 Handle union and intersection types in App services autoloading by aschempp · Pull Request #8367 · contao/contao · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Handle union and intersection types in App services autoloading #8367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: 5.3
Choose a base branch
from

Conversation

aschempp
Copy link
Member

If you currently have a class in your App /src/ folder, which has union or intersection types in the constructor, you get this error: Call to undefined method ReflectionUnionType::isBuiltin() in vendor/contao/manager-bundle/skeleton/config/services.php:93

This PR fixes the issue and adds unit tests for the services.php 😎

@aschempp aschempp added this to the 5.3 milestone May 23, 2025
@aschempp aschempp requested a review from ausi May 23, 2025 09:10
@aschempp aschempp self-assigned this May 23, 2025
@aschempp aschempp requested a review from leofeyer as a code owner May 23, 2025 09:10
@aschempp aschempp added the bug label May 23, 2025
Toflar
Toflar previously approved these changes May 23, 2025
Comment on lines +290 to +295
include_once __DIR__.'/../Fixtures/HttpKernel/AutowireSrc/src/Entity/FooEntity.php';
include_once __DIR__.'/../Fixtures/HttpKernel/AutowireSrc/src/EventListener/InvalidListener.php';
include_once __DIR__.'/../Fixtures/HttpKernel/AutowireSrc/src/EventListener/ValidListener.php';
include_once __DIR__.'/../Fixtures/HttpKernel/AutowireSrc/src/FrontendModule/LegacyModule.php';
include_once __DIR__.'/../Fixtures/HttpKernel/AutowireSrc/src/Messenger/UnionTypeMessage.php';
include_once __DIR__.'/../Fixtures/HttpKernel/AutowireSrc/src/Model/FooModel.php';
Copy link
Member
@leofeyer leofeyer May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could omit all this if you used the correct namespaces for these files like we do in the core bundle:

namespace Contao\CoreBundle\Tests\Fixtures\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="tl_author")
*/
class Author

Then you would not need an ignore-rule for the depcheck, either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That won't work, because we only load App services. Same as the test above for the AppBundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0