-
-
Notifications
You must be signed in to change notification settings - Fork 283
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
[Insight] Verify if all php files contain declare(strict_types=1);
#7
Comments
You can add `declare(strict_types=1); " directive to all php files by using the friendsofphp/php-cs-fixer package. This is the sample of .php_cs file <?php
$finder = PhpCsFixer\Finder::create()
->files()
->name('*.php')
->exclude('tests/fixtures')
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;
return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
'declare_strict_types' => true,
])
; |
I am not find of tools that touch on my code automatically. Specially because that directive changes the behaviour of the code itself. Ideally would be cool to find a phpcs sniff for this, and add it here:
|
I don't really understand all stuff here. I am a little bit busy, too but I will spend time reading phpinsights source code soon and then try to think about a solution. I have created my own sniffs before. It may be helpful. |
It's done already. |
To solve this issue, you should create a pull request adding the following insight: Verify if all php files contain
declare(strict_types=1);
.This will be later an optional
Insight
.The text was updated successfully, but these errors were encountered: