-
Notifications
You must be signed in to change notification settings - Fork 109
Remove deprecated provider factories #369
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
Remove deprecated provider factories #369
Conversation
|
Warning Rate limit exceeded@norkunas has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 59 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
WalkthroughRemoved two deprecated provider factories (GeoIPsFactory, MapzenFactory), their test configs and baseline deprecations; updated functional tests to use FreeGeoIpFactory with mocked HTTP client and adjusted PHPStan baseline handling and some method return type declarations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Comment |
53dcf70 to
acb817d
Compare
acb817d to
f92ad63
Compare
7914d6b to
a209faa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/Functional/PluginInteractionTest.php (1)
64-84: HTTP mocking is correct; consider DRY’ing the CN/FR blocksThe
Http\Mock\Client::on()setup correctly:
- Intercepts all outgoing requests.
- Returns a tailored 200 response with a mocked stream for the expected freegeoip URL.
- Fails the test on any unexpected HTTP call, ensuring no real network access.
The CN and FR blocks are structurally identical apart from URL and JSON payload. If you want to reduce duplication, you could extract a small helper that registers the mock for a given IP/JSON payload and reuse it for both scenarios.
private function registerGeoIpMock(Client $client, string $expectedUrl, string $jsonPayload): void { $client->on(new RequestMatcher(), function (RequestInterface $request) use ($expectedUrl, $jsonPayload) { if ($expectedUrl === (string) $request->getUri()) { $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($jsonPayload); $response = $this->createMock(ResponseInterface::class); $response->method('getStatusCode')->willReturn(200); $response->method('getBody')->willReturn($stream); return $response; } self::fail(sprintf('Unexpected http call "%s %s".', $request->getMethod(), (string) $request->getUri())); }); }Also applies to: 105-125
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
phpstan-baseline.neon(0 hunks)phpstan-baseline.php(1 hunks)phpstan.dist.neon(1 hunks)src/BazingaGeocoderBundle.php(1 hunks)tests/Functional/CustomTestKernel.php(3 hunks)tests/Functional/PluginInteractionTest.php(3 hunks)tests/Functional/config/fakeip_with_cache_cn.yml(1 hunks)tests/Functional/config/fakeip_with_cache_fr.yml(1 hunks)tests/baseline-ignore(1 hunks)
💤 Files with no reviewable changes (1)
- phpstan-baseline.neon
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/baseline-ignore
🧰 Additional context used
🪛 GitHub Check: PHP-CS-Fixer
phpstan-baseline.php
[warning] 1-1:
Found violation(s) of type: declare_equal_normalize
[warning] 1-1:
Found violation(s) of type: concat_space
[warning] 1-1:
Found violation(s) of type: blank_line_after_opening_tag
[warning] 1-1:
Found violation(s) of type: indentation_type
🔇 Additional comments (8)
tests/Functional/config/fakeip_with_cache_fr.yml (1)
5-7: FreeGeoIpFactory + mock HTTP client wiring looks consistentThe switch to
FreeGeoIpFactory, explicitcache_precision: ~, and theoptions.http_client: '@Http\Mock\Client'tied to theHttp\Mock\Clientservice definition line up cleanly with how the functional test acquires and configures the mock client. This should keep the test hermetic and avoid real network calls while preserving the intended fake‑IP behavior for the FR case.Also applies to: 11-16, 18-19
src/BazingaGeocoderBundle.php (1)
26-30: Explicitvoidreturn type onbuild()is appropriateAligning
build(ContainerBuilder $container)with an explicit: voidreturn type matches the documented behavior and Symfony’s baseBundlecontract, with no behavior change.tests/Functional/config/fakeip_with_cache_cn.yml (1)
5-7: CN fake IP config is consistent with FR setup and testsThe CN config mirrors the FR one (factory, cache options,
options.http_client, andHttp\Mock\Clientservice), differing only by IP and comment. That alignment should make the HTTP mocking inPluginInteractionTeststraightforward and avoid environment‑driven flakiness.Also applies to: 11-16, 18-19
tests/Functional/CustomTestKernel.php (1)
33-37: Custom kernel reboot and runtime params remain coherent with Symfony expectationsOverriding
reboot(?string $warmupDir): voidtoshutdown(), set$this->warmupDir, thenboot()keeps the test kernel’s cache/warmup behavior explicit and consistent with howinitializeContainer()already uses$this->warmupDir. The addedkernel.runtime_mode*andkernel.share_dirparameters follow Symfony’s modern runtime patterns and should be safe for the functional tests, assuming the underlying Symfony version supports these env processors.Also applies to: 68-71, 80-81
tests/Functional/PluginInteractionTest.php (1)
17-22: New imports and config wiring align with updated fake IP configsBringing in
RequestMatcher,Http\Mock\Client, and the PSR-7 interfaces matches the newfakeip_with_cache_*.ymlconfigs, and switching the added test configs tofakeip_with_cache_cn.yml/fakeip_with_cache_fr.ymlkeeps this test in sync with the provider factory changes.Also applies to: 58-60, 99-101
phpstan-baseline.php (2)
3-29: Baseline content and structure are appropriateUsing
$ignoreErrorswith specific anchored regex messages and returning['parameters' => ['ignoreErrors' => $ignoreErrors]]is compatible with PHPStan’s PHP configuration format and keeps the baseline narrowly focused on the known generic-type warnings inConfiguration.php.
1-29: andphpstan.dist.neon (1)
1-2: Baseline include switch looks correctThe include reference to
phpstan-baseline.phpis properly configured and the file exists in the repository. The rest of the configuration remains intact with correct paths and analysis level settings.
b2ad180 to
f203b11
Compare
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.