Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude(__DIR__.'/vendor')
->notPath('phpstan-baseline.php')
;

return (new PhpCsFixer\Config())
Expand Down
31 changes: 14 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,35 @@
"doctrine/orm": "^2.20 || ^3.0",
"fakerphp/faker": "^1.20",
"friendsofphp/php-cs-fixer": "^3.13",
"geocoder-php/algolia-places-provider": "^0.4",
"geocoder-php/algolia-places-provider": "^0.5",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Algolia Places API is no longer functional.

The Algolia Places API shut down on May 31st, 2022. While the geocoder-php/algolia-places-provider package still exists and receives maintenance updates, the underlying service is non-functional. If this provider is retained solely for testing the bundle's integration patterns, this is acceptable. Otherwise, this dependency should be removed and replaced with an alternative geocoding provider.

"geocoder-php/arcgis-online-provider": "^4.4",
"geocoder-php/bing-maps-provider": "^4.3",
"geocoder-php/cache-provider": "^4.4.0",
"geocoder-php/chain-provider": "^4.5",
"geocoder-php/free-geoip-provider": "^4.5",
"geocoder-php/geo-plugin-provider": "^4.3",
"geocoder-php/geoip2-provider": "^4.3",
"geocoder-php/geoips-provider": "^4.0",
"geocoder-php/geonames-provider": "^4.4",
"geocoder-php/google-maps-places-provider": "^1.4",
"geocoder-php/google-maps-provider": "^4.7",
"geocoder-php/here-provider": "^0.7",
"geocoder-php/host-ip-provider": "^4.4",
"geocoder-php/here-provider": "^0.8",
"geocoder-php/host-ip-provider": "^4.5",
"geocoder-php/ip-info-db-provider": "^4.3",
"geocoder-php/ip-info-provider": "^0.4",
"geocoder-php/ipstack-provider": "^0.4",
"geocoder-php/ip-info-provider": "^0.5",
"geocoder-php/ipstack-provider": "^0.5",
"geocoder-php/locationiq-provider": "^1.4",
"geocoder-php/mapbox-provider": "^1.4",
"geocoder-php/mapquest-provider": "^4.3",
"geocoder-php/mapzen-provider": "^4.0",
"geocoder-php/maxmind-binary-provider": "^4.3",
"geocoder-php/maxmind-provider": "^4.4",
"geocoder-php/nominatim-provider": "^5.6",
"geocoder-php/open-cage-provider": "^4.6",
"geocoder-php/openrouteservice-provider": "^1.3",
"geocoder-php/pickpoint-provider": "^4.3",
"geocoder-php/tomtom-provider": "^4.4",
"geocoder-php/yandex-provider": "^4.5",
"geoip/geoip": "~1.17",
"geocoder-php/maxmind-binary-provider": "^4.4",
"geocoder-php/maxmind-provider": "^4.5",
"geocoder-php/nominatim-provider": "^5.8",
"geocoder-php/open-cage-provider": "^4.7",
"geocoder-php/openrouteservice-provider": "^1.4",
"geocoder-php/pickpoint-provider": "^4.4",
"geocoder-php/tomtom-provider": "^4.5",
"geocoder-php/yandex-provider": "^4.6",
"nyholm/nsa": "^1.3",
"nyholm/psr7": "^1.5",
"nyholm/psr7": "^1.8",
"nyholm/symfony-bundle-test": "^2.0 || ^3.0",
"phpstan/phpstan": "^1.9.2",
"psr/http-client": "^1.0",
Expand Down
2 changes: 0 additions & 2 deletions doc/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Here is a list of all provider factories and their options.
| `Bazinga\GeocoderBundle\ProviderFactory\ChainFactory` | services
| `Bazinga\GeocoderBundle\ProviderFactory\FreeGeoIpFactory` | http_client, base_url
| `Bazinga\GeocoderBundle\ProviderFactory\GeoIP2Factory` | provider, database_filename, user_id, license_key, webservice_options, locales, provider_service
| `Bazinga\GeocoderBundle\ProviderFactory\GeoipFactory` |
| `Bazinga\GeocoderBundle\ProviderFactory\GeoIPsFactory` | http_client, api_key
| `Bazinga\GeocoderBundle\ProviderFactory\GeonamesFactory` | http_client, username
| `Bazinga\GeocoderBundle\ProviderFactory\GeoPluginFactory` | http_client
| `Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory` | http_client, api_key, region
Expand Down
90 changes: 38 additions & 52 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
@@ -1,211 +1,197 @@
<?php

declare(strict_types=1);
<?php declare(strict_types = 1);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the declare statement formatting.

The space around = in the declare statement violates the declare_equal_normalize rule. According to PHP-CS-Fixer standards, there should be no spaces around the equals sign.

🔎 Proposed fix
-<?php declare(strict_types = 1);
+<?php declare(strict_types=1);

Based on static analysis hints.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<?php declare(strict_types = 1);
<?php declare(strict_types=1);
🧰 Tools
🪛 GitHub Check: PHP-CS-Fixer

[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

🤖 Prompt for AI Agents
In phpstan-baseline.php around line 1, the declare statement has spaces around
the equals sign; update the declaration to remove the spaces so it reads
declare(strict_types=1); to comply with the declare_equal_normalize PHP-CS-Fixer
rule and PHP formatting standards.


$ignoreErrors = [];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$name of method Geocoder\\\\ProviderAggregator\\:\\:using\\(\\) expects string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/Command/GeocodeCommand.php',
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$string of function strtolower expects string, string\\|null given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/Command/GeocodeCommand.php',
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$text of static method Geocoder\\\\Query\\\\GeocodeQuery\\:\\:create\\(\\) expects string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/Command/GeocodeCommand.php',
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
];
$ignoreErrors[] = [
// identifier: foreach.nonIterable
'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#',
'count' => 3,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: offsetAccess.nonOffsetAccessible
'message' => '#^Cannot access offset \'aliases\' on mixed\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: offsetAccess.nonOffsetAccessible
'message' => '#^Cannot access offset \'enabled\' on mixed\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: offsetAccess.nonOffsetAccessible
'message' => '#^Cannot access offset \'factory\' on mixed\\.$#',
'count' => 5,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: offsetAccess.nonOffsetAccessible
'message' => '#^Cannot access offset \'id\' on mixed\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: offsetAccess.nonOffsetAccessible
'message' => '#^Cannot access offset \'options\' on mixed\\.$#',
'count' => 4,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: offsetAccess.nonOffsetAccessible
'message' => '#^Cannot access offset \'reference\' on mixed\\.$#',
'count' => 2,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: staticMethod.nonObject
'message' => '#^Cannot call static method validate\\(\\) on mixed\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: cast.string
'message' => '#^Cannot cast mixed to string\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$alias of method Symfony\\\\Component\\\\DependencyInjection\\\\ContainerBuilder\\:\\:setAlias\\(\\) expects string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, Closure\\(string\\)\\: Symfony\\\\Component\\\\DependencyInjection\\\\Reference given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$factoryServiceId of static method Bazinga\\\\GeocoderBundle\\\\DependencyInjection\\\\Compiler\\\\FactoryValidatorPass\\:\\:addFactoryServiceId\\(\\) expects string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$id of class Symfony\\\\Component\\\\DependencyInjection\\\\Reference constructor expects string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$id of method Symfony\\\\Component\\\\DependencyInjection\\\\ContainerBuilder\\:\\:getDefinition\\(\\) expects string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$object_or_class of function class_implements expects object\\|string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$options of method Bazinga\\\\GeocoderBundle\\\\DependencyInjection\\\\BazingaGeocoderExtension\\:\\:findReferences\\(\\) expects array\\<int\\|string, mixed\\>, mixed given\\.$#',
'count' => 2,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#2 \\$config of method Bazinga\\\\GeocoderBundle\\\\DependencyInjection\\\\BazingaGeocoderExtension\\:\\:configureProviderPlugins\\(\\) expects array\\<int\\|string, mixed\\>, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: encapsedStringPart.nonString
'message' => '#^Part \\$providerName \\(mixed\\) of encapsed string cannot be cast to string\\.$#',
'count' => 1,
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
];
$ignoreErrors[] = [
// identifier: method.nonObject
'message' => '#^Cannot call method getLatitude\\(\\) on Geocoder\\\\Model\\\\Coordinates\\|null\\.$#',
'count' => 1,
'path' => __DIR__.'/src/Doctrine/ORM/GeocoderListener.php',
'path' => __DIR__ . '/src/Doctrine/ORM/GeocoderListener.php',
];
$ignoreErrors[] = [
// identifier: method.nonObject
'message' => '#^Cannot call method getLongitude\\(\\) on Geocoder\\\\Model\\\\Coordinates\\|null\\.$#',
'count' => 1,
'path' => __DIR__.'/src/Doctrine/ORM/GeocoderListener.php',
'path' => __DIR__ . '/src/Doctrine/ORM/GeocoderListener.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$text of method Geocoder\\\\Query\\\\GeocodeQuery\\:\\:withText\\(\\) expects string, string\\|null given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/Plugin/FakeIpPlugin.php',
'path' => __DIR__ . '/src/Plugin/FakeIpPlugin.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#2 \\$replace of function str_replace expects array\\|string, string\\|null given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/Plugin/FakeIpPlugin.php',
'path' => __DIR__ . '/src/Plugin/FakeIpPlugin.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$accountId of class GeoIp2\\\\WebService\\\\Client constructor expects int, int\\|null given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$filename of class GeoIp2\\\\Database\\\\Reader constructor expects string, string\\|null given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$geoIpProvider of class Geocoder\\\\Provider\\\\GeoIP2\\\\GeoIP2Adapter constructor expects GeoIp2\\\\ProviderInterface, GeoIp2\\\\ProviderInterface\\|null given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#2 \\$licenseKey of class GeoIp2\\\\WebService\\\\Client constructor expects string, string\\|null given\\.$#',
'count' => 1,
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
];
$ignoreErrors[] = [
// identifier: class.notFound
'message' => '#^Class Geocoder\\\\Provider\\\\Geoip\\\\Geoip not found\\.$#',
'count' => 1,
'path' => __DIR__.'/src/ProviderFactory/GeoipFactory.php',
];
$ignoreErrors[] = [
// identifier: class.notFound
'message' => '#^Instantiated class Geocoder\\\\Provider\\\\Geoip\\\\Geoip not found\\.$#',
'count' => 1,
'path' => __DIR__.'/src/ProviderFactory/GeoipFactory.php',
];
$ignoreErrors[] = [
// identifier: return.type
'message' => '#^Method Bazinga\\\\GeocoderBundle\\\\ProviderFactory\\\\GeoipFactory\\:\\:getProvider\\(\\) should return Geocoder\\\\Provider\\\\Provider but returns Geocoder\\\\Provider\\\\Geoip\\\\Geoip\\.$#',
'count' => 1,
'path' => __DIR__.'/src/ProviderFactory/GeoipFactory.php',
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
];

return ['parameters' => ['ignoreErrors' => $ignoreErrors]];
36 changes: 0 additions & 36 deletions src/ProviderFactory/GeoipFactory.php

This file was deleted.

6 changes: 0 additions & 6 deletions tests/Functional/config/provider/geoip.yml

This file was deleted.