Skip to content

Sparks\Shield\Authentication\Authentication::__construct(): Argument #1 ($config) must be of type Sparks\Shield\Config\Auth, Config\Auth given #43

Closed
@kenjis

Description

@kenjis

Copy the Auth.php and AuthGroups.php from vendor/lonnieezell/codeigniter-shield/src/Config/ into your project's config folder and update the namespace to Config.
https://github.com/lonnieezell/codeigniter-shield/blob/develop/docs/0%20-%20install.md#intial-setup

But if I change the namespace, the following error occurs.

Sparks\Shield\Authentication\Authentication::__construct(): Argument #1 ($config) must be of type Sparks\Shield\Config\Auth, Config\Auth given

$ php spark routes

CodeIgniter v4.1.9 Command Line Tool - Server Time: 2022-04-18 20:30:12 UTC-05:00


[TypeError]

Sparks\Shield\Authentication\Authentication::__construct(): Argument #1 ($config) must be of type Sparks\Shield\Config\Auth, Config\Auth given, called in /Users/kenji/work/codeigniter/ci4-shield-test/vendor/lonnieezell/codeigniter-shield/src/Config/Services.php on line 25

at VENDORPATH/lonnieezell/codeigniter-shield/src/Authentication/Authentication.php:19

Backtrace:
  1    VENDORPATH/lonnieezell/codeigniter-shield/src/Config/Services.php:25
       Sparks\Shield\Authentication\Authentication()->__construct(Object(Config\Auth))

  2    SYSTEMPATH/Config/BaseService.php:251
       Sparks\Shield\Config\Services::auth(false)

  3    SYSTEMPATH/Config/BaseService.php:192
       CodeIgniter\Config\BaseService::__callStatic('auth', [...])

  4    VENDORPATH/lonnieezell/codeigniter-shield/src/Config/Services.php:20
       CodeIgniter\Config\BaseService::getSharedInstance('auth')

  5    SYSTEMPATH/Config/BaseService.php:251
       Sparks\Shield\Config\Services::auth()

  6    SYSTEMPATH/Common.php:960
       CodeIgniter\Config\BaseService::__callStatic('auth', [])

  7    APPPATH/Config/Routes.php:39
       service('auth')

  8    SYSTEMPATH/CodeIgniter.php:759
       require('/Users/kenji/work/codeigniter/ci4-shield-test/app/Config/Routes.php')

  9    SYSTEMPATH/CodeIgniter.php:416
       CodeIgniter\CodeIgniter()->tryToRouteIt(Object(CodeIgniter\Router\RouteCollection))

 10    SYSTEMPATH/CodeIgniter.php:346
       CodeIgniter\CodeIgniter()->handleRequest(null, Object(Config\Cache), false)

 11    SYSTEMPATH/CLI/Console.php:48
       CodeIgniter\CodeIgniter()->run()

 12    ROOTPATH/spark:79
       CodeIgniter\CLI\Console()->run()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions