kafkiansky / service-locator-interrupter
Psalm plugin for Laravel that interrupt service locator calls.
Installs: 16 263
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 4
Forks: 0
Open Issues: 0
Type:psalm-plugin
Requires
- php: ^8.2
- ext-simplexml: *
- vimeo/psalm: ^5.12
Requires (Dev)
- ergebnis/composer-normalize: ^2.31
- laravel/framework: ^11.0
- phpunit/phpunit: ^10.2
- squizlabs/php_codesniffer: ^3.7
- weirdan/codeception-psalm-module: ^0.14.0
This package is auto-updated.
Last update: 2024-10-24 08:00:49 UTC
README
Contents:
Installation
Install this package with Composer:
WHY
Laravel-like developers prefer to use some kinds of ioc bad practices. In example: facades, helpers method, container injection and container instances creation anywhere: controllers, services, routes and even in models. You need inject necessary services in method and constructor, not call container to do it for you. Any services must has it own contract, container injection - it's not legal contract, it's hack.
This plugin can found issues of service locator usage - helpers, facades, container injection, container instances creation - and prevent them.
Even if you have your own facade, the plugin will be found it.
Even if you have inherited Container/Application
classes, the plugin will be found it.
Even if you have implemented any fo ContainerInterface
, the plugin also prevent that.
Dependency Injection
Replacement map
Testing
$ composer codeception
License
The MIT License (MIT). See License File for more information.