phpstan / phpstan-deprecation-rules

PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.
MIT License
378 stars 18 forks source link

Treat FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED as deprecated #18

Closed cs278 closed 4 years ago

cs278 commented 4 years ago

PHP 7.3 deprecated these two constants as they have had no effect since PHP 5.2.1, it would be great if PHPStan warned against their usage.

As of PHP 5.2.1 FILTER_VALIDATE_URL implies FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED. Not only are these constants useless, they also create the incorrect impression that the scheme/host requirement can be disabled.

Proposed action: Generate a deprecation warning if the FILTER_FLAG_SCHEME_REQUIRED or FILTER_FLAG_HOST_REQUIRED flags are explicitly set in calls to filter APIs (PHP currently has no mechanism to deprecate the constants themselves). In PHP 8 the constants will be removed.

https://wiki.php.net/rfc/deprecations_php_7_3#filter_flag_scheme_required_and_filter_flag_host_required

ondrejmirtes commented 4 years ago

Don't hesitatet to send a PR to https://github.com/phpstan/phpstan-deprecation-rules

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.