Your project must not contain invalid function or method calls 8
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_call
- ->scalarNode('country_class')
- ->defaultValue(Country::class)
- ->validate()
- ->ifString()
- ->then(static function ($value): string {
- if (!class_exists($value) || !is_a($value, Country::class, true)) {
- throw new InvalidConfigurationException(sprintf(
- 'Country class must be a valid class extending %s. "%s" given.',
- Country::class,
- $value
- ));
- ->then(static function ($value): string {
- if (!class_exists($value) || !is_a($value, Country::class, true)) {
- throw new InvalidConfigurationException(sprintf(
- 'Country class must be a valid class extending %s. "%s" given.',
- Country::class,
- $value
- ));
- }
- return $value;
- })
- ->scalarNode('country_admin_controller')
- ->defaultValue(CountryCrudController::class)
- ->validate()
- ->ifString()
- ->then(static function ($value): string {
- if (!class_exists($value) || !is_a($value, CountryCrudController::class, true)) {
- throw new InvalidConfigurationException(sprintf(
- 'Country admin controller must be a valid class extending %s. "%s" given.',
- CountryCrudController::class,
- $value
- ));
- ->then(static function ($value): string {
- if (!class_exists($value) || !is_a($value, CountryCrudController::class, true)) {
- throw new InvalidConfigurationException(sprintf(
- 'Country admin controller must be a valid class extending %s. "%s" given.',
- CountryCrudController::class,
- $value
- ));
- }
- return $value;
- })
- ->scalarNode('country_repository')
- ->defaultValue(CountryRepository::class)
- ->validate()
- ->ifString()
- ->then(static function ($value): string {
- if (!class_exists($value) || !is_a($value, CountryRepository::class, true)) {
- throw new InvalidConfigurationException(sprintf(
- 'Country repository must be a valid class extending %s. "%s" given.',
- CountryRepository::class,
- $value
- ));
- ->then(static function ($value): string {
- if (!class_exists($value) || !is_a($value, CountryRepository::class, true)) {
- throw new InvalidConfigurationException(sprintf(
- 'Country repository must be a valid class extending %s. "%s" given.',
- CountryRepository::class,
- $value
- ));
- }
- return $value;
- })
- {
- $configuration = new Configuration();
- $config = $this->processConfiguration($configuration, $configs);
- foreach ($config as $key => $value) {
- $container->setParameter('enabel_partner_countries.' . $key, $value);
- }
- $loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__, 2) . '/config'));
- $loader->load('services.yaml');
- }
- {
- $configs = $container->getExtensionConfig($this->getAlias());
- /** @var ConfigurationInterface $configuration */
- $configuration = $this->getConfiguration($configs, $container);
- $config = $this->processConfiguration($configuration, $configs);
- $container->prependExtensionConfig('enabel_partner_countries', $config);
- $twigConfig['globals']['enabel_partner_countries'] = [];
- foreach ($config as $k => $v) {
- $twigConfig['globals']['enabel_partner_countries'][$k] = $v;
- }
Your project uses non-strict array lookups 2
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.strict_array_lookup
- // Retrieve data from the Intl\Country component
- $countryCodes = Countries::getCountryCodes();
- // Create partner countries
- foreach ($countryCodes as $countryCode) {
- if (in_array($countryCode, array_keys($countries))) {
- /** @var Country $country */
- $country = $countries[$countryCode];
- } else {
- /** @var Country $country */
- $country = new $countryClass();
- $country = new $countryClass();
- }
- $country->setAlpha2code($countryCode);
- $country->setIsPartner(false);
- if (in_array($countryCode, Country::PARTNER_COUNTRIES)) {
- $country->setIsPartner(true);
- }
- $this->entityManager->persist($country);
- }