for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the godruoyi/laravel-idcard-validator.
*
* (c) Godruoyi <[email protected]>
* This source file is subject to the MIT license that is bundled.
*/
namespace Godruoyi\LaravelIdCard;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
class ServiceProvider extends BaseServiceProvider
{
/**
* Bootstrap any application services.
public function boot()
Validator::extend('idcard', function ($attribute, $value, $parameters, $validator) {
$parameters
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
Validator::extend('idcard', function ($attribute, $value, /** @scrutinizer ignore-unused */ $parameters, $validator) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$validator
Validator::extend('idcard', function ($attribute, $value, $parameters, /** @scrutinizer ignore-unused */ $validator) {
return IdCard::passes($value);
});
Validator::replacer('idcard', function ($message, $attribute, $rule, $parameters) {
$attribute
Validator::replacer('idcard', function ($message, /** @scrutinizer ignore-unused */ $attribute, $rule, $parameters) {
$message
Validator::replacer('idcard', function (/** @scrutinizer ignore-unused */ $message, $attribute, $rule, $parameters) {
$rule
Validator::replacer('idcard', function ($message, $attribute, /** @scrutinizer ignore-unused */ $rule, $parameters) {
Validator::replacer('idcard', function ($message, $attribute, $rule, /** @scrutinizer ignore-unused */ $parameters) {
return '无效的身份证号码';
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.