All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Semantic Versioning is maintained only for the following:
- available fixer IDs and their configuration;
- any classes or methods with
@apiannotation.
The fixers themselves can change their behavior on any update. New fixers could be added with minor releases, this would require changes in configuration if migration mode is used.
- StaticMethodsFixer to align with PhpBasic convention "Static methods".
- ChainedMethodCallsFixer refactored for the proper whitespaces, new lines etc.
- DefaultValuesInConstructorFixer refactored
- ConditionResultsFixer fixed a bug when trying to get not existed token index+1
- TypeHintingArgumentsFixer to work correctly with nullable (?type) and other arguments.
- ChainedMethodCallsFixerTest - testcases added
- DefaultValuesInConstructorFixerTest - testcases added
- friendsofphp/php-cs-fixer` minor update to version 3.64.0
- Dependencies update (phpunit)
- Modified the
download-phar.shscript to download the latest PHAR file. - VisibilityPropertiesFixer has been changed to properly detect variables declared in the __constructor.Some other refactoring of fixer.
- DefaultValuesInConstructorFixer priority changed to work wright with VisibilityPropertiesFixer.
- SplittingInSeveralLinesFixer was refactored to handle situations with splitting lines in closures and functions parameters, including parameters in __constructor.
- friendsofphp/php-cs-fixer major update (3.60.0)
- download-phar.sh now downloading v3.60.0/php-cs-fixer.phar
- configuration files renamed from .php_cs, .php_cs_risky, .php_cs_safe to php-cs-fixer.php, php-cs-fixer-risky.php, php-cs-fixer-safe.php
- Token::setContent() was deprecated in the library. Call of this function was replaced on
new Token() - Php-cs-fixers names were changed
- All Paysera fixers were refactored due the changes and deprecations in php-cs-fixer library
- All Paysera tests were refactored due the changes and deprecations in php-cs-fixer library
- Code style fixes
- More refactoring needed
- Remove usage of internal classes of php-cs-fixer
- Refactor parsers
- Fix code styles
- Support for doctrine/inflector
^2.0
- PHP version constraint updated to fit any version greater than 7.4
- added support for php 8.2
php-cs-fixeris updated to2.19version, including binarypaysera-php-cs-fixerthat's distributed with this library.
- Removed unused dependency
gecko-packages/gecko-php-unit
- modified another chunk of the fixers to prepare to be compatible with php-cs-fixer
2.19
- modified some of the fixers to prepare to be compatible with php-cs-fixer
2.19
- added support for php 7.4 typed properties declarations
- added support for php 7.4 constants with access modifiers
php-cs-fixeris updated to2.16.3version, including binarypaysera-php-cs-fixerthat's distributed with this library.
- Some functions without substitutions in PHP Date/Time classes were removed from DateTimeFixer
@php-cs-fixer-ignoreannotation to ignore fixer for specific file- Abstraction layer added for parsing specific parts of classes and methods. Also abstract fixer added to ease fixing – uses linked list of tokens instead of index-based array
Paysera/php_basic_comment_php_doc_on_propertiesdoes not require PhpDoc on properties that are assigned a new instance of some class inside the constructor. Leaves the comment if it contains description of the property.Paysera/php_basic_code_style_namespaces_and_use_statementsimports all classes with still unused short class name. Previously used black-list was removed (for example, current fixer correctly imports\Exceptionclass). Also supports classes with import aliases.Paysera/php_basic_feature_type_hintingsupports more use-cases with aliased imports or without them. It changes the type-hint to the suggested one. Fixer moved from recommendation to risky fixers group.
Paysera/php_basic_comment_php_doc_necessitywas completely removed as it clears descriptions of classes and/or methods, additional annotations and is not defined by any style guide rule.
Paysera/php_basic_code_style_default_values_in_constructorwas producing invalid PHP code with some cases, most importantly when usingstrict_typesdeclaration.
- This library now brings php-cs-fixer binary with itself named
paysera-php-cs-fixer. This binary is kept compatible with current version of fixer config and is installed with this library – no need to install php-cs-fixer separately as a library or globally.
- Requirement of PHP CS Fixer was raised to 2.14.2
Paysera/php_basic_code_style_default_values_in_constructorto move default property values initialization to contructor.
- Allow multi-line implements according to PSR-2 Coding Style Guide, which will make the following code acceptable:
use ArrayAccess;
use Countable;
use Serializable;
class ClassName extends ParentClass implements
ArrayAccess,
Countable,
Serializable
{
// constants, properties, methods
}TypeHintingFixervalidation exceptions- Updates exceptions list
- Count of null on PHP 7.2 (#5)
- Migration mode was added for enabling only some of the rules. This allows to change the code style gradually rule-by-rule.
Paysera/php_basic_feature_return_and_argument_typesdoes not allow to pass any configuration options.- Default configuration files were refactored to be based on single file (
.php_cs) and to follow the style guide. - API is changed for semantic versioning - only the fixer configuration will be maintained for backward compatibility, you should not extend or use any of the fixers (or other classes) directly. If you do, please test after every update of this library.
Paysera/php_basic_comment_php_doc_on_methodsfixer (withPhpDocOnMethodsFixerclass) was removed. The fixer did not perform the fixes needed and performed some that were not intended.
Paysera/php_basic_code_style_namespaces_and_use_statementswas fixed for cases where comma is after the class name, like when implementing a few interfaces.Paysera/php_basic_feature_unnecessary_variablesnow is not so aggressive as previously and handles only some of previous cases. Previous behavior in many cases made the code less readable and/or changed the execution order of function calls etc.Paysera/php_basic_code_style_method_namingchanged to correspond with the convention - for question-type functions it's required to return boolean. If we're not sure of the return type, don't add the warning. Also entity function prefix checks were removed, as conventions does not state that Entity cannot have any other function than with defined prefixes.Paysera/php_basic_code_style_splitting_in_several_lineswas completely refactored and remade to follow current conventions and to handle much more cases.no_unneeded_control_parentheseswas disabled as it works too aggressively in some cases.self_accessorrule disabled.Paysera/psr_2_line_lengthallows lines with long constant tokens (like strings), also adds comments before the line that's too long;Paysera/php_basic_feature_return_and_argument_typeswas improved to handle cases with iterables and generators.Paysera/php_basic_feature_comparing_to_nullwas improved to allow checking boolean values that can also be null.Paysera/php_basic_code_style_doc_block_whitespaceallows DocBlock to have indentation in description.curly_bbrace_blockinno_extra_blank_lineswas disabled in default configuration to allow empty lines betweenelseifstatements.Paysera/php_basic_feature_calling_parent_constructorallows statements before calling parent constructor if they do not modify the state of the object. This could be needed for readability or modifying constructor parameters beforehand.bracesfixer was exchanged for patched version inPaysera/php_basic_braceswhich fixes cases withelseifstatements.Paysera/php_basic_feature_comparing_to_booleannow only fixes variables which are defined as boolean-only in function arguments with type-hint or in DocBlock. It's also marked as risky.- Disabled risky fixers from
.php_cs_safeto be able to run it.
- Downgraded
doctrine/inflectorfrom^1.1to~1.0.0
- Include autoload in
.php_cs*config files - Lock
friendsofphp/php-cs-fixerversion on2.11.1
- Require
friendsofphp/php-cs-fixeronly in dev
- Changed
friendsofphp/php-cs-fixerrequired version to be below2.11since it introduced breaking changes causing tests to fail.
Paysera/php_basic_comment_php_doc_necessityremoved doc blocks which doesn't reflect any used parameters, return types or thrown exceptions.
Paysera/php_basic_code_style_comparison_ordernow respects blocks, i.e.(false === someFunction())
Paysera/php_basic_code_style_doc_block_whitespaceremoves extra whitespaces from doc block annotations.
- More permissive
friendsofphp/php-cs-fixerdependency constraint. - Future compatibility added to
PayseraConventionsConfig.
Paysera/php_basic_code_style_namespaces_and_use_statements:- changes all occurrences FQCNs to imported use statements.
- does not import namespaces without root prefix
\Some\Name\SpacevsSome\Name\Space. - properly imports global classes i.e.:
\DateTime
Paysera/php_basic_feature_checking_explicitlyfixer now changesissetifemptychecks array key, i.e.:!empty($a['b']) -> isset($a['b'])!empty($a) -> count($a) > 0empty($a) -> count($a) === 0
Paysera/php_basic_comment_php_doc_on_propertiesfixer now supportsarraytypehint.Paysera/php_basic_feature_type_hinting_argumentsfixer now properly handles primitive nullable DocBlocks i.e.@param int|nullPaysera/php_basic_feature_void_resultfixer now recognizes return block inside callback.Paysera/php_basic_code_style_namespaces_and_use_statementsfixer now addsBaseif extended class has same name as its parent.
Paysera/php_basic_feature_return_and_argument_typesnow supports configuration of whitelisted classes, which presence in@returnor@paramDocBlock will not trigger this fixer:
'Paysera/php_basic_feature_return_and_argument_types' => [
'whitelist' => ['ArrayCollection'],
],Old configuration is still valid: 'Paysera/php_basic_feature_return_and_argument_types' => true,
this will result in same configuration as above.
\Paysera\PhpCsFixerConfig\Config\PayseraConventionsConfignow provides methods for predefined configurations.Paysera/php_basic_code_style_method_namingfixer now ignoresprocessandhandlepatterns.Paysera/php_basic_feature_type_hintingfixer now skips if typehint starts withRepository
Paysera/psr_1_file_side_effectsnow supports configuration of forbidden functions and tokens, i.e.:
'Paysera/psr_1_file_side_effects' => [
'functions' => ['print_r', 'var_dump', 'ini_set'],
'tokens' => [T_ECHO, T_INCLUDE]
],Old configuration is still valid: 'Paysera/psr_1_file_side_effects' => true,
this will result in same configuration as above.
Paysera/php_basic_feature_visibility_propertiesnow supports configuration of Parent class names where in Children classes it is allowed to usepublicorprotectedproperties. This is useful in Symfony Validation Constraints, i.e.:
'Paysera/php_basic_feature_visibility_properties' => [
'Constraint'
],Old configuration is still valid: 'Paysera/php_basic_feature_visibility_properties' => true,
this will result in same configuration as above.
Paysera/php_basic_code_style_class_namingnow supports valid and invalid Class suffixes, i.e.:
'Paysera/php_basic_code_style_class_naming' => [
'valid' => [
'Registry',
'Factory',
'Client',
'Plugin',
'Proxy',
'Interface',
'Repository',
],
'invalid' => [
'Service'
]
],Old configuration is still valid: 'Paysera/php_basic_code_style_class_naming' => true,
this will result in same configuration as above.
Paysera/php_basic_feature_type_hintingnow supports configuration of exceptions which usage does not require the narrowest scope. This is useful in Symfony Validation Constraints, i.e.:
'Paysera/php_basic_feature_type_hinting' => [
'EntityManager'
],Old configuration is still valid: 'Paysera/php_basic_feature_type_hinting' => true,
this will result in same configuration as above.
Paysera/php_basic_feature_unnecessary_variablesnow supports configuration of methods, call of which will disable the fix. This is useful in Symfony Validation Constraints, i.e.:
'Paysera/php_basic_feature_unnecessary_variables' => [
'flush'
],Old configuration is still valid: 'Paysera/php_basic_feature_unnecessary_variables' => true,
this will result in same configuration as above.
Paysera/php_basic_code_style_namespaces_and_use_statementsnow parses namespaces in docBlocks only if preceded by:@throws@param@return@returns@var
- Support of
PHP5.5