mcmatters / fqn-checker
Installs: 4 548
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=8.0
- nikic/php-parser: ^4.0 || ^5.0
- symfony/console: ^5.0 || ^6.0
- symfony/finder: ^5.0 || ^6.0
README
Checks your php-code for the presence of un-imported functions and gives you information about where they are located.
Installation
composer require mcmatters/fqn-checker
Usage
<?php declare(strict_types=1); use McMatters\FqnChecker\FqnChecker; require 'vendor/autoload.php'; $checker = new FqnChecker(file_get_contents(__DIR__.'/Wrong.php')); print_r($checker->getNotImported()); print_r($checker->getImported());
Listing of Wrong.php
<?php declare(strict_types=1); namespace Acme; use function ucfirst; class Wrong { public function testArray() { return array_filter([], null); } public function testString() { return ucfirst('hello'); } }
Result
[
'constants' => [
'Acme' => [
'null' => [
13,
],
],
],
'functions' => [
'Acme' => [
'array_filter' => [
13,
],
],
],
]
[
'constants' => [],
'functions' = [
'Acme' => [
'ucfirst' => true,
],
],
]