Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: make discoverFilters() deprecated #8014

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
],
];
}
}
Loading