Skip to content

Docs: Controller Attributes - multi filters as array docs mismatch #10039

@ampmonteiro

Description

@ampmonteiro

PHP Version

8.5

CodeIgniter4 Version

4.7.0

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

fpm-fcgi

Environment

development

Database

No response

What happened?

Try to apply multi filters using array and php attributes on controller, like exist in the docs:

    // Multiple filters can be applied
    #[Filter(by: ['auth', 'csrf'])]
    public function admin()
    {
    }

this does not work and it is not listed / show using php spark routes

in my example i try this ways:

// All of two define as follow individual
// #[Filter(by: 'module')]
// #[Filter(by: 'auth')]


#[Filter(by: AuthDummyFilter::class)]
#[Filter(by: ModuleDummyFilter::class)]

// no working and no documented
// #[Filter(by: [AuthDummyFilter::class, ModuleDummyFilter::class])]

// no working and documented
// #[Filter(by: ['auth', 'module'])]
class Secret extends BaseController
{

    public function index()
    {
        return view('secret-area');
    }
}

Steps to Reproduce

you can see and try this repo:

concrete example

Expected Output

i expected on of this to work, like on the docs:

    // Multiple filters can be applied
    #[Filter(by: ['auth', 'csrf'])]
    public function admin()
    {
    }

not even appear when using the command:

php spark routes

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions