8000 ConfigDataCollector::isSymfonyLts() return type is inconsistent · Issue #40534 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
< 8000 div id="repo-content-pjax-container" class="repository-content " >

ConfigDataCollector::isSymfonyLts() return type is inconsistent #40534

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

Closed
topikito opened this issue Mar 21, 2021 · 0 comments
Closed

ConfigDataCollector::isSymfonyLts() return type is inconsistent #40534

topikito opened this issue Mar 21, 2021 · 0 comments

Comments

@topikito
Copy link
Contributor

Symfony version(s) affected: 4.4/5.0/5.1/5.2
Description
The ConfigDataCollector class allows for an optional KernelInterface $kernel attribute. Note there are several isset checks for this private property. This conflicts with the getter method isSymfonyLts as it has a fixed return type bool.

How to reproduce

<?php

use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector;

$c = new ConfigDataCollector();
$c->collect(new Request(), new Response());
$c->isSymfonyLts();

// TypeError: Return value of Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector::isSymfonyLts() must be of the type bool, null returned

Possible Solution
Allow for the return type to be nullable and take advantage of the already typed return. Use the null coalescing operator on the attribute to retrieve the value.

Additional context

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

No branches or pull requests

3 participants
0