Enforce type declaring for PHP 7.1 and higher
typhp
is a simple tool checks whether type hint for arguments or return type declared.
Unlike static analysis tools, it doesn't point out possible errors and issues
but suggests typehint everything possible.
typhp
doesn't complain. For example: @return array|bool
, @param mixed $foo
, etc.There are several ways to install typhp
. The recommended one is to use
phar distribution. Thus you won't have possible dependency conflict.
Direct download from the latest Github release
wget https://github.com/seferov/typhp/releases/download/v0.2.0/typhp.phar -O typhp
chmod +x typhp
You can install phar distribution by Phive
phive install seferov/typhp --global
typhp
can be installed by composer globally.
composer global require seferov/typhp
If you prefer, you can it add dev dependency to your project.
composer require require seferov/typhp --dev
typhp analyse path
If config file (.typhp.yml
) is present in project root, it can be run
just by vendor/bin/typhp
Example output
Analyse closures
Check by PHP version. For example, don't suppress @param object
for >= PHP 7.2
Better configuration
Check declare(strict_types=1)
by config
Phar file
Auto deploy phar file to release assets & add self-update command
Github Actions
Since it is a beta release, there might be some issues. If you found one, please submit it here