- Issue created by @penyaskito
- Merge request !11810#3518917: Invalid service backend alias when a driver returns null for driver or databaseType" โ (Closed) created by penyaskito
- ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
- ๐ฎ๐นItaly mondrake ๐ฎ๐น
Why would those method return null? I see itโs technically possible, but wouldnโt return type hinting or annotations do a better job in narrowing the type?
- ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
type hinting? yes. But we would need to wait for 12.x then?
itโs technically possible, quite improbable, that's why I marked this as minor.
- ๐ฎ๐นItaly mondrake ๐ฎ๐น
Well, not if we had ๐ Introduce a @return-type-will-be-added annotation to indicate return type addition in next major; enforce with a PHPStan rule Active โฆ we would be able to typehint the classes extending Connection.
- ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
- ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
@mondrake ghost of drupal past explained another way to reproduce the bug, more realistic, which is not influenced by what connection holds. Added another unit test for covering that.
So even if what you suggest would work in that case (and I hope we can start doing that all over core), wouldn't work on this one.
- ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
- ๐บ๐ธUnited States smustgrave
1) Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest::testProcess Expectation failed for method name is "hasDefinition" when invoked 1 time Parameter 0 for invocation Symfony\Component\DependencyInjection\ContainerBuilder::hasDefinition('.fakeService'): bool does not match expected value. Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'a_valid_default_backend.fakeService' +'.fakeService' /builds/issue/drupal-3518917/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php:67 /builds/issue/drupal-3518917/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php:101 FAILURES!
Shows the test coverage
Summary appears to match the MR and don't see any open questions.
- ๐ฌ๐งUnited Kingdom catch
Committed/pushed to 11.x and cherry-picked to 11.2.x, thanks!