jschaedl / iban-validation

:bank: A small library for validating International Bank Account Numbers (IBANs)
MIT License
88 stars 19 forks source link

Deprecation error when nothing is passed as an argument to Iban\Validation\Swift\Registry::__construct() function #75

Closed menno-ll closed 1 year ago

menno-ll commented 2 years ago

When using this library, i get the following deprecation:

Not implementing the "Iban\Validation\Swift\RegistryLoaderInterface" for argument "$registryLoader" is deprecated since 1.8.1.

However, this is caused by the internal functions of this library, because they pass nothing to the Iban\Validation\Swift\Registry::__construct() function. That falls back to null, which results in the deprecation beeing triggered.

This can easily be resolved by adding an ! is_null() check to the if statement that checks for the deprecation

huebner-t commented 2 years ago

When can we expect a fix?

ElTi42 commented 1 year ago

deprecation warning is just triggered if using version 1.8.2

php version 8.x strict mode

public static function iban($iban)
    {
        $out = true;

        $iban = new Iban($iban);
        $validator = new IbanValidator();

        if(!$validator->validate($iban)){
            $out = 'Diese Iban ist ungültig.';
        }

        return $out;
    }

PHP Deprecated: Not implementing the "Iban\Validation\Swift\RegistryLoaderInterface" for argument "$registryLoader" is deprecated since 1.8.1. in /var/www/html/vendor/jschaedl/iban-validation/src/Swift/Registry.php on line 36

composer.lock entry:

            "name": "jschaedl/iban-validation",
            "version": "v1.8.2",
            "source": {
                "type": "git",
                "url": "https://github.com/jschaedl/iban-validation.git",
                "reference": "8b635c4872ff8818e8e9325058092c5add8defcd"
            }
jschaedl commented 1 year ago

This fix wasn't released until now. But here you go: https://github.com/jschaedl/iban-validation/releases/tag/v1.8.3

jschaedl commented 1 year ago

Closing here now. Thanks for reporting this.