Download the PHP package komtaki/visibility-recommender without Composer
On this page you can find all versions of the php package komtaki/visibility-recommender. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download komtaki/visibility-recommender
More information about komtaki/visibility-recommender
Files in komtaki/visibility-recommender
Package visibility-recommender
Short Description The tool is refactoring object constant visibility.
License MIT
Homepage https://github.com/komtaki/visibility-recommender
Informations about the package visibility-recommender
komtaki/visibility-recommender
Analyze of PHP file, it will suggest the recommended visibility on PSR-12 by modifying the constants directly.
4.3 Properties and Constants Visibility MUST be declared on all properties.
Visibility MUST be declared on all constants if your project PHP minimum version supports constant visibilities (PHP 7.1 or later).
https://www.php-fig.org/psr/psr-12/#43-properties-and-constants
The recommended access modifiers are public
, private
and protected
.
Feature
- Three kinds of
public, protected, private
can be given to public object constants automatically. - Only minimal changes are required, and all line breaks and spaces are preserved.
- Supported files
- Mixed classes with and without namespaces.
- A mixture of constants with and without access modifiers.
- Plain view files.
- Not supported
- Functions that can recover constants by string concatenation, such as
eval()
andconstant()
.
- Functions that can recover constants by string concatenation, such as
Roughly pattern
Of course, we don't know if the constant reference is constructed by string concatenation using eval.
public
- Constants are fetched by the unique class name other than
self
,parent
, andstatic
.
protected
- Constants are fetched by
self
,parent
andstatic
from inherit classes. - Constants are fetched by
static
from own classes. - Constants with the same name are declared in parent and children classes in the inherit relationship.
private
- Constants that do not fit into any of the above patterns. Following example.
- Constants declared in own class and are fetched only in own class by
self
. - Constants are seemed to not used from anywhere.
- Constants declared in own class and are fetched only in own class by
Installation
composer require komtaki/visibility-recommender
Sample
Execution config
./bin/command
After
Target file before execution
Available Commands for development
composer test // Run unit test
composer tests // Test and quality checks
composer cs-fix // Fix the coding style
composer phpstan // Run phpstan
composer psalm // Run psalm
composer run-script --list // List all commands