Skip to content

Commit 0d94606

Browse files
authored
Merge pull request #8014 from kenjis/deprecate-filter-discovery
docs: make discoverFilters() deprecated
2 parents f277814 + 8ac3828 commit 0d94606

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

system/Filters/Filters.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ public function __construct($config, RequestInterface $request, ResponseInterfac
125125
*
126126
* Sample :
127127
* $filters->aliases['custom-auth'] = \Acme\Blob\Filters\BlobAuth::class;
128+
*
129+
* @deprecated 4.4.2 Use Registrar instead.
128130
*/
129131
private function discoverFilters(): void
130132
{

user_guide_src/source/changelogs/v4.4.2.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Changes
2929
Deprecations
3030
************
3131

32+
- **Filters:** The Auto-Discovery for Filters and ``Filters::discoverFilters()``
33+
is deprecated. Use :ref:`registrars` instead. See :ref:`modules-filters` for
34+
details.
35+
3236
Bugs Fixed
3337
**********
3438

user_guide_src/source/general/modules.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,18 @@ the **Modules** config file, described above.
160160
When working with modules, it can be a problem if the routes in the application contain wildcards.
161161
In that case, see :ref:`routing-priority`.
162162

163+
.. _modules-filters:
164+
163165
Filters
164166
=======
165167

168+
.. deprecated:: 4.4.2
169+
170+
.. note:: This feature is deprecated. Use :ref:`registrars` instead like the
171+
following:
172+
173+
.. literalinclude:: modules/015.php
174+
166175
By default, :doc:`filters <../incoming/filters>` are automatically scanned for within modules.
167176
It can be turned off in the **Modules** config file, described above.
168177

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace CodeIgniter\Shield\Config;
4+
5+
use CodeIgniter\Shield\Filters\SessionAuth;
6+
use CodeIgniter\Shield\Filters\TokenAuth;
7+
8+
class Registrar
9+
{
10+
/**
11+
* Registers the Shield filters.
12+
*/
13+
public static function Filters(): array
14+
{
15+
return [
16+
'aliases' => [
17+
'session' => SessionAuth::class,
18+
'tokens' => TokenAuth::class,
19+
],
20+
];
21+
}
22+
}

0 commit comments

Comments
 (0)