1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 15:51:16 +02:00

Remove deprecated validation events

This commit is contained in:
Alexander Skvortsov
2021-01-19 19:11:18 -05:00
parent c2e03d2b02
commit 1303b3b939
2 changed files with 1 additions and 59 deletions

View File

@@ -9,8 +9,6 @@
namespace Flarum\Foundation; namespace Flarum\Foundation;
use Flarum\Foundation\Event\Validating;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Validation\Factory; use Illuminate\Validation\Factory;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
@@ -38,11 +36,6 @@ abstract class AbstractValidator
*/ */
protected $validator; protected $validator;
/**
* @var Dispatcher
*/
protected $events;
/** /**
* @var TranslatorInterface * @var TranslatorInterface
*/ */
@@ -50,13 +43,11 @@ abstract class AbstractValidator
/** /**
* @param Factory $validator * @param Factory $validator
* @param Dispatcher $events
* @param TranslatorInterface $translator * @param TranslatorInterface $translator
*/ */
public function __construct(Factory $validator, Dispatcher $events, TranslatorInterface $translator) public function __construct(Factory $validator, TranslatorInterface $translator)
{ {
$this->validator = $validator; $this->validator = $validator;
$this->events = $events;
$this->translator = $translator; $this->translator = $translator;
} }
@@ -102,13 +93,6 @@ abstract class AbstractValidator
$validator = $this->validator->make($attributes, $rules, $this->getMessages()); $validator = $this->validator->make($attributes, $rules, $this->getMessages());
/**
* @deprecated in beta 15, removed in beta 16.
*/
$this->events->dispatch(
new Validating($this, $validator)
);
foreach ($this->configuration as $callable) { foreach ($this->configuration as $callable) {
$callable($this, $validator); $callable($this, $validator);
} }

View File

@@ -1,42 +0,0 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Foundation\Event;
use Flarum\Foundation\AbstractValidator;
use Illuminate\Validation\Validator;
/**
* @deprecated in Beta 15, remove in beta 16. Use the Validator extender instead.
* The `Validating` event is called when a validator instance for a
* model is being built. This event can be used to add custom rules/extensions
* to the validator for when validation takes place.
*/
class Validating
{
/**
* @var \Flarum\Foundation\AbstractValidator
*/
public $type;
/**
* @var Validator
*/
public $validator;
/**
* @param AbstractValidator $type
* @param Validator $validator
*/
public function __construct(AbstractValidator $type, Validator $validator)
{
$this->type = $type;
$this->validator = $validator;
}
}