Skip to content

Commit

Permalink
Merge pull request #8014 from kenjis/deprecate-filter-discovery
Browse files Browse the repository at this point in the history
docs: make discoverFilters() deprecated
  • Loading branch information
kenjis authored Oct 10, 2023
2 parents f277814 + 8ac3828 commit 0d94606
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions system/Filters/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ public function __construct($config, RequestInterface $request, ResponseInterfac
*
* Sample :
* $filters->aliases['custom-auth'] = \Acme\Blob\Filters\BlobAuth::class;
*
* @deprecated 4.4.2 Use Registrar instead.
*/
private function discoverFilters(): void
{
Expand Down
4 changes: 4 additions & 0 deletions user_guide_src/source/changelogs/v4.4.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Changes
Deprecations
************

- **Filters:** The Auto-Discovery for Filters and ``Filters::discoverFilters()``
is deprecated. Use :ref:`registrars` instead. See :ref:`modules-filters` for
details.

Bugs Fixed
**********

Expand Down
9 changes: 9 additions & 0 deletions user_guide_src/source/general/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,18 @@ the **Modules** config file, described above.
When working with modules, it can be a problem if the routes in the application contain wildcards.
In that case, see :ref:`routing-priority`.

.. _modules-filters:

Filters
=======

.. deprecated:: 4.4.2

.. note:: This feature is deprecated. Use :ref:`registrars` instead like the
following:

.. literalinclude:: modules/015.php

By default, :doc:`filters <../incoming/filters>` are automatically scanned for within modules.
It can be turned off in the **Modules** config file, described above.

Expand Down
22 changes: 22 additions & 0 deletions user_guide_src/source/general/modules/015.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace CodeIgniter\Shield\Config;

use CodeIgniter\Shield\Filters\SessionAuth;
use CodeIgniter\Shield\Filters\TokenAuth;

class Registrar
{
/**
* Registers the Shield filters.
*/
public static function Filters(): array
{
return [
'aliases' => [
'session' => SessionAuth::class,
'tokens' => TokenAuth::class,
],
];
}
}

0 comments on commit 0d94606

Please sign in to comment.