Skip to content

Conversation

@norkunas
Copy link
Member

@norkunas norkunas commented Dec 11, 2025

Summary by CodeRabbit

  • Chores
    • Removed deprecated GeoIPs and Mapzen geocoding providers and their deprecation notices; updated static analysis baseline.
  • Tests
    • Updated functional tests to exclude removed providers, reference renamed config files, and mock external HTTP geolocation calls.
  • Configuration
    • Switched test configs from geoPlugin to FreeGeoIp provider and added a mock HTTP client service.
  • Refactor
    • Added explicit void return types to a couple of kernel/bundle lifecycle methods.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 11, 2025

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 7914d6b and f203b11.

📒 Files selected for processing (5)
  • phpstan-baseline.neon (0 hunks)
  • phpstan-baseline.php (1 hunks)
  • phpstan.dist.neon (1 hunks)
  • src/DataCollector/GeocoderDataCollector.php (1 hunks)
  • tests/baseline-ignore (1 hunks)

Walkthrough

Removed 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

Cohort / File(s) Change Summary
Removed provider factories
src/ProviderFactory/GeoIPsFactory.php, src/ProviderFactory/MapzenFactory.php
Deleted deprecated factory classes and all related methods, dependency declarations, deprecation triggers, and imports.
Tests — provider list and baseline
tests/Functional/ProviderFactoryTest.php, tests/baseline-ignore
Removed conditional yields and imports for GeoIPs/Mapzen from provider tests; removed corresponding deprecation notices from baseline-ignore and adjusted expected notices.
Tests — provider configs removed
tests/Functional/config/provider/geoips.yml, tests/Functional/config/provider/mapzen.yml
Deleted YAML test configurations that registered GeoIPs and Mapzen provider entries.
Tests — provider config edits & HTTP mocking
tests/Functional/config/fakeip_with_cache_cn.yml, tests/Functional/config/fakeip_with_cache_fr.yml, tests/Functional/PluginInteractionTest.php
Switched provider factory from Bazinga\GeocoderBundle\ProviderFactory\GeoPluginFactory to Bazinga\GeocoderBundle\ProviderFactory\FreeGeoIpFactory; added Http\Mock\Client service and http_client option in configs; updated PluginInteractionTest to use new config names and mock external HTTP responses.
PHPStan baseline and config
phpstan-baseline.neon, phpstan-baseline.php, phpstan.dist.neon
Removed the large phpstan-baseline.neon; added phpstan-baseline.php with a small ignore list; updated phpstan.dist.neon to include the new PHP file baseline.
Minor signature and kernel updates
src/BazingaGeocoderBundle.php, tests/Functional/CustomTestKernel.php
Added : void return type to BazingaGeocoderBundle::build and CustomTestKernel::reboot; added kernel runtime and share_dir parameters in test kernel.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas needing extra attention:
    • Search for stray references to GeoIPsFactory / MapzenFactory (imports, service configs).
    • Verify FreeGeoIpFactory compatibility with existing options and tests.
    • Confirm PHPStan baseline change doesn't surface blockers in CI.
    • Review mocked HTTP behavior in PluginInteractionTest.php for realism and fragility.

Poem

🐇 I hopped through code with careful paws,
Nibbled old factories without a pause.
Tests now mock the world outside,
New baselines set, old ghosts have died.
A tiny patch, a lighter cause. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Remove deprecated provider factories' accurately and clearly summarizes the main changes in the pull request, which involve removing deprecated GeoIPsFactory and MapzenFactory classes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@norkunas norkunas force-pushed the remove-deprecated-provider-factories branch 3 times, most recently from 53dcf70 to acb817d Compare December 11, 2025 11:43
@norkunas norkunas force-pushed the remove-deprecated-provider-factories branch from acb817d to f92ad63 Compare December 11, 2025 11:50
@norkunas norkunas force-pushed the remove-deprecated-provider-factories branch from 7914d6b to a209faa Compare December 11, 2025 12:26
Copy link

@coderabbitai coderabbitai bot left a 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 blocks

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between f92ad63 and 7914d6b.

📒 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 consistent

The switch to FreeGeoIpFactory, explicit cache_precision: ~, and the options.http_client: '@Http\Mock\Client' tied to the Http\Mock\Client service 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: Explicit void return type on build() is appropriate

Aligning build(ContainerBuilder $container) with an explicit : void return type matches the documented behavior and Symfony’s base Bundle contract, 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 tests

The CN config mirrors the FR one (factory, cache options, options.http_client, and Http\Mock\Client service), differing only by IP and comment. That alignment should make the HTTP mocking in PluginInteractionTest straightforward 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 expectations

Overriding reboot(?string $warmupDir): void to shutdown(), set $this->warmupDir, then boot() keeps the test kernel’s cache/warmup behavior explicit and consistent with how initializeContainer() already uses $this->warmupDir. The added kernel.runtime_mode* and kernel.share_dir parameters 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 configs

Bringing in RequestMatcher, Http\Mock\Client, and the PSR-7 interfaces matches the new fakeip_with_cache_*.yml configs, and switching the added test configs to fakeip_with_cache_cn.yml / fakeip_with_cache_fr.yml keeps 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 appropriate

Using $ignoreErrors with 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 in Configuration.php.


1-29: and

phpstan.dist.neon (1)

1-2: Baseline include switch looks correct

The include reference to phpstan-baseline.php is properly configured and the file exists in the repository. The rest of the configuration remains intact with correct paths and analysis level settings.

@norkunas norkunas force-pushed the remove-deprecated-provider-factories branch from b2ad180 to f203b11 Compare December 11, 2025 12:36
@norkunas norkunas merged commit f165c53 into geocoder-php:master Dec 11, 2025
19 checks passed
@norkunas norkunas deleted the remove-deprecated-provider-factories branch December 11, 2025 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant