Remove deprecated formatting events

This commit is contained in:
Alexander Skvortsov 2021-01-20 14:22:03 -05:00
parent 555c7767df
commit 2ee8358dbb
5 changed files with 1 additions and 151 deletions

View File

@ -1,31 +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\Formatter\Event;
use s9e\TextFormatter\Configurator;
/**
* @deprecated beta 15, removed beta 16. Use the Formatter extender instead.
*/
class Configuring
{
/**
* @var Configurator
*/
public $configurator;
/**
* @param Configurator $configurator
*/
public function __construct(Configurator $configurator)
{
$this->configurator = $configurator;
}
}

View File

@ -1,45 +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\Formatter\Event;
use s9e\TextFormatter\Parser;
/**
* @deprecated beta 15, removed beta 16. Use the Formatter extender instead.
*/
class Parsing
{
/**
* @var Parser
*/
public $parser;
/**
* @var mixed
*/
public $context;
/**
* @var string
*/
public $text;
/**
* @param Parser $parser
* @param mixed $context
* @param string $text
*/
public function __construct(Parser $parser, $context, &$text)
{
$this->parser = $parser;
$this->context = $context;
$this->text = &$text;
}
}

View File

@ -1,53 +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\Formatter\Event;
use Psr\Http\Message\ServerRequestInterface;
use s9e\TextFormatter\Renderer;
/**
* @deprecated beta 15, removed beta 16. Use the Formatter extender instead.
*/
class Rendering
{
/**
* @var Renderer
*/
public $renderer;
/**
* @var mixed
*/
public $context;
/**
* @var string
*/
public $xml;
/**
* @var ServerRequestInterface
*/
public $request;
/**
* @param Renderer $renderer
* @param mixed $context
* @param string $xml
* @param ServerRequestInterface|null $request
*/
public function __construct(Renderer $renderer, $context, &$xml, ServerRequestInterface $request = null)
{
$this->renderer = $renderer;
$this->context = $context;
$this->xml = &$xml;
$this->request = $request;
}
}

View File

@ -9,11 +9,7 @@
namespace Flarum\Formatter;
use Flarum\Formatter\Event\Configuring;
use Flarum\Formatter\Event\Parsing;
use Flarum\Formatter\Event\Rendering;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Events\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use s9e\TextFormatter\Configurator;
use s9e\TextFormatter\Unparser;
@ -31,11 +27,6 @@ class Formatter
*/
protected $cache;
/**
* @var Dispatcher
*/
protected $events;
/**
* @var string
*/
@ -43,13 +34,11 @@ class Formatter
/**
* @param Repository $cache
* @param Dispatcher $events
* @param string $cacheDir
*/
public function __construct(Repository $cache, Dispatcher $events, $cacheDir)
public function __construct(Repository $cache, $cacheDir)
{
$this->cache = $cache;
$this->events = $events;
$this->cacheDir = $cacheDir;
}
@ -79,9 +68,6 @@ class Formatter
{
$parser = $this->getParser($context);
// Deprecated in beta 15, remove in beta 16
$this->events->dispatch(new Parsing($parser, $context, $text));
foreach ($this->parsingCallbacks as $callback) {
$text = $callback($parser, $context, $text);
}
@ -101,9 +87,6 @@ class Formatter
{
$renderer = $this->getRenderer();
// Deprecated in beta 15, remove in beta 16
$this->events->dispatch(new Rendering($renderer, $context, $xml, $request));
foreach ($this->renderingCallbacks as $callback) {
$xml = $callback($renderer, $context, $xml, $request);
}
@ -153,9 +136,6 @@ class Formatter
$configurator->Autolink;
$configurator->tags->onDuplicate('replace');
// Deprecated in beta 15, remove in beta 16
$this->events->dispatch(new Configuring($configurator));
foreach ($this->configurationCallbacks as $callback) {
$callback($configurator);
}

View File

@ -24,7 +24,6 @@ class FormatterServiceProvider extends AbstractServiceProvider
$this->app->singleton('flarum.formatter', function (Container $container) {
return new Formatter(
new Repository($container->make('cache.filestore')),
$container->make('events'),
$this->app[Paths::class]->storage.'/formatter'
);
});