Skip to content
CAI
Software that uses CAICheck a score

rectorphp/rector

64.6

Adequate · 26 September 2026

120.6k

lines of production code

PHP

primary language

3

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is Rector, a PHP static analysis and refactoring tool that automatically upgrades codebases and enforces coding standards. It operates by applying a vast library of rules to transform source code, handling tasks such as migrating to newer PHP versions, simplifying code quality patterns, removing dead code, and modernizing syntax like attributes and first-class callables. The tool supports both local and global installation, utilizes PHPStan for type inference, and provides a centralized configuration system to manage rule sets and execution behavior.

How it got here

2017–2021 — Rector 2.0 architecture and rule expansion

255 changes.

This period focused on a major architectural overhaul of Rector, migrating the core engine to PHP 7.4+ and PHP-Parser 5 while replacing the Symfony dependency injection container with a custom factory. The configuration system was modernized with a fluent API and predefined refactoring levels, and the bootstrap process was rewritten for scoped installations. Concurrently, the project significantly expanded its rule sets, introducing extensive code quality, dead code removal, coding style, and naming conventions transformations alongside comprehensive PHP version migration rules.

2022–2025 — PHP version migration and infrastructure modernization

118 changes.

This period focused on expanding Rector's rule set to support migrations across PHP 5.4 through 8.5, including significant updates for PHP 8.1 strict typing, PHP 8.2 readonly classes, and PHP 8.3/8.4/8.5 deprecations. The project also overhauled its internal architecture by introducing parallel processing, a new caching system, modular type resolution, and enhanced PHPDoc parsing to improve performance and analysis accuracy.

2026 — PHP 8.5/8.6 support and code quality rules

13 changes.

This period focused on introducing Rector rules for upcoming PHP 8.5 and 8.6 features, such as the \#\[Override\] attribute for properties and the clamp() function. It also expanded code quality and dead code removal capabilities with new rules for named arguments, inner function hoisting, and redundant type checks, while deprecating unsafe transformations like the coalesce-to-ternary conversion.

Features

Add \#\[Override\] attribute to overridden properties in PHP 8.5+

A new Rector rule, AddOverrideAttributeToOverriddenPropertiesRector, has been introduced for PHP 8.5 and later. This rule automatically adds the \#\[Override\] attribute to class properties that override properties from a parent class, helping to ensure explicit intent and catch errors when the parent property is removed or renamed. The rule respects existing \#\[Override\] attributes and skips private properties.

rules/Php85/Rector/Property · high confidence

Add CleanupUnneededNullsafeOperatorRector to remove redundant nullsafe operators

A new Rector rule, CleanupUnneededNullsafeOperatorRector, has been added to the CodeQuality ruleset. This rule automatically refactors code by replacing the nullsafe operator (-\>?) with the standard method call operator (-\>) when the preceding expression is guaranteed to return a non-null object (e.g., when the return type is strictly defined as an object and not nullable). This helps clean up code that no longer needs null-safety checks after the initial null check has been satisfied.

rules/CodeQuality/Rector/NullsafeMethodCall · high confidence

Add IsIterableRector to simplify type checks in PHP 7.1+

A new rector rule has been added to the Php71 set that automatically refactors the common pattern of checking if a variable is an array or implements Traversable (e.g., \is\_array($foo) \|\| $foo instanceof Traversable\) into the single, cleaner \is\_iterable($foo)\ function. This change is only applied when the target PHP version supports the \is\_iterable\ function (PHP 7.1+), ensuring backward compatibility while modernizing codebases.

rules/Php71/Rector/BooleanOr · high confidence

Add PHP 4 constructor to \_\_construct migration rule

A new rector rule, Php4ConstructorRector, has been added to the Php70 ruleset. This tool automatically updates legacy PHP 4-style class constructors (methods named after the class) to the modern PHP 5+ \_\_construct standard. It handles renaming the method, updating parent constructor calls within the class, and removing delegating calls to the old constructor name, ensuring code is compatible with PHP 7.0 and later.

rules/Php70/Rector/ClassMethod · high confidence

Add PHP 5.4 short array syntax rector

A new rector rule has been added to automatically convert long array syntax (e.g., \array()\) to short array syntax (\\[\]\) in PHP 5.4+ code. This change modernizes array declarations, improving code readability and aligning with modern PHP standards.

rules/Php54/Rector/Array\ · high confidence_

Add PHP 7.3 is\_countable() rector rule

A new rector rule has been added to automatically refactor code patterns that check if a variable is an array or implements the Countable interface (e.g., \is\_array($foo) \|\| $foo instanceof Countable\) into the native PHP 7.3 \is\_countable($foo)\ function. This change simplifies code and improves compatibility for projects upgrading to PHP 7.3 or later.

rules/Php73/Rector/BooleanOr · high confidence

Add PHP 7.4 null coalescing assignment rector

A new rector rule has been added to automatically convert null-guarding if-statements with single assignments into the PHP 7.4 null coalescing assignment operator (??=). This applies to patterns such as checking if a variable is not set via isset(), is\_null(), or strict null comparison, and then assigning a value, allowing users to modernize their codebase to use more concise syntax available in PHP 7.4 and later.

rules/Php74/Rector/If\ · high confidence_

Add PHP 8.2 deprecation fix for deprecated string interpolation syntax

A new rector rule, VariableInStringInterpolationFixerRector, has been added to automatically replace the deprecated \${var}\ syntax in interpolated strings with the standard \{$var}\ syntax, ensuring compatibility with PHP 8.2's deprecation of the former.

rules/Php82/Rector/Encapsed · high confidence

Add PHP 8.2 readonly class rector

A new rector rule has been added to automatically decorate classes with the \readonly\ attribute when they are defined as final and contain only readonly properties. This feature is available for projects targeting PHP 8.2 and later, helping to enforce immutability at the class level.

rules/Php82/Rector/Class\ · high confidence_

Add RenameAnnotationRector for refactoring PHPDoc annotations

A new Rector rule, RenameAnnotationRector, has been added to the rules/Renaming/Rector/ClassMethod directory. This tool allows users to automatically rename specific PHPDoc annotations (such as changing @test to @scenario) on class methods, properties, and expressions by configuring a list of old-to-new annotation mappings.

rules/Renaming/Rector/ClassMethod · high confidence

Add RenameAttributeRector for renaming PHP attributes

A new rector rule, RenameAttributeRector, has been added to the Renaming package. This tool allows users to automatically rename PHP attribute class names (e.g., changing \#\[SimpleRoute\] to \#\[BasicRoute\]) by configuring a list of old-to-new attribute mappings. It targets attributes on classes, methods, properties, and parameters, requiring PHP 8.0 or later.

rules/Renaming/Rector/Class\ · high confidence_

Add RenameFunctionRector to rename PHP function calls

A new Rector rule, RenameFunctionRector, has been added to the rules/Renaming/Rector/FuncCall directory. This rule allows users to automatically rename specific PHP function calls by configuring a mapping of old function names to new ones (e.g., changing 'view' to 'Laravel\\Templating\\render'). It works by detecting FuncCall nodes in the AST and replacing their names according to the provided configuration, supporting both simple function names and fully qualified names.

rules/Renaming/Rector/FuncCall · high confidence

Add RenamePropertyRector to rename class properties

A new Rector rule, RenamePropertyRector, has been added to the rules/Renaming/Rector/PropertyFetch directory. This rule allows users to automatically rename existing properties within classes by configuring a list of old-to-new property mappings. It handles both instance property fetches and static property fetches, ensuring that the property name is updated in usage sites and, if the class structure permits, the property declaration itself is renamed.

rules/Renaming/Rector/PropertyFetch · high confidence

Add RenameStaticMethodRector for renaming static method calls

A new rector rule, RenameStaticMethodRector, has been added to the rules/Renaming/Rector/StaticCall directory. This tool allows users to automatically rename static method calls, optionally changing both the method name and the class it belongs to, by configuring a list of RenameStaticMethod value objects.

rules/Renaming/Rector/StaticCall · high confidence

Add RenameStringRector for configurable string value replacement

A new RenameStringRector has been added to the renaming rules, allowing users to configure specific string literal replacements. When applied, this rector scans code for string values matching the configured keys and replaces them with their corresponding target values, enabling automated updates of hardcoded strings such as role names or configuration constants.

rules/Renaming/Rector/String\ · high confidence_

Add SensitiveHereNowDocRector to rename conflicting heredoc/nowdoc labels

A new rector rule has been added that detects heredoc and nowdoc strings where the closing label appears inside the string content, which would cause a syntax error in PHP 7.3+. To fix this, the rule automatically renames the closing label by appending a suffix (e.g., changing 'A' to 'A\_WRAP' or 'A\_1') to ensure uniqueness and valid syntax.

rules/Php73/Rector/String\ · high confidence_

Add StringToClassConstantRector to replace string literals with class constants

A new rector rule, StringToClassConstantRector, has been added to the Transform/Rector/String\_ directory. This rule allows users to automatically replace specific string literals with corresponding class constant references (e.g., converting 'compiler.post\_dump' to \\Yet\\AnotherClass::CONSTANT) by configuring a list of StringToClassConstant mappings.

rules/Transform/Rector/String\ · high confidence_

Add parentheses to nested ternary operators in PHP 7.4+

A new rector rule, ParenthesizeNestedTernaryRector, has been added to automatically wrap nested ternary expressions in parentheses. This change targets code running on PHP 7.4 and later, where nested ternaries are deprecated. The rule detects ternary operators where the condition or the 'else' branch is itself a ternary and adds explicit parentheses to clarify precedence, ensuring the code remains valid and readable under stricter PHP 7.4+ standards. Short-ternary (Elvis operator) chaining is intentionally left unchanged as it behaves predictably.

rules/Php74/Rector/Ternary · high confidence

Add rector to convert MyCLabs Enum constructor calls to static from() method

A new rector rule has been added to automatically refactor instantiation of MyCLabs Enum classes. When using PHP 8.1 or later, code that creates an enum instance via the constructor (e.g., \new Enum($args)\) will be transformed to use the static \from()\ method (e.g., \Enum::from($args)\), aligning with modern enum best practices.

rules/Php81/Rector/New\ · high confidence_

Add rector to fix PHP 7.1 binary operations between numbers and strings

A new rector rule has been added that automatically converts binary operations mixing numbers and strings (e.g., \5 + ''\ or \5.0 + 'hi'\) into PHP 7.1-compatible numeric equivalents (e.g., \5 + 0\ or \5.0 + 0.0\). This ensures code compatibility with PHP 7.1, where such operations behave differently than in later versions, by replacing non-numeric string operands with zero.

rules/Php71/Rector/BinaryOp · high confidence

Add rector to remove deprecated (unset) cast

A new \UnsetCastRector\ has been added to the Php72 ruleset. This rector automatically removes the deprecated \(unset)\ cast operator, converting expressions like \$value = (unset) $value\ into \unset($value)\ and standalone casts to \null\ assignments, ensuring compatibility with PHP versions where the unset cast is removed.

rules/Php72/Rector/Unset\ · high confidence_

Add rector to remove unused private class constants

A new Rector rule, RemoveUnusedPrivateClassConstantRector, has been added to automatically remove private class constants that are not referenced anywhere in the code. This tool helps clean up dead code by identifying and deleting private constants that serve no purpose, improving code maintainability. The rule specifically targets private constants within classes, ensuring that only truly unused constants are removed while preserving those that are still in use.

rules/DeadCode/Rector/ClassConst · high confidence

Add rector to replace ReflectionFunction::export() with constructor

A new rector rule has been added to automatically refactor calls to the deprecated ReflectionFunction::export() method. For users upgrading to PHP 7.4+, this change converts static export calls into direct ReflectionFunction instantiation, handling both object and string return cases to ensure compatibility with the removal of the export method.

rules/Php74/Rector/StaticCall · high confidence

Add rector to replace \_\_CLASS\_\_ with self::class

A new PHP 5.5 rector rule has been added that automatically replaces the \\_\CLASS\\_\ magic constant with the \self::class\ syntax. This change modernizes class name resolution, ensuring that the class name is resolved statically rather than as a string, which is particularly useful for refactoring codebases to PHP 5.5+ standards.

rules/Php55/Rector/Class\ · high confidence_

Add rector to replace curly bracket array/string access with square brackets

A new rector rule, CurlyToSquareBracketArrayStringRector, has been added to automatically convert deprecated curly bracket syntax for array and string dimension fetching (e.g., $string{0}) to the standard square bracket syntax ($string\[0\]). This change aligns code with PHP 7.4+ standards where curly bracket access is deprecated, ensuring cleaner and more compatible code during refactoring.

rules/Php74/Rector/ArrayDimFetch · high confidence

Add rector to replace deprecated $HTTP\_\* variables with superglobals

A new rector rule has been added to automatically rename deprecated PHP variables (such as $HTTP\_SERVER\_VARS, $HTTP\_GET\_VARS, etc.) to their modern superglobal equivalents (like $\_SERVER, $\_GET, etc.). This change helps users migrate legacy code to comply with PHP 5.3+ standards by updating variable references during the refactoring process.

rules/Php53/Rector/Variable · high confidence

Add rector to replace get\_class() with ::class syntax

A new PHP 8.0 rector rule has been added that automatically refactors calls to the \get\_class($object)\ function into the more performant \$object::class\ syntax. This change improves code performance and modernizes the codebase for PHP 8.0+ environments, while safely handling edge cases such as first-class callables and missing arguments.

rules/Php80/Rector/FuncCall · high confidence

Add rule to normalize inequality operators

A new Rector rule, CommonNotEqualRector, has been introduced to standardize code by replacing the less common inequality operator (\<\>) with the more widely recognized operator (!=). This change ensures that code quality checks will automatically refactor these comparisons to use the standard syntax.

rules/CodeQuality/Rector/NotEqual · high confidence

Added ClassMethodVisibilityGuard to check parent and trait method visibility

A new ClassMethodVisibilityGuard class has been introduced in the Privatization/VisibilityGuard namespace. This component provides logic to determine if a class method's visibility is effectively guarded by its parent classes or traits, ensuring that privatization rules respect existing method signatures defined in the inheritance hierarchy.

rules/Privatization/VisibilityGuard · high confidence

Added Ereg to PCRE transformer for PHP 7.0 migration

The Php70 ruleset now includes an EregToPcreTransformer class and a corresponding InvalidEregException. This addition enables the automatic conversion of legacy ereg regular expressions to the modern PCRE format, a necessary step for codebases migrating to PHP 7.0 where ereg functions were removed.

rules/Php70 · high confidence

Added JMS Type property type factory for improved type inference

A new JMSTypePropertyTypeFactory class has been introduced to handle type declarations for JMS serializer properties. This factory improves type inference by correctly mapping scalar types like 'float' and 'string' to their appropriate PHP types, including handling cases where a float is represented as a string or vice versa. It also ensures that generic iterable types are skipped and that only valid class types are mapped, enhancing the accuracy of type declarations in code processed by Rector.

rules/TypeDeclaration/NodeFactory · high confidence

Added ListAndEach value object for PHP 7.2 rules

A new value object, ListAndEach, has been introduced in the Php72 rules directory to encapsulate the relationship between a list expression and an each() function call. This class provides a structured way to handle transformations involving these specific PHP constructs, supporting the refactoring logic for PHP 7.2 compatibility.

rules/Php72/ValueObject · high confidence

Added MagicPropertyHandler constants for enum transformation rules

A new MagicPropertyHandler class has been introduced in the Transform/Enum rules to define standard string constants (get, set, exists, unset) used for handling magic property transformations. This provides a centralized reference for these specific transformation patterns within the enum handling logic.

rules/Transform/Enum · high confidence

Added PHP version level configuration sets up to PHP 8.6

New configuration files have been added to the \config/set/level\ directory, providing predefined sets for upgrading code to PHP versions 5.3 through 8.6. Each file configures the Rector tool to apply the specific version's rules along with the cumulative set of rules from the previous version (e.g., the PHP 8.6 set includes rules up to PHP 8.5), enabling users to easily target their codebase for a specific PHP version upgrade.

config/set/level · high confidence

Added Rector configuration and APPPATH constant definition for e2e/define-constant

The e2e/define-constant area now includes a Rector configuration file (rector.php) that targets the src directory and applies the CODE\_QUALITY set, alongside a new PHP source file (DefineConstant.php) that defines the APPPATH constant if it is not already set.

e2e/define-constant · high confidence

Added Rector configuration and CI templates

New templates have been added to scaffold Rector static analysis setups, including a distribution configuration file (rector.php.dist) that sets code quality and dead code levels to zero, GitHub and GitLab CI workflow templates to automatically detect and commit fixes on pull requests and merge requests, and starter templates for creating custom Rector rules with their corresponding test fixtures and PHPUnit test classes.

templates · high confidence

Added RegexMatcher to detect and remove deprecated 'e' modifier in PHP 5.5+ code

A new RegexMatcher class has been introduced in the Php55 rules to identify regular expression patterns containing the deprecated 'e' (eval) modifier. This helper resolves pattern expressions from string literals and concatenations, stripping the 'e' modifier to prevent parse errors or security risks when upgrading to PHP versions where this modifier is removed. It supports various delimiters and validates modifiers against the standard set, ensuring that only patterns with the 'e' modifier are flagged for transformation.

rules/Php55 · high confidence

Added RenameSimpleRector utility for testing variable renaming

A new Rector rule, RenameSimpleRector, has been added to the e2e test utilities. This rule targets PHP variable nodes and renames them to 'newValue', providing a concrete example for testing Rector's code transformation capabilities in the prefixed rule test suite.

e2e/rector-prefixed-rule-test/utils/rector · high confidence

Added TwoNodeMatch value object for PHP 7.1 rules

A new \TwoNodeMatch\ value object has been introduced in the \Rector\\Php71\\ValueObject\ namespace to encapsulate pairs of PHP expressions. This class provides a structured way to handle two related expression nodes, likely supporting refactoring logic within the PHP 7.1 rule set by allowing rules to operate on matched pairs of code elements.

rules/Php71/ValueObject · high confidence

Added constant classes for Nette and PHPUnit/Codeception class names

New helper classes NetteClassName and TestClassName have been added to the Enum rule set to centralize string constants for specific framework classes. NetteClassName provides the JSON utility class path, while TestClassName defines constants for PHPUnit and Codeception data provider attributes, supporting more accurate type declaration docblock generation for these testing and utility libraries.

rules/TypeDeclarationDocblocks/Enum · high confidence

Added dump\_node() helper function for debugging

A new \dump\_node()\ helper function has been added to \src/functions/node\_helper.php\ to assist with debugging. This function utilizes Rector's internal \NodePrinter\ and Symfony console styling to output PHP AST nodes with verbose formatting, making it easier to inspect node structures during development or testing.

src/functions · high confidence

Added enum for native function argument positions

A new constant class NativeFuncCallPositions has been introduced to define the specific argument positions for array and callback parameters in native PHP functions such as array\_walk, array\_map, usort, and array\_filter. This data structure supports type declaration rules by providing a centralized reference for how these functions expect their arguments to be ordered.

rules/TypeDeclaration/Enum · high confidence

Added factory classes for creating ParamRename and PropertyRename value objects

New factory classes, ParamRenameFactory and PropertyRenameFactory, have been added to the Naming rules to encapsulate the creation of ParamRename and PropertyRename value objects. These factories handle the resolution of current node names and validate inputs (such as checking for errors in parameters or catching invalid argument exceptions for properties) before instantiating the respective rename value objects, centralizing this logic for the naming rules.

rules/Naming/ValueObjectFactory · high confidence

Added global-install e2e test fixture with Rector configuration

Added a new end-to-end test fixture at e2e/global-install that includes a Rector configuration file (rector.php) enforcing coding style rules, a custom exception class (MyException) implementing a local interface, and a relocated .gitignore. This setup provides a self-contained environment for testing global installation scenarios and code transformation tools.

e2e/global-install · high confidence

Added helper to detect parenthesized nested ternary operators

A new \ParenthesizedNestedTernaryAnalyzer\ class has been introduced in the \rules/Php74/Tokenizer\ directory. This utility inspects token positions to determine if a ternary expression is wrapped in parentheses, enabling more accurate detection of nested ternary patterns that require specific handling in PHP 7.4+ code transformations.

rules/Php74/Tokenizer · high confidence

Added native call return type filtering logic

Introduced a new \ExclusiveNativeCallLikeReturnMatcher\ class within the \TypeDeclaration\ rule set. This component analyzes return statements to identify and filter those that exclusively return values from native PHP functions or methods, enabling more precise type declaration inference for built-in language constructs.

rules/TypeDeclaration/NodeAnalyzer/ReturnFilter · high confidence

Added property rename guard with specific skip conditions

A new PropertyRenameGuard class has been introduced to determine when property renaming should be skipped. It prevents renaming of private properties, properties typed as Ramsey\\Uuid\\UuidInterface, and cases where naming conflicts exist with DateTime conventions or magic get/set methods.

rules/Naming/RenameGuard · high confidence

Added rule documentation generation contracts and value objects

The vendor/symplify/rule-doc-generator-contracts package now includes the core interfaces and value objects required for generating documentation for Rector rules. This adds the DocumentedRuleInterface for marking rules, the CategoryInfererInterface for categorization, and the CodeSampleInterface hierarchy (including AbstractCodeSample, CodeSample, ConfiguredCodeSample, ComposerJsonAwareCodeSample, and ExtraFileCodeSample) to define before/after code examples. It also introduces the RuleDefinition value object to hold rule descriptions and samples, along with RuleCodeSamplePrinterInterface for rendering and specific exceptions like PoorDocumentationException.

vendor/symplify/rule-doc-generator-contracts · high confidence

Added value objects for code quality rules

New value objects have been introduced to support code quality transformations: \ComparedExprAndValueExpr\ pairs comparison expressions with their values, \DefinedPropertyWithType\ links property names to their types and defining methods, and \ExplicitBoolCondition\ captures boolean conditions along with their negation state. These classes provide structured data containers for the underlying refactoring logic.

rules/CodeQuality/ValueObject · high confidence

Auto-add null defaults to nullable typed properties

A new rector rule, RestoreDefaultNullToNullableTypePropertyRector, has been added to automatically assign a null default value to class properties that use PHP 7.4 nullable type declarations (e.g., changing \public ?string $name;\ to \public ?string $name = null;\). This transformation applies only to single-property declarations that are not readonly, do not already have a default value, and are not conditionally assigned in the constructor, ensuring code compatibility and explicit initialization for nullable types.

rules/Php74/Rector/Property · high confidence

Auto-convert array key/value access to new PHP 8.5 functions

A new rector rule has been added that automatically refactors PHP code to use the new \array\_first()\ and \array\_last()\ functions introduced in PHP 8.5. Specifically, patterns like \$array\[array\_key\_first($array)\]\ and \$array\[array\_key\_last($array)\]\ are converted to \array\_first($array)\ and \array\_last($array)\, and index-based access on \array\_values()\ results (e.g., \array\_values($array)\[0\]\ or \array\_values($array)\[count($array) - 1\]\) are similarly simplified. This change improves code readability and performance for users upgrading to PHP 8.5.

rules/Php85/Rector/ArrayDimFetch · high confidence

Auto-rename catch variables to match exception type

The new CatchExceptionNameMatchingTypeRector rule automatically renames catch block variables so their names match the exception type they handle (e.g., renaming $typoException to $someException when catching SomeException). This improves code readability and consistency by ensuring variable names accurately reflect the exception class.

rules/CodingStyle/Rector/Catch\ · high confidence_

Auto-typed class constants in PHP 8.3+

A new rector rule, AddTypeToConstRector, has been added to automatically infer and add type declarations to class constants based on their assigned values. For PHP 8.3 and later, this tool will analyze constants in classes and append the appropriate type (such as string, int, float, array, or null) to the constant definition if it is missing, while also cleaning up redundant PHPDoc var tags. This helps modernize codebases by leveraging PHP 8.3's typed class constants feature.

rules/Php83/Rector/ClassConst · high confidence

Automated conversion of $this-\> calls to static methods into static calls

A new rector rule in the Php70 set now detects and transforms calls like \$this-\>staticMethod()\ into \static::staticMethod()\ (or \self::\ for final classes) when the method is defined as static. This helps modernize codebases by removing invalid non-static calls to static methods, which is a common source of deprecation warnings or errors in PHP 7.0 and later. The transformation respects class finality and PHPUnit test cases, ensuring safe refactoring.

rules/Php70/Rector/MethodCall · high confidence

Automated conversion of list() to array destructuring syntax

The new ListToArrayDestructRector automatically transforms legacy list() constructs into modern array destructuring syntax (e.g., converting list($a, $b) = $data to \[$a, $b\] = $data). This change applies to both standard assignments and foreach loops, but only when all list items are explicitly set, ensuring that partial destructuring patterns are left untouched to maintain existing behavior.

rules/Php71/Rector/List\ · high confidence_

Automated conversion of pow() calls to the \*\* operator

A new rector rule in the Php56 set now automatically replaces calls to the \pow()\ function with the native \\\\ (exponentiation) operator. This change simplifies code syntax for PHP 5.6+ environments and ensures correct operator precedence by wrapping operands in parentheses when necessary to preserve original semantics.

rules/Php56 · high confidence

Automated fix for deprecated null returns in \_\_debugInfo methods

A new rector rule has been added to automatically replace \null\ return values in \\_\debugInfo\ methods with empty arrays. This addresses the PHP 8.5 deprecation where returning \null\ from \\\_debugInfo\ is no longer allowed, ensuring code remains compatible with the upcoming version by transforming \return null;\ into \return \[\];\.

rules/Php85/Rector/ClassMethod · high confidence

Automated fix for deprecated semicolon syntax in switch case statements

A new rector rule, ColonAfterSwitchCaseRector, has been added to automatically replace the deprecated semicolon (;) with a colon (:) at the end of switch case conditions. This change targets PHP 8.5+ codebases, ensuring that switch statements conform to the updated syntax requirements where semicolons are no longer valid terminators for case labels.

rules/Php85/Rector/Switch\ · high confidence_

Automated migration from deprecated \_\_sleep/\_\_wakeup to \_\_serialize/\_\_unserialize in PHP 8.5

Rector now includes new rules that automatically refactor classes using the deprecated PHP 8.5 \_\sleep() and \\wakeup() magic methods to the modern \\serialize() and \\unserialize() interfaces. The \\sleep() to \\serialize() rule transforms array-based property lists into explicit key-value assignments, while the \\wakeup() to \\_unserialize() rule generates a loop that safely restores properties from the provided data array, ensuring compatibility with PHP 8.5's deprecation of the legacy serialization methods.

rules/Php85/Rector/Class\ · high confidence_

Automated migration of deprecated each() loops to foreach

A new rector rule in the Php72 set automatically refactors while loops that use the deprecated each() function into modern foreach constructs. This change helps users update their codebases to comply with PHP 7.2+ standards by replacing patterns like while (list($key, $value) = each($array)) with foreach ($array as $key =\> $value), ensuring compatibility and removing deprecation warnings.

rules/Php72/Rector/While\ · high confidence_

Automated migration of deprecated utf8\_decode/encode to mb\_convert\_encoding

A new rector rule has been added to automatically replace the deprecated \utf8\_decode()\ and \utf8\_encode()\ functions with \mb\_convert\_encoding()\. This change ensures code compatibility with PHP 8.2+ by converting \utf8\_decode($value)\ to \mb\_convert\_encoding($value, 'ISO-8859-1')\ and \utf8\_encode($value)\ to \mb\_convert\_encoding($value, 'UTF-8', 'ISO-8859-1')\, removing reliance on functions that are no longer supported in modern PHP versions.

rules/Php82/Rector/FuncCall · high confidence

Automated migration of dirname(\_\_FILE\_\_) to \_\_DIR\_\_

A new rector rule has been added to automatically convert the deprecated \dirname(\_\FILE\\)\ pattern to the modern \\\DIR\\_\ magic constant. This change simplifies code for users targeting PHP 5.3 and above, ensuring that file path references use the more efficient and readable constant introduced in PHP 5.3.

rules/Php53/Rector/FuncCall · high confidence

Automated migration of legacy \`var\` property declarations to \`public\`

A new rector rule has been added to automatically update PHP 5.2-style property declarations that use the \var\ keyword to the modern \public\ modifier. This change ensures codebases are upgraded to use explicit visibility modifiers, improving code clarity and compatibility with current PHP standards.

rules/Php52/Rector/Property · high confidence

Automated migration of strpos/strstr to str\_contains

Rector now includes new rules that automatically replace legacy string position checks (strpos() !== false, strstr() comparisons) with the modern str\_contains() function available in PHP 8.0. This applies to both standard string functions and their multibyte counterparts (mb\_strpos, mb\_strstr), ensuring code is updated to use the more readable and performant native method.

rules/Php80/Rector/NotIdentical · high confidence

Automated migration to json\_validate() in PHP 8.3

A new rector rule in the Php83 category automatically replaces the verbose pattern of checking \json\_decode()\ results with \json\_last\_error()\ by the native \json\_validate()\ function. This behavioral change simplifies JSON validation code for users upgrading to PHP 8.3, provided the original call uses compatible depth and flag arguments.

rules/Php83/Rector/BooleanAnd · high confidence

Automatic PHP version detection from composer.json

Rector now automatically determines the target PHP version by reading the 'php' requirement or 'platform.php' config from the project's composer.json file. This new capability is implemented via the PhpVersionProvider and ComposerJsonPhpVersionResolver classes, which parse the composer manifest to infer the correct PHP version features, falling back to the current runtime version if no configuration is found. Additionally, a PolyfillPackagesProvider has been added to detect symfony/polyfill packages in the project dependencies, and a ReservedKeywordAnalyzer is introduced to correctly identify native superglobal variables.

src/Php · high confidence

Automatic conversion of closures to arrow functions in PHP 7.4+

The new ClosureToArrowFunctionRector automatically transforms simple anonymous closures into PHP 7.4 arrow functions (e.g., converting function ($x) { return $x; } to fn($x) =\> $x). This reduces boilerplate and improves code readability for compatible PHP versions, provided the closure body consists of a single return statement and does not rely on complex variable scoping.

rules/Php74/Rector/Closure · high confidence

Convert break statements outside loops to return

A new rector rule has been added to handle \break\ statements used outside of loop or switch contexts. In PHP 7.0 and later, such usage is invalid; this rule automatically converts a \break\ inside an \if\ block to a \return\ statement, and removes \break\ statements in other non-loop contexts, ensuring code compatibility with modern PHP versions.

rules/Php70/Rector/Break\ · high confidence_

Dead code removal for redundant filter\_var calls on typed variables

A new Rector rule has been added that automatically removes redundant filter\_var() validation calls when the input variable already has a strict type declaration. Specifically, if a variable is already typed as int, float, or bool, calls like filter\_var($value, FILTER\_VALIDATE\_INT) are simplified to just the variable itself, as the type check is already enforced by the type system.

rules/DeadCode/Rector/FuncCall · high confidence

Introduce AbstractRector as the core base class for all code transformations

The new src/Rector/AbstractRector.php file establishes the foundational base class for all Rector rules. It implements the PhpParser NodeVisitorAbstract interface and provides the central enterNode() logic that drives the refactoring process. This class handles dependency injection for essential services (like NodeNameResolver, NodeTypeResolver, and Skipper), manages the skipper logic to avoid redundant processing, and coordinates the actual node transformation via the refactor() method. It also integrates with the ChangedNodeScopeRefresher to ensure type information remains valid after changes, and provides helper methods like isName() and isNames() for rule authors.

src/Rector · high confidence

Introduce DefaultDiffer using SebastianBergmann diff library

A new DefaultDiffer class has been added to the src/Differ location, wrapping the SebastianBergmann Diff library to provide unified diff output. This component initializes a StrictUnifiedDiffOutputBuilder configured with 'Original' and 'New' file labels, allowing users to generate standardized diff strings between old and new code content.

src/Differ · high confidence

Introduce MatchKind enum for PHP 8.0 match expression transformations

Added a new \MatchKind\ class in the \rules/Php80/Enum\ directory to define specific transformation modes (normal, assign, return, throw) for PHP 8.0 match expression rules. This constant class provides a structured way to handle different contexts when refactoring match expressions, ensuring consistent behavior across the various code transformation rules that rely on this location.

rules/Php80/Enum · high confidence

Introduce PHPStan Static Type Mapper architecture

Rector now uses a new \PHPStanStaticTypeMapper\ system to convert PHPStan internal types into PHPDoc and PHP parser nodes. This change introduces a \TypeMapperInterface\ and a central dispatcher that delegates to specific mappers (e.g., \ArrayTypeMapper\, \ObjectTypeMapper\, \BooleanTypeMapper\) based on the type class. This architecture allows for more precise control over type representation, such as handling PHP version-specific scalar types and complex union/intersection logic, replacing the previous ad-hoc conversion methods.

src/PHPStanStaticTypeMapper · high confidence

Introduce PhpDoc variable tag renaming capability

A new \VarTagValueNodeRenamer\ class has been added to the \Rector\\Naming\\PhpDoc\ namespace. This component enables the system to update variable names within \@var\ PHPDoc tags when the underlying variable is renamed, ensuring that documentation stays consistent with code changes.

rules/Naming/PhpDoc · high confidence

Introduce new StaticTypeMapper component for PHP/PHPStan type conversion

A new StaticTypeMapper component has been added to handle the mapping between PHP-Parser AST nodes, PHPStan types, and PHPDoc type nodes. This includes a central StaticTypeMapper class, contract interfaces for PhpDoc and PhpParser mappers, and specific mapper implementations for handling scalar strings, union/intersection/nullable types, and class references (including self, parent, and static). The component also introduces value objects for various object types (FullyQualified, Aliased, Shortened, etc.) to support precise type representation during static analysis and code transformation.

src/StaticTypeMapper · high confidence

Introduce new configuration API and predefined refactoring levels

The configuration system has been restructured to provide a modern, fluent entry point via the new \RectorConfig\ class and \RectorConfigBuilder\, replacing the legacy \src/config/services.yml\ and \ParserFactory\. This change introduces five predefined, ordered rule sets—\CodeQualityLevel\, \CodingStyleLevel\, \DeadCodeLevel\, \TypeDeclarationLevel\, and \TypeDeclarationDocblocksLevel\—allowing users to apply curated batches of refactoring rules (e.g., \withCodeQualityLevel()\) instead of manually registering individual rectors. The new API also supports advanced configuration features such as rule skipping, parallel processing, and PHPStan integration.

src/Config · high confidence

Introduce new file-based caching system for Rector

Rector now includes a new caching layer in the src/Caching directory to speed up subsequent runs. This change introduces a CacheFactory and Cache class that manage file-based storage (FileCacheStorage), a ChangedFilesDetector to track file modifications and invalidate cache when configuration or source files change, and an UnchangedFilesFilter to skip processing files that haven't changed since the last run. The system uses file hashes and configuration snapshots to ensure cache validity, significantly reducing execution time for repeated operations.

src/Caching · high confidence

Introduce new value objects for configuration, file processing, and error reporting

The \src/ValueObject\ directory now contains a comprehensive set of new value objects that structure how Rector handles application state and reporting. \Configuration\ centralizes run settings such as dry-run mode, output format, parallel execution options, and rule filters. \File\ and \FileProcessResult\ manage file-level state, tracking content changes, AST statements, and diffs. \ProcessResult\ aggregates the overall outcome, including file diffs and system errors. \SystemError\ provides structured error reporting with file and line context, while \LevelOverflow\ captures configuration level details. Additionally, \PhpVersion\ and \PhpVersionFeature\ define constants for PHP version support and feature availability, and \PolyfillPackage\ maps versions to their corresponding Symfony polyfill packages.

src/ValueObject · high confidence

Introduce specialized expected-name resolvers for properties and parameters

The \rules/Naming/ExpectedNameResolver\ directory now includes three new classes that refine how Rector determines the expected name for code elements. \MatchPropertyTypeExpectedNameResolver\ derives the expected name for class properties by inspecting their PHP type declarations or \@var\ docblock tags, while \MatchParamTypeExpectedNameResolver\ performs the same derivation for function/method parameters. To support these, \InflectorSingularResolver\ was added to handle the linguistic logic of converting plural or compound variable names into their singular base forms, including handling specific exceptions like 'news' and camel-case boundaries.

rules/Naming/ExpectedNameResolver · high confidence

Introduces DynamicSourceLocatorDecorator for dynamic path resolution

A new DynamicSourceLocatorDecorator class has been added to the StaticReflection component. This class acts as a wrapper around the DynamicSourceLocatorProvider, handling the resolution of file and directory paths via the FilesystemTweaker and FileAndDirectoryFilter before registering them. This enables the static reflection system to dynamically locate and analyze source files and directories at runtime, supporting zero-config analysis scenarios.

src/StaticReflection · high confidence

Introduces PhpDoc node traversal and visitor infrastructure

Adds a new PhpDoc node traversal system to the PhpDocParser component, mirroring the visitor pattern from nikic/PHP-Parser. This includes a PhpDocNodeTraverser for walking the AST, a PhpDocNodeVisitorInterface for defining custom logic, and concrete visitors such as CloningPhpDocNodeVisitor (for immutable transformations), ParentConnectingPhpDocNodeVisitor (for parent references), and CallablePhpDocNodeVisitor (for simple callbacks). It also provides helper classes like SimpleCallableNodeTraverser for quick traversals and defines attribute keys (parent, orig\_node) to support these operations.

src/PhpDocParser · high confidence

Introduces new value objects for PHP 8.0 migration rules

This change adds a set of new value objects in the \rules/Php80/ValueObject\ directory to support PHP 8.0-specific refactoring capabilities. These include \AnnotationToAttribute\ and \NestedAnnotationToAttribute\ for converting Doctrine annotations to PHP 8 attributes, \PropertyPromotionCandidate\ to assist with constructor property promotion, \StrStartsWith\ for string function transformations, and supporting types like \CondAndExpr\ and \MatchResult\ for match expression handling. These classes provide the structured data models required for the Php80 rule set to accurately detect and apply modernization patterns.

rules/Php80/ValueObject · high confidence

Introduction of BetterPhpDocParser infrastructure for enhanced PHPDoc handling

This change introduces a comprehensive new PHPDoc parsing and manipulation subsystem within Rector. It adds core parsing components such as \PhpDocInfo\ and \PhpDocInfoFactory\ to manage document metadata, alongside specialized node types like \DoctrineAnnotationTagValueNode\ and \ArrayItemNode\ to accurately represent complex annotation structures. The update includes a suite of decorators (e.g., \DoctrineAnnotationDecorator\, \ArrayItemClassNameDecorator\) that resolve fully qualified class names and merge nested annotations, ensuring type references in PHPDoc blocks are correctly identified. Furthermore, it provides high-level manipulation utilities like \PhpDocClassRenamer\ and \PhpDocTypeChanger\, enabling automated refactoring tools to safely update class references and type hints within documentation blocks during code transformations.

src/BetterPhpDocParser · high confidence

Introduction of ParamRenamer for synchronized parameter and docblock updates

A new ParamRenamer class has been added to the Naming rules to handle the renaming of function parameters. This component ensures that when a parameter is renamed, the change is applied not only to the code variable but also to the corresponding @param tag in the PHPDoc block, keeping documentation and code in sync.

rules/Naming/ParamRenamer · high confidence

Introduction of Post-Rector Phase for Final Code Cleanup

Rector now includes a new post-processing phase that runs after the main refactoring pass to handle final code cleanup tasks. This phase introduces a PostFileProcessor that orchestrates several specialized post-rectors: NameImportingPostRector for auto-importing class names, DocblockNameImportingPostRector for updating PHPDoc type references, ClassRenamingPostRector for handling renamed classes, UseAddingPostRector for adding necessary use statements, and UnusedImportRemovingPostRector for cleaning up unused imports. The system also includes a deprecated UseNodesToAddCollector that now delegates to the new FileNode-based import management system, providing a backward-compatibility layer for existing code while encouraging migration to the new FileNode API.

src/PostRector · high confidence

New AnonymousFunctionFactory for PHP 7.2 rules

Added a new AnonymousFunctionFactory class in the Php72 NodeFactory namespace to assist with creating and manipulating anonymous function AST nodes. This factory provides methods to construct closures with specific parameters, statements, return types, and static flags, as well as to generate anonymous functions from expression strings while handling variable imports and regex-based match array transformations.

rules/Php72/NodeFactory · high confidence

New ArgumentRemoverRector for removing method arguments

A new rector rule, ArgumentRemoverRector, has been added to the Removing ruleset. This tool allows users to configure specific arguments to be removed from defined methods and their corresponding calls, supporting removal by position, by name, or by matching specific argument values.

rules/Removing/Rector/ClassMethod · high confidence

New ArrayDimFetchToMethodCallRector for transforming array access to method calls

A new rector rule has been added that automatically converts array dimension fetch operations (such as $object\['key'\], $object\['key'\] = 'value', isset($object\['key'\]), and unset($object\['key'\])) into explicit method calls (like $object-\>get('key'), $object-\>set('key', 'value'), $object-\>has('key'), and $object-\>unset('key')). This transformation is configurable via the ArrayDimFetchToMethodCall value object, allowing users to specify which object types should be converted and which getter, setter, existence-check, and unset methods to use, thereby modernizing codebases that rely on magic property access patterns.

rules/Transform/Rector/ArrayDimFetch · high confidence

New AttributeGroupNamedArgumentManipulator for PHP 8.0 attribute decoration

A new \AttributeGroupNamedArgumentManipulator\ class has been introduced in the \rules/Php80/NodeManipulator\ directory to handle the decoration of PHP 8.0 attributes. This component iterates through attribute groups and applies specific transformations via registered \ConverterAttributeDecoratorInterface\ implementations, enabling targeted modifications to attribute arguments during code conversion.

rules/Php80/NodeManipulator · high confidence

New AttributeKeyToClassConstFetchRector for converting attribute string keys to class constants

A new rector rule has been added that automatically replaces string literal values in PHP 8 attributes with their corresponding class constants. For example, it transforms \#\[Column(type: "string")\] into \#\[Column(type: Types::STRING)\] by mapping specific attribute keys to constant names, reducing manual refactoring effort for libraries like Doctrine.

rules/Transform/Rector/Attribute · high confidence

New CarbonCallFactory for parsing date string transformations

Added CarbonCallFactory in rules/Carbon/NodeFactory to handle the conversion of Carbon date string expressions (like 'now + 2 days') into structured PHP parser nodes. This factory parses static date references and applies add/subtract operations for various time units, enabling more accurate refactoring of Carbon date manipulation code.

rules/Carbon/NodeFactory · high confidence

New ChangesReporting module for structured change output

A new ChangesReporting module has been introduced to handle the reporting of Rector's applied changes. This includes a new OutputFormatterInterface and specific formatters for Console, JSON, GitHub, and GitLab outputs. The Console formatter provides detailed file diffs, applied rules, and a rules summary. The JSON formatter outputs structured data including changed files, diffs, and unused skips. The GitHub and GitLab formatters generate annotations/issues for CI/CD pipelines, with the latter following the CodeClimate specification. Supporting value objects like RectorWithLineChange and factories for errors and file diffs are also added to facilitate this reporting.

src/ChangesReporting · high confidence

New ClassNaming utility for extracting short class names

A new ClassNaming helper class has been added to the CodingStyle/Naming namespace. It provides a getShortName method that accepts class nodes, identifiers, or string names and returns the short class name (the part after the last backslash), simplifying how the tool extracts simple class names from fully qualified references.

rules/CodingStyle/Naming · high confidence

New ClosureArrowFunctionAnalyzer for safe arrow function conversion

A new ClosureArrowFunctionAnalyzer class has been added to the Php74 NodeAnalyzer directory to support the safe detection of closures that can be converted to arrow functions. This analyzer implements logic to verify that a closure contains a single return statement and explicitly skips conversions when the closure uses referenced variables (by-reference use) or when those variables are passed to the compact() function, ensuring that semantic changes are avoided during the transformation.

rules/Php74/NodeAnalyzer · high confidence

New CombinedAssignRector simplifies compound assignments

A new rector rule has been added to automatically simplify verbose assignment expressions into their compound assignment equivalents. For example, code like \$value = $value + 5;\ is now transformed into the shorter \$value += 5;\. This change improves code readability by reducing redundancy in arithmetic and bitwise operations.

rules/CodeQuality/Rector/Assign · high confidence

New ComplexNodeRemover handles safe parameter removal with PHPDoc cleanup

A new ComplexNodeRemover class has been added to the Removing/NodeManipulator directory to manage the removal of method parameters. This utility ensures that when parameters are removed from a ClassMethod, the corresponding entries in the PHPDoc block are also cleaned up, maintaining consistency between the code signature and its documentation.

rules/Removing/NodeManipulator · high confidence

New EnumFactory helper for converting classes to PHP 8.1 enums

Added a new \EnumFactory\ class in the \rules/Php81/NodeFactory\ directory to assist in transforming existing PHP classes into PHP 8.1 enums. This factory provides methods to create enum structures from class constants and from docblock method definitions (supporting both PascalCase and snake\_case naming conventions), effectively bridging legacy class-based patterns to the new enum syntax.

rules/Php81/NodeFactory · high confidence

New FileSystem utility classes for path resolution and filtering

The src/FileSystem area now includes a suite of new classes to handle file system operations more robustly. FileAndDirectoryFilter separates file and directory paths from mixed inputs, while FilePathFilter applies user-provided --filter patterns (supporting glob, substring, and the 'tests' keyword) to narrow down results. FilePathHelper normalizes paths, handling schemes and redundant slashes, and resolves relative paths. FilesFinder orchestrates the discovery process, integrating these filters, handling suffixes, skipping unchanged files, and excluding files starting with short PHP open tags. FilesystemTweaker resolves fnmatch patterns in source paths to actual directories, and InitFilePathsResolver automatically detects project directories containing PHP files, excluding common non-source directories like vendor or tests. JsonFileSystem provides a static method to read and decode JSON files.

src/FileSystem · high confidence

New FunctionArgumentDefaultValueReplacerRector for version\_compare

A new rector rule has been added that allows users to automatically replace specific default argument values in function calls. The initial implementation targets the \version\_compare\ function, enabling the configuration to change the third argument from 'gte' to 'ge', streamlining operator arguments in version checks.

rules/Arguments/Rector/FuncCall · high confidence

New NameImporter class for managing PHP class imports

Added a new NameImporter class in the CodingStyle rules that handles the logic for importing fully qualified class names into PHP files. This component resolves existing use statements, determines if a name can be shortened, and adds new use imports (including function and constant imports) to the file's pending imports list, thereby automating the cleanup and standardization of namespace usage in code.

rules/CodingStyle/Node · high confidence

New NodeAnalyzer and NodeFactory for transforming function calls to method calls

Added the \FuncCallStaticCallToMethodCallAnalyzer\ and \PropertyFetchFactory\ classes within the \rules/Transform\ namespace. The analyzer provides logic to resolve type-providing expressions from classes and methods, handling scenarios where constructor dependencies cannot be added due to final parent constructors, and automatically injecting parameters for variables. The factory supports creating property fetch expressions from object types, facilitating the internal mechanics of transforming static or function calls into method calls on class instances.

rules/Transform/NodeAnalyzer · high confidence

New NodeAnalyzer utilities for argument handling, type checking, and expression analysis

This change introduces a suite of new analyzer classes in the src/NodeAnalyzer directory to support code transformation logic. ArgsAnalyzer and CallLikeArgumentNameAdder handle named argument detection and injection, while CallAnalyzer and ClassAnalyzer provide utilities for identifying object calls and anonymous classes. Additional analyzers like BinaryOpAnalyzer, CompactFuncCallAnalyzer, ConstFetchAnalyzer, DoctrineEntityAnalyzer, ExprAnalyzer, MagicClassMethodAnalyzer, and ParamAnalyzer offer specialized checks for binary operations, PHP's compact() function, constant values, Doctrine entity annotations, expression types, magic methods, and parameter usage respectively.

src/NodeAnalyzer · high confidence

New NodeFactory helpers for code quality transformations

Added three new factory classes in the CodeQuality rules to support specific refactoring logic: InArrayFromRepeatedCompareFactory generates in\_array() calls from repeated comparison chains, MissingPropertiesFactory creates property declarations with appropriate visibility and type hints (typed properties or docblocks), and PropertyTypeDecorator handles adding or updating PHPDoc type annotations on properties.

rules/CodeQuality/NodeFactory · high confidence

New NodeManipulator utilities for code transformation

The src/NodeManipulator directory now includes a suite of new helper classes—AssignManipulator, BinaryOpManipulator, ClassConstManipulator, ClassDependencyManipulator, ClassInsertManipulator, ClassManipulator, and ClassMethodAssignManipulator—to streamline AST transformations. AssignManipulator detects specific assignment patterns like list-each calls and resolves local property fetches. BinaryOpManipulator provides logic to match and invert boolean conditions. ClassDependencyManipulator and ClassInsertManipulator handle the injection of constructor dependencies and class properties. ClassConstManipulator checks for constant fetches across class hierarchies, while ClassManipulator and ClassMethodAssignManipulator assist with trait detection and method parameter assignment.

src/NodeManipulator · high confidence

New NullToStrictStringIntConverter helper for PHP 8.1 strict typing rules

Added a new \NullToStrictStringIntConverter\ class in the \rules/Php81/NodeManipulator\ directory. This utility handles the conversion of null values to strict string ('') or integer (0) defaults within function arguments, specifically targeting scenarios involving union types and ternary expressions to ensure compatibility with PHP 8.1's stricter typing requirements.

rules/Php81/NodeManipulator · high confidence

New PHP 5.3 rector to convert ternary operators to Elvis operator

A new rector rule has been added for PHP 5.3 that automatically refactors ternary expressions where the condition and the 'if' branch are identical (e.g., \$a ? $a : false\) into the more concise Elvis operator syntax (\$a ?: false\). This change simplifies code style for users upgrading to or maintaining PHP 5.3+ codebases by reducing redundancy in conditional assignments.

rules/Php53/Rector/Ternary · high confidence

New PHP 5.5 migration rules for class constants and preg\_replace

Added three new rector rules to the Php55 migration set: GetCalledClassToSelfClassRector replaces get\_called\_class() with self::class in final classes, GetCalledClassToStaticClassRector replaces it with static::class in non-final classes, and PregReplaceEModifierRector converts deprecated preg\_replace calls using the /e modifier to preg\_replace\_callback.

rules/Php55/Rector/FuncCall · high confidence

New PHP 7.0 code analysis helpers for constructor and comparison patterns

This location introduces new internal analysis utilities for the PHP 7.0 upgrade rules. It adds a \BattleshipTernaryAnalyzer\ to detect ternary expressions used for sorting comparisons (e.g., \$a \> $b ? 1 : -1\), a \Php4ConstructorClassMethodAnalyzer\ to identify legacy PHP 4-style constructors, a \MethodCallNameAnalyzer\ to check for specific local or parent method calls, and supporting value objects and enums (\ComparedExprs\, \BattleshipCompareOrder\) to structure this data. These components provide the foundational logic for detecting and refactoring deprecated constructor patterns and comparison idioms in PHP 7.0 code.

rules/Php70/NodeAnalyzer · high confidence

New PHP 7.0 function deprecation rector rules

Added five new rector rules in the Php70/FuncCall directory to automatically update deprecated PHP functions when upgrading to PHP 7.0 or later. The CallUserMethodRector replaces call\_user\_method and call\_user\_method\_array with call\_user\_func and call\_user\_func\array. The EregToPregMatchRector migrates deprecated ereg\ and split\* functions to their preg\* equivalents. The MultiDirnameRector simplifies nested dirname() calls by using the second argument for nesting level. The RandomFunctionRector updates legacy random functions (rand, srand, getrandmax) to the newer mt\\ and random\_int functions. The RenameMktimeWithoutArgsToTimeRector converts calls to mktime() without arguments to time().

rules/Php70/Rector/FuncCall · high confidence

New PHP 7.0 rector rules for list() behavior changes

Two new rector rules have been added to the Php70/Rector/Assign directory to handle PHP 7.0 changes regarding the list() construct. The ListSplitStringRector automatically converts direct string splitting in list assignments (e.g., list($foo) = "string") to use str\_split() instead, reflecting the removal of this feature in PHP 7.0. Additionally, the ListSwapArrayOrderRector addresses the change in array assignment order within list() by wrapping the source array with array\_reverse(), though this rule is marked as deprecated because it may incorrectly transform valid code in complex scenarios.

rules/Php70/Rector/Assign · high confidence

New PHP 7.0 rector to convert isset/return patterns to null coalescing operator

A new \IfIssetToCoalescingRector\ has been added to the PHP 7.0 rule set. This rector automatically refactors code patterns where an \if\ statement checks \isset()\ on a variable and immediately returns it, followed by a return of a fallback value, into a single expression using the null coalescing operator (\??\). For example, \if (isset($this-\>items\[$key\])) { return $this-\>items\[$key\]; } return 'fallback';\ becomes \return $this-\>items\[$key\] ?? 'fallback';\. This change simplifies code and leverages PHP 7.0+ features.

rules/Php70/Rector/StmtsAwareInterface · high confidence

New PHP 7.0 rector to simplify comparison logic using the spaceship operator

A new \IfToSpaceshipRector\ rule has been added to the PHP 7.0 rule set. This rector automatically refactors verbose \if/else\ blocks that return \0\, \1\, or \-1\ (commonly used in sorting callbacks) into a single, concise return statement using the PHP 7 spaceship operator (\\<=\>\). This reduces code verbosity and improves readability for comparison functions.

rules/Php70/Rector/If\ · high confidence_

New PHP 7.1 rule to simplify array and type checks

A new rector rule has been added to the Php71 set that simplifies code patterns where an \instanceof\ check for a specific type is immediately followed by an \is\_array()\ check on the same variable. This pattern is now automatically refactored into a single, more concise method call, improving code readability for PHP 7.1+ environments.

rules/Php71 · high confidence

New PHP 7.2 deprecation rectors for function calls

Added five new rectors in the Php72/FuncCall directory to automatically update code for deprecated or changed PHP 7.2 behaviors: CreateFunctionToAnonymousFunctionRector converts deprecated create\_function() calls to anonymous functions; GetClassOnNullRector replaces get\_class() calls on potentially null values with ternary checks; ParseStrWithResultArgumentRector updates parse\_str() calls to use the result argument instead of get\_defined\_vars(); StringifyDefineRector ensures the first argument of define() is a string literal; and StringsAssertNakedRector converts string assertions into actual boolean expressions.

rules/Php72/Rector/FuncCall · high confidence

New PHP 7.3 migration rules for function calls

Added a suite of new rector rules in the Php73/FuncCall directory to automate migration to PHP 7.3 standards. These include ArrayKeyFirstLastRector and ArrayKeysToArrayKeyFirstLastRector to replace reset/end/current with array\_key\_first/last, SetCookieRector to convert legacy setcookie positional arguments to the new options array, SensitiveDefineRector to remove the case-insensitive flag from define(), StringifyStrNeedlesRector to cast integer needles to strings in string-search functions, RegexDashEscapeRector to escape unescaped dashes in regex patterns, and JsonThrowOnErrorRector (now deprecated) to add JSON\_THROW\_ON\_ERROR flags.

rules/Php73/Rector/FuncCall · high confidence

New PHP 7.4 deprecation and behavior-change rector rules

This location introduces several new automated refactoring rules for PHP 7.4 codebases. The \ArrayKeyExistsOnPropertyRector\ replaces \array\_key\_exists()\ calls on objects with \property\_exists()\. The \FilterVarToAddSlashesRector\ converts \filter\_var()\ calls using \FILTER\_SANITIZE\_MAGIC\_QUOTES\ to \addslashes()\. The \HebrevcToNl2brHebrevRector\ updates the deprecated \hebrevc()\ function to \nl2br(hebrev())\. The \MbStrrposEncodingArgumentPositionRector\ adjusts the argument order for \mb\_strrpos()\ to match PHP 8+ expectations. The \MoneyFormatToNumberFormatRector\ replaces the deprecated \money\_format()\ with an equivalent \number\_format()\ call. Finally, the \RestoreIncludePathToIniRestoreRector\ replaces the deprecated \restore\_include\_path()\ with \ini\_restore('include\_path')\.

rules/Php74/Rector/FuncCall · high confidence

New PHP 8 attribute conversion infrastructure for Doctrine annotations

The \src/PhpAttribute\ directory now contains the core implementation for converting Doctrine annotations to PHP 8 attributes. This includes a dispatcher (\AnnotationToAttributeMapper\) and specialized mappers for handling arrays, strings, class constants, and nested structures, alongside factories (\PhpAttributeGroupFactory\, \PhpNestedAttributeGroupFactory\) that generate the final attribute nodes and handle argument inlining and type casting.

src/PhpAttribute · high confidence

New PHP 8.0 NodeFactory classes for match expressions and attributes

This change introduces five new factory classes in the Php80 NodeFactory namespace to support PHP 8.0 features. AttrGroupsFactory and NestedAttrGroupsFactory handle the creation of attribute groups for Doctrine annotation-to-attribute conversions. MatchFactory and MatchArmsFactory facilitate the transformation of switch-like control flow into PHP 8's match expressions, including handling default values and throw statements. StrStartsWithFuncCallFactory generates calls to the new str\_starts\_with() function or its negation.

rules/Php80/NodeFactory · high confidence

New PHP 8.0 code transformation rules for classes

This location introduces several new rector rules for PHP 8.0 class refactoring. The AnnotationToAttributeRector converts PHPDoc annotations into native PHP 8 attributes. The ClassPropertyAssignToConstructorPromotionRector simplifies classes by promoting constructor-assigned properties to constructor promotion. The StringableForToStringRector adds the Stringable interface and string return type to classes implementing \_\_toString(). Additionally, the AttributeValueResolver helper class is added to support attribute value resolution.

rules/Php80/Rector/Class\ · high confidence_

New PHP 8.0 contract interfaces for attribute decoration and string prefix refactoring

Two new interfaces have been added to the Rector PHP 8.0 rules contract layer: ConverterAttributeDecoratorInterface, which defines methods for retrieving attribute names and decorating Attribute nodes, and StrStartWithMatchAndRefactorInterface, which standardizes the matching of string-starts-with comparisons (using identical, equal, not-identical, or not-equal binary operations) and their refactoring into function calls or boolean negations. These interfaces provide a structured contract for implementing specific PHP 8.0 transformation logic.

rules/Php80/Contract · high confidence

New PHP 8.0 node analyzers for switch-to-match and property promotion

Added four new analyzer classes in the Php80 rules to support PHP 8.0 code transformations. MatchSwitchAnalyzer and SwitchAnalyzer provide logic to detect when a traditional switch statement can be safely converted to a match expression, including checks for break statements, case types, and return conditions. PhpAttributeAnalyzer adds utility methods to detect specific PHP attributes on nodes. PromotedPropertyCandidateResolver and PromotedPropertyResolver handle the analysis and resolution of properties that can be promoted in constructor parameters, including checks for model-based class restrictions.

rules/Php80/NodeAnalyzer · high confidence

New PHP 8.0 node resolvers for switch-to-match conversion

Added two new helper classes in the Php80 rules: StrFalseComparisonResolver, which detects string function calls compared against false to support stricter type handling, and SwitchExprsResolver, which analyzes switch statements to extract conditions and expressions for conversion to the new match expression syntax.

rules/Php80/NodeResolver · high confidence

New PHP 8.0 rector rules for class methods

Three new rector rules have been added to the Php80 set to help modernize code for PHP 8.0 compatibility. The AddParamBasedOnParentClassMethodRector automatically adds missing parameters to child class methods to match their parent signatures, ensuring method signatures remain compatible. The FinalPrivateToPrivateVisibilityRector removes the 'final' modifier from private methods, as this modifier is redundant and deprecated in PHP 8.0. The SetStateToStaticRector adds the 'static' keyword to \_\_set\_state() methods, which is required for proper serialization behavior in PHP 8.0.

rules/Php80/Rector/ClassMethod · high confidence

New PHP 8.0 rector rules for ternary simplification

Added two new rector rules in the Php80/Ternary namespace: GetDebugTypeRector, which simplifies ternary expressions checking \is\_object()\ and returning \get\_class()\ or \gettype()\ into a single \get\_debug\_type()\ call, and TernaryToNullsafeCoalesceRector, which converts null-checking ternaries around method or property calls into the PHP 8 nullsafe operator (\?-\>\) combined with the null coalescing operator (\??\).

rules/Php70/Rector/Ternary, rules/Php80/Rector/Ternary · high confidence

New PHP 8.0 rector to convert switch statements to match expressions

Adds the ChangeSwitchToMatchRector, which automatically refactors compatible switch statements into PHP 8.0 match expressions. The rector handles assignments, returns, and type casting of the condition, ensuring the transformation is safe and idiomatic for modern PHP versions.

rules/Php80/Rector/Switch\ · high confidence_

New PHP 8.1 readonly property rector

A new rector rule has been added to automatically decorate read-only properties with the PHP 8.1 \readonly\ attribute. This tool analyzes class properties and constructor parameters to identify those that are only assigned once (typically in the constructor) and never modified afterwards, converting them to native readonly properties to enforce immutability at the language level.

rules/Php81/Rector/Property · high confidence

New PHP 8.1 rector rules for MyCLabs, Spatie enums and Reflection

Added three new rector rules in the Php81 MethodCall directory: MyCLabsMethodCallToEnumConstRector and SpatieEnumMethodCallToEnumConstRector refactor legacy enum method calls (e.g., getValue, getName) to native PHP 8.1 enum constant property access, and RemoveReflectionSetAccessibleCallsRector removes no-op ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible() calls required only in PHP \< 8.1.

rules/Php81/Rector/MethodCall · high confidence

New PHP 8.3 deprecation rector rules for LDAP, class constants, and get\_class

Added three new rector rules in the Php83 FuncCall directory to address PHP 8.3 deprecations: CombineHostPortLdapUriRector merges separate host and port arguments in ldap\_connect() into a single URI; DynamicClassConstFetchRector converts string-based constant lookups using constant() into dynamic class constant fetch syntax; and RemoveGetClassGetParentClassNoArgsRector replaces no-argument get\_class() and get\_parent\_class() calls with self::class and parent::class respectively.

rules/Php83/Rector/FuncCall · high confidence

New PHP 8.3 rector to add \#\[Override\] attributes

A new rector rule, AddOverrideAttributeToOverriddenMethodsRector, has been added to automatically apply the PHP 8.3 \#\[Override\] attribute to methods that override parent class methods or implement interface methods. This helps improve code clarity and catch errors where a method signature changes unexpectedly. The rule is configurable to allow adding the attribute to empty methods and to interface implementations.

rules/Php83/Rector/ClassMethod · high confidence

New PHP 8.4 migration rules and deprecated legacy rules

This update introduces a suite of new Rector rules for PHP 8.4, including \ForeachToArrayAnyRector\, \ForeachToArrayAllRector\, \ForeachToArrayFindRector\, and \ForeachToArrayFindKeyRector\ to convert foreach loops into \array\_any\, \array\_all\, \array\_find\, and \array\_find\_key\ calls; \AddEscapeArgumentRector\ to add the required \escape\ argument to CSV functions; \RoundingModeEnumRector\ to replace rounding mode constants with the \RoundingMode\ enum; \NewMethodCallWithoutParenthesesRector\ to remove unnecessary parentheses in new method calls; and \ExplicitNullableParamTypeRector\ to enforce explicit nullable types. Additionally, \DeprecatedAnnotationToDeprecatedAttributeRector\ and \PropertyHookRector\ are now marked as deprecated and will throw exceptions if used, advising users to switch to static analysis tools or keep explicit getters/setters.

rules/Php84 · high confidence

New PHP 8.5 rector rule to replace backtick shell execution with shell\_exec()

A new rector rule has been added to automatically replace deprecated backtick syntax for shell execution with the explicit shell\_exec() function call, aligning code with PHP 8.5 deprecation standards. This change ensures that shell commands previously written using backticks (e.g., \ls -al\) are transformed into the more readable and secure shell\_exec('ls -al') format, improving code clarity and future-proofing against upcoming PHP version changes.

rules/Php85/Rector/ShellExec · high confidence

New PHP 8.6 code style rules for readonly properties and clamp conversion

Two new rector rules are introduced to support upcoming PHP 8.6 features. The \ConstructorReadonlyAssignToDefaultRector\ automatically moves constant assignments of readonly properties from the constructor into the property declaration itself, simplifying class initialization. The \MinMaxToClampRector\ refactors nested \min()\ and \max()\ function calls into the new \clamp()\ function, reducing code verbosity for value range limiting.

rules/Php86 · high confidence

New PHPDoc type-inference rules for classes and deprecation of data-provider rules

This location introduces several new Rector rules in the TypeDeclarationDocblocks namespace to automatically add precise @var and @param array docblocks to class properties and methods based on local context: AddParamTypeToRefactorMethodRector infers the node type for Rector refactor() methods; AddVarArrayDocblockFromDimFetchAssignRector, DocblockVarArrayFromGetterReturnRector, DocblockVarArrayFromPropertyDefaultsRector, and DocblockVarFromParamDocblockInConstructorRector derive @var array types from property assignments, getter returns, default values, and constructor parameters respectively; and ClassMethodArrayDocblockParamFromLocalCallsRector adds @param array types to private methods based on local call sites. Additionally, AddReturnArrayDocblockFromDataProviderParamRector and AddReturnDocblockDataProviderRector are marked as deprecated and now throw exceptions, as data-provider docblock typing is considered to increase maintenance cost without improving code quality.

rules/TypeDeclarationDocblocks/Rector/Class\ · high confidence_

New PHPStan ObjectTypeSpecifier for precise type resolution

Added a new \ObjectTypeSpecifier\ class in the \rules/TypeDeclaration/PHPStan\ directory to handle the resolution of object types for PHPStan analysis. This component integrates with Rector's \UseImportsResolver\ and \NameScopeFactory\ to accurately map object types to their fully qualified, aliased, or shortened names, including support for generic types and template types within class scopes.

rules/TypeDeclaration/PHPStan · high confidence

New ParamPhpDocNodeFactory for consistent PHPDoc parameter generation

A new ParamPhpDocNodeFactory class has been introduced in the TypeDeclaration PhpDocParser rules to centralize the creation of ParamTagValueNode instances. This factory ensures that PHPDoc parameter tags are generated with consistent formatting, automatically handling variadic flags and parameter names via the NodeNameResolver, which standardizes how type declarations are reflected in PHPDoc comments for function parameters.

rules/TypeDeclaration/PhpDocParser · high confidence

New PhpDoc tag removal utilities for dead code cleanup

The rules/DeadCode/PhpDoc/TagRemover directory now contains three new classes—ParamTagRemover, ReturnTagRemover, and VarTagRemover—that provide dedicated logic for detecting and removing useless or dead @param, @return, and @var PhpDoc tags. ParamTagRemover identifies and removes @param tags that are no longer needed based on function signatures, ReturnTagRemover handles dead @return tags, and VarTagRemover manages the removal of obsolete @var tags while preserving necessary type information and descriptions. These utilities enable more precise dead code removal in PhpDoc blocks.

rules/DeadCode/PhpDoc/TagRemover · high confidence

New PropertyAssignMatcher for detecting property assignments

A new PropertyAssignMatcher class has been added to the TypeDeclaration rules to identify assignments to class properties. This matcher specifically handles direct assignments (e.g., $this-\>propertyName = $expr) and array append operations (e.g., $this-\>propertyName\[\] = $expr), enabling more accurate type inference for these common assignment patterns.

rules/TypeDeclaration/Matcher · high confidence

New ReadonlyClassManipulator for PHP 8.2 readonly class handling

A new ReadonlyClassManipulator has been added to the Php82 rules to support PHP 8.2's readonly classes. This component handles the logic for detecting when a class can be made readonly, including checks for parent class inheritance, trait usage, and property mutability. It coordinates with VisibilityManipulator to apply the readonly modifier and cleans up readonly modifiers from constructor parameters and properties to ensure correct transformation.

rules/Php82/NodeManipulator · high confidence

New Rector rule to absolutize include/require paths

A new code-quality rule, AbsolutizeRequireAndIncludePathRector, has been added to automatically convert relative include and require statements into absolute paths by prefixing them with the \_\DIR\\_ constant. This helps ensure that file loading is not dependent on the current working directory, though users should be aware that this change can introduce backwards-incompatible behavior if the included files rely on relative path resolution.

rules/CodeQuality/Rector/Include\ · high confidence_

New Rector rule to convert post-increment/decrement to pre-increment/decrement

A new Rector rule, PostIncDecToPreIncDecRector, has been added to the CodingStyle ruleset. This rule automatically refactors post-increment ($value++) and post-decrement ($value--) operations into their pre-increment (++$value) and pre-decrement (--$value) equivalents within standalone expressions and for-loop update statements, promoting a specific coding style preference.

rules/CodingStyle/Rector/PostInc · high confidence

New Rector rule to convert while null checks to instanceof

A new Rector rule, WhileNullableToInstanceofRector, has been added to the TypeDeclaration rules. This rule automatically refactors while loops that check if a nullable variable is not null (e.g., \$var !== null\) into strict instanceof checks (e.g., \$var instanceof SomeClass\). This improves code clarity and type safety by replacing explicit null comparisons with type-based checks in loop conditions.

rules/TypeDeclaration/Rector/While\ · high confidence_

New Rector rule to enforce newlines between class members

A new Rector rule, NewlineBetweenClassLikeStmtsRector, has been added to the CodingStyle rules. This tool automatically inserts blank lines between class constants, properties, and methods within class-like structures to improve code readability. It specifically handles edge cases by skipping blank lines between consecutive trait uses or enum cases, ensuring consistent formatting without disrupting logical groupings.

rules/CodingStyle/Rector/ClassLike · high confidence

New Rector rule to fix class name casing in @var docblocks

A new Rector rule, FixClassCaseSensitivityVarDocblockRector, has been added to automatically correct misspelled class name casing in @var docblock annotations. This tool ensures that the type names in PHPDoc comments match the actual case of the referenced classes, resolving discrepancies that can occur due to typos or inconsistent casing conventions.

rules/CodeQuality/Rector/Property · high confidence

New Rector rule to refactor isset checks on object properties

A new Rector rule, IssetOnPropertyObjectToPropertyExistsRector, has been added to the CodeQuality ruleset. This rule automatically transforms \isset($this-\>property)\ expressions on object properties into a combination of \property\_exists()\ and null checks. This change improves code clarity by explicitly verifying property existence and value, rather than relying on the broader semantics of \isset\ which also checks for null values.

rules/CodeQuality/Rector/Isset\ · high confidence_

New Rector rule to remove redundant instance checks in Rector classes

A new dead-code removal rule, RemoveRefactorDuplicatedNodeInstanceCheckRector, has been added to the Rector static analysis tool. This rule automatically cleans up Rector rule implementations by removing redundant \instanceof\ checks within the \refactor()\ method when the node type is already guaranteed by the \@param\ PHPDoc annotation or the \getNodeTypes()\ return value, resulting in cleaner and more concise rule code.

rules/DeadCode/Rector/Class\ · high confidence_

New Rector rule to remove redundant type checks

A new Rector rule, RemoveRedundantTypeCheckRector, has been added to the DeadCode category. This rule automatically removes redundant type-checking function calls (such as is\_string, is\_array, etc.) when the variable's type has already been narrowed by preceding conditions in boolean expressions. For example, it cleans up patterns like checking for null followed by a type check, or truthy checks followed by type checks, where the second check is guaranteed to pass.

rules/DeadCode/Rector/BinaryOp · high confidence

New Rector rule to remove specific method call parameters

A new \RemoveMethodCallParamRector\ has been added to the \rules/Arguments/Rector/MethodCall\ directory. This configurable rule allows users to automatically remove specific arguments from method or static calls based on the target class, method name, and argument position. It includes logic to handle named arguments correctly, ensuring that positional removal respects the structure of calls using named parameters.

rules/Arguments/Rector/MethodCall · high confidence

New Rector rule to replace unsafe new static() with new self()

A new code-quality rule, NewStaticToNewSelfRector, has been added to automatically refactor instances of \new static()\ into \new self()\ within final classes. This change improves code safety by preventing unexpected instantiation behavior in inheritance scenarios, applying the transformation only when the class is definitively final.

rules/CodeQuality/Rector/New\ · high confidence_

New Rector rule to simplify concatenation assignment on new array items

A new code quality rule, NewArrayItemConcatAssignToAssignRector, has been added to automatically refactor PHP code where the concatenation assignment operator (.=) is used on a new, empty array item. This change simplifies the syntax by replacing expressions like $values\[\] .= $name with the standard assignment $values\[\] = $name, as the new item is always null before the operation.

rules/CodeQuality/Rector/AssignOp · high confidence

New Rector rule to simplify empty checks on empty arrays

A new Rector rule, SimplifyEmptyCheckOnEmptyArrayRector, has been added to the CodeQuality ruleset. This rule automatically refactors code by replacing empty() function calls on variables known to be empty arrays with direct array identity comparisons (e.g., converting empty($values) to \[\] === $values). The rule applies to variables, property fetches, and static property fetches, provided the type can be inferred as an array, thereby simplifying the code structure for empty array checks.

rules/CodeQuality/Rector/Empty\ · high confidence_

New Rector rule to simplify repeated OR comparisons to in\_array()

A new code quality rule, RepeatedOrEqualToInArrayRector, has been added to automatically refactor patterns like $value === 10 \|\| $value === 20 into the more concise and performant in\_array($value, \[10, 20\], true). This transformation applies to chains of identical (===) or equal (==) comparisons against the same variable, provided the comparison operators are consistent (mixing === and == is left unchanged to preserve strictness semantics).

rules/CodeQuality/Rector/BooleanOr · high confidence

New Rector rule to simplify ternary assignments

A new coding-style rule, TernaryConditionVariableAssignmentRector, has been added to automatically refactor code patterns where a ternary operator assigns the same variable in both its true and false branches. This change allows Rector to convert verbose structures like \$value ? $a = 1 : $a = 0;\ into the more concise and standard form \$a = $value ? 1 : 0;\, improving code readability and consistency.

rules/CodingStyle/Rector/Ternary · high confidence

New Rector rules for PHP 8 attribute argument formatting

Two new code-quality rules have been added to the Rector static analysis tool. The ExplicitAttributeNamedArgsRector automatically converts positional arguments in PHP 8 attributes to named arguments (e.g., \#\[Attr(val)\] to \#\[Attr(val: val)\]), while the SortAttributeNamedArgsRector reorders named arguments within attributes to match the parameter declaration order of the attribute's constructor. These changes improve code consistency and readability for projects using PHP 8+ attributes.

rules/CodeQuality/Rector/Attribute · high confidence

New Rector rules to add named arguments for boolean and null values

Two new code-quality rules have been added to automatically add parameter names to boolean and null arguments in function calls, provided the code targets PHP 8.0 or later (where named arguments are supported). The \AddNameToBooleanArgumentRector\ renames positional boolean arguments (e.g., \in\_array($value, $array, true)\ becomes \in\_array($value, $array, strict: true)\), while the \AddNameToNullArgumentRector\ does the same for null arguments (e.g., \some\_function($value, null)\ becomes \some\_function($value, default: null)\).

rules/CodeQuality/Rector/CallLike · high confidence

New Rector rules to convert DateTime instantiations to Carbon

Added two new Rector rules that automatically refactor PHP code to use the Carbon library instead of native DateTime classes. The \DateTimeInstanceToCarbonRector\ converts \new DateTime()\ and \new DateTimeImmutable()\ instantiations to corresponding Carbon static methods (e.g., \Carbon::now()\ or \Carbon::today()\), while the \DateTimeMethodCallToCarbonRector\ handles cases where a method is called immediately on a new DateTime instance (e.g., \(new DateTime('today'))-\>format()\ becomes \Carbon::today()-\>format()\).

rules/Carbon/Rector/New\ · high confidence_

New Rector rules to refactor PHP date/time functions to Carbon

Added two new Rector rules in the Carbon namespace: \DateFuncCallToCarbonRector\ and \TimeFuncCallToCarbonRector\. The former automatically converts \date()\ calls (with optional timestamps or \strtotime\ expressions) and \time()\ subtraction patterns into equivalent \Carbon::now()-\>format()\, \Carbon::parse()\, or \Carbon::createFromTimestamp()\ calls. The latter converts \time()\ calls into \Carbon::now()-\>getTimestamp()\, supporting both direct calls and first-class callable syntax. These rules help modernize legacy date handling by migrating to the Carbon library.

rules/Carbon/Rector/FuncCall · high confidence

New RenameCastRector for standardizing PHP cast syntax

A new rector rule has been added to automatically rename PHP type casts, such as converting the legacy \(real)\ cast to the standard \(float)\ cast. This tool allows users to configure specific cast transformations via the \RenameCast\ value object, ensuring consistent and modern casting syntax across the codebase.

rules/Renaming/Rector/Cast · high confidence

New RenameClassConstFetchRector for renaming class constants

A new rector rule, RenameClassConstFetchRector, has been added to the renaming rules. This tool automatically replaces defined class constants in their calls, allowing users to configure mappings to rename specific constants within the same class or move them to different classes entirely.

rules/Renaming/Rector/ClassConstFetch · high confidence

New RenameConstantRector for replacing PHP constants

A new rector rule, RenameConstantRector, has been added to the Renaming package. This tool allows users to automatically replace old PHP constant names with new ones (e.g., changing MYSQL\_ASSOC to MYSQLI\_ASSOC) by configuring a mapping of old-to-new constant names in their Rector configuration.

rules/Renaming/Rector/ConstFetch · high confidence

New RenameMethodRector for automated method renaming

A new \RenameMethodRector\ has been added to the \rules/Renaming/Rector/MethodCall\ directory. This tool allows users to automatically rename method calls and method definitions across classes, traits, and interfaces by configuring a list of \MethodCallRename\ value objects, simplifying refactoring tasks where method signatures need to be updated consistently throughout a codebase.

rules/Renaming/Rector/MethodCall · high confidence

New TypeProvidingExprFromClassResolver helper for type inference

Added a new \TypeProvidingExprFromClassResolver\ class in the \rules/Transform/NodeTypeAnalyzer\ directory. This utility assists in identifying which expression (method call, property fetch, or constructor parameter) within a class provides a specific object type, enabling more accurate type-based transformations by resolving the source of type information from class methods, properties, or constructor arguments.

rules/Transform/NodeTypeAnalyzer · high confidence

New UseImportNameMatcher analyzer for resolving import names

A new UseImportNameMatcher class has been added to the CodingStyle NodeAnalyzer to help resolve and match import names against statements. This utility leverages BetterNodeFinder and UseImportsResolver to identify matching use statements and resolve their full names, including handling aliased imports and group use statements.

rules/CodingStyle/NodeAnalyzer · high confidence

New ValueObject for PHP magic method names

A new \ObjectMagicMethods\ value object has been added to the \Rector\\CodingStyle\\ValueObject\ namespace. This class provides a centralized, public constant array (\METHOD\NAMES\) listing standard PHP magic method names (such as \\\call\, \\\construct\, \\\_toString\, etc.), which can be used by other Rector rules to identify or manipulate these specific methods consistently.

rules/CodingStyle/ValueObject · high confidence

New VisibilityManipulator utility for PHP code refactoring

Added a new VisibilityManipulator class in the Privatization rules that provides a centralized API for modifying PHP class member visibility and modifiers. This utility allows Rector rules to safely change properties, methods, and parameters between public, protected, and private states, as well as toggle static, final, abstract, and readonly flags. It includes specific logic to handle edge cases, such as ensuring private constructors remain final and managing constructor property promotion when readonly flags are removed.

rules/Privatization/NodeManipulator · high confidence

New analyzer to identify useful array type declarations in docblocks

A new \UsefulArrayTagNodeAnalyzer\ class has been added to the \TypeDeclarationDocblocks\ rule set. This component evaluates PHPDoc \@param\, \@return\, and \@var\ tags to determine if they provide meaningful array type information, specifically filtering out generic or unhelpful types like \array\, \mixed\, or \iterable\. This logic supports the broader type declaration feature by helping the system distinguish between docblocks that offer precise type hints and those that do not.

rules/TypeDeclarationDocblocks/TagNodeAnalyzer · high confidence

New analyzers for strict native function and 'new' return types

Added StrictNativeFunctionReturnTypeAnalyzer and StrictReturnNewAnalyzer to improve return type detection. The new analyzers enable the system to identify functions that always return a specific native call or a newly instantiated object, allowing for more precise automatic type declarations in refactored code.

rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer · high confidence

New and deprecated class transformation rules

The \rules/Transform/Rector/Class\_\ directory now includes two new rector rules: \MergeInterfacesRector\, which allows users to configure a mapping to replace old interfaces with new ones in class implementations, and \AddInterfaceByTraitRector\, which is marked as deprecated and throws an exception if executed, advising users to write custom rules for trait-to-interface pairing instead.

rules/Transform/Rector/Class\ · high confidence_

New and deprecated code-quality rules for if statements

This location introduces several new PHP code-quality rules for if statements: ArrayExplicitBoolCompareRector makes array conditions explicit (e.g., !$items to $items === \[\]), ObjectExplicitBoolCompareRector makes nullable object checks explicit (e.g., !$item to !$item instanceof stdClass), CompleteMissingIfElseBracketRector adds missing brackets to if/else/elseif, ConsecutiveNullCompareReturnsToNullCoalesceQueueRector replaces sequential null checks with a null-coalesce chain (PHP 7.0+), SimplifyIfNotNullReturnRector removes redundant null checks before returning null, SimplifyIfNullableReturnRector simplifies nullable-instance checks before returning the variable, and SimplifyIfReturnBoolRector shortens if/return true/false to a direct return. Additionally, CombineIfRector, ExplicitBoolCompareRector, ShortenElseIfRector, and SimplifyIfElseToTernaryRector are deprecated and now throw to prevent usage, as their transformations can reduce readability or depend on context.

rules/CodeQuality/Rector/If\ · high confidence_

New argument analysis helpers for Rector rules

Added two new classes in the Arguments rule set: ArgumentAddingScope, which determines if an argument addition is valid based on the call context (parent call, method call, or class method), and ChangedArgumentsDetector, which checks if a parameter's default value or type has changed. These utilities support the refactoring logic for method argument modifications.

rules/Arguments/NodeAnalyzer · high confidence

New autoloading components for bootstrap files and additional paths

The src/Autoloading area introduces two new classes: AdditionalAutoloader, which handles loading extra autoload files via the AUTOLOAD\_FILE option and registers additional autoload paths, and BootstrapFilesIncluder, which includes user-specified bootstrap files (with access to the global container) and automatically loads Rector's own stub files from the stubs-rector directory.

src/Autoloading · high confidence

New boolean simplification rules in the BooleanNot namespace

Added four new Rector rules under rules/CodeQuality/Rector/BooleanNot to simplify boolean expressions: NegatedAndsToPositiveOrsRector applies De Morgan's law to convert negated AND conditions into positive ORs; ReplaceConstantBooleanNotRector simplifies negated boolean literals (e.g., !false becomes true); ReplaceMultipleBooleanNotRector replaces double negation (!!) with explicit type casting to boolean; and SimplifyDeMorganBinaryRector applies De Morgan's law to convert negated OR conditions into positive ANDs.

rules/CodeQuality/Rector/BooleanNot · high confidence

New bootstrap classes for config and autoload resolution

The src/Bootstrap directory now includes three new classes: AutoloadFileParameterResolver, ExtensionConfigResolver, and RectorConfigsResolver. AutoloadFileParameterResolver parses the --autoload-file command-line argument and registers it as a configuration parameter to ensure cache invalidation when the autoload file changes. ExtensionConfigResolver resolves configuration file paths for installed Rector extensions by reading the GeneratedConfig class and iterating over extension includes. RectorConfigsResolver handles the resolution of the main Rector configuration file, supporting the --config/-c argument and falling back to rector.php or rector.dist.php in the current working directory.

src/Bootstrap · high confidence

New closure-to-first-class-callable rector and deprecated static closure rector

A new rector rule has been added to automatically convert closures that simply delegate a call (e.g., \function ($p) { return Class::method($p); }\) into PHP 8.1+ first-class callable syntax (e.g., \Class::method(...)\). Additionally, the \StaticClosureRector\ has been deprecated and removed from active use; it now throws an exception to prevent automatic conversion of closures to static closures, as this change is considered noisy with little value.

rules/CodingStyle/Rector/Closure · high confidence

New code quality helpers for boolean casting and named argument sorting

Added two new helper classes to the CodeQuality rules: ExprBoolCaster, which handles safe boolean casting and null-comparison logic for expressions based on static type analysis, and NamedArgsSorter, which reorders named arguments in function calls to match the parameter order defined in the function or method reflection. These utilities support more precise code quality transformations by ensuring type-safe boolean conversions and consistent argument ordering.

rules/CodeQuality/NodeManipulator · high confidence

New code quality rectors for PHP function calls

The rules/CodeQuality/Rector/FuncCall directory now includes a set of new static analysis rectors that automatically refactor common PHP function call patterns. These include converting array\_merge of non-arrays to simple arrays, replacing call\_user\_func with arrow functions with direct calls, changing array\_push to direct array assignment, converting compact() calls to explicit arrays, replacing is\_a() with instanceof checks, completing missing third arguments in is\_a() for strings, removing unnecessary sprintf() wrappers, changing settype() to cast expressions, simplifying count(func\_get\_args()) to func\_num\_args(), removing unneeded array\_values() in in\_array(), simplifying regex patterns, optimizing strpos(strtolower()) to stripos(), converting single-element in\_array() to direct comparisons, sorting named arguments to match function signatures, and unwrapping single-argument sprintf() calls.

rules/CodeQuality/Rector/FuncCall · high confidence

New code quality rectors for class methods

Added four new Rector rules in the CodeQuality/ClassMethod directory to improve code quality: ExplicitReturnNullRector adds explicit return null statements to methods that return a value but miss a main return; InlineArrayReturnAssignRector inlines just-in-time array dimension fetch assignments into direct return statements; LocallyCalledStaticMethodToNonStaticRector converts private static methods and their local calls to non-static; and OptionalParametersAfterRequiredRector adds reasonable default values when a required parameter follows an optional one.

rules/CodeQuality/Rector/ClassMethod · high confidence

New code quality rectors for path simplification and string concatenation

Added the DirnameDirConcatStringToDirectStringPathRector, which simplifies patterns like dirname(\_\DIR\\) . '/path' into \\DIR\\_ . '/../path' for cleaner file path construction. Also added the JoinStringConcatRector, which merges adjacent string literals (e.g., 'Hi' . ' Tom' to 'Hi Tom'), though this rule is now deprecated and throws an exception to encourage manual handling or custom rules instead.

rules/CodeQuality/Rector/Concat · high confidence

New code quality rules for logical operators

Added two new Rector rules in the CodeQuality namespace: AndAssignsToSeparateLinesRector splits chained assignments using the 'and' operator into separate lines to improve readability, and LogicalToBooleanRector converts 'and'/'or' operators to '&&'/'\|\|' to align with common precedence expectations and avoid subtle bugs.

rules/CodeQuality/Rector/LogicalAnd · high confidence

New code quality rules for simplifying boolean expressions

Three new Rector rules have been added to the CodeQuality/BooleanAnd directory to automatically simplify specific boolean patterns. RemoveUselessIsObjectCheckRector removes redundant is\_object() checks when combined with an instanceof check. RepeatedAndNotEqualToNotInArrayRector converts repeated && comparisons of the same value against different constants into a single !in\_array() call. SimplifyEmptyArrayCheckRector simplifies combinations of is\_array() and empty() into a direct comparison against an empty array.

rules/CodeQuality/Rector/BooleanAnd · high confidence

New code quality rules for simplifying foreach loops

Added four new Rector rules in the Foreach\_ namespace to simplify common foreach patterns: ForeachItemsAssignToEmptyArrayToAssignRector converts loops that append items to an empty array into direct assignment; ForeachToInArrayRector replaces foreach loops that check for a specific value and return a boolean with in\_array calls; SimplifyForeachToCoalescingRector transforms foreach loops that return a mapped value into null coalescing operator expressions (requiring PHP 7.0+); and UnusedForeachValueToArrayKeysRector is included but deprecated, as it wraps foreach loops with array\_keys() which is considered a personal preference that reduces readability.

rules/CodeQuality/Rector/Foreach\ · high confidence_

New code quality rules for simplifying identical comparisons

Added five new Rector rules in the \rules/CodeQuality/Rector/Identical\ directory to automatically simplify specific comparison patterns: \BooleanNotIdenticalToNotIdenticalRector\ converts negated identical boolean comparisons to not-identical; \FlipTypeControlToUseExclusiveTypeRector\ changes null checks on nullable objects to exclusive instanceof checks; \SimplifyArraySearchRector\ replaces \array\_search(...) !== false\ with \in\_array\; \SimplifyBoolIdenticalTrueRector\ removes redundant \=== true\ or \!== false\ checks on boolean expressions; and \StrlenZeroToIdenticalEmptyStringRector\ converts \strlen($var) === 0\ to \$var === ''\.

rules/CodeQuality/Rector/Identical · high confidence

New code quality rules for simplifying inline conditionals

Two new Rector rules have been added to the CodeQuality/Expression namespace to improve code readability. The InlineIfToExplicitIfRector transforms short-circuit logical expressions (e.g., \is\_null($userId) && $userId = 5\) into standard if statements. The TernaryFalseExpressionToIfRector converts ternary operators that use \false\ as the else branch (e.g., \$value ? $someMethod-\>call($value) : false\) into explicit if blocks.

rules/CodeQuality/Rector/Expression · high confidence

New code transformation rules for wrapping return values and converting object instantiation to static calls

Two new configurable rector rules have been added to the Transform category. The WrapReturnRector allows users to automatically wrap the return value of specific methods in an array, while the NewToStaticCallRector enables the conversion of object instantiation (new calls) into static method calls for specified classes. These rules provide flexible, configuration-driven transformations for refactoring code patterns involving method returns and object creation.

rules/Transform/Rector/ClassMethod · high confidence

New code-quality node analyzers for property and condition analysis

Added several new helper classes in the CodeQuality NodeAnalyzer namespace to support internal refactoring rules: ClassLikeAnalyzer extracts property names from class definitions; ExplicitBoolConditionResolver identifies conditions that should be made explicitly boolean; ForeachAnalyzer detects specific foreach patterns assigning to array dimensions; LocalPropertyAnalyzer resolves property assignments and their types within class methods; MissingPropertiesResolver identifies properties that are assigned but not declared; and VariableDimFetchAssignResolver resolves nested array assignments from statements. These utilities improve the accuracy of code-quality transformations by providing specialized AST analysis capabilities.

rules/CodeQuality/NodeAnalyzer · high confidence

New coding style rule to split chained assignments

A new Rector rule, SplitDoubleAssignRector, has been added to the CodingStyle rules. This rule automatically splits chained variable assignments (e.g., \$a = $b = 1;\) into separate statements (e.g., \$a = 1; $b = 1;\) to prevent potential undefined array index issues and improve code clarity. Additionally, the previously existing NestedTernaryToMatchRector has been deprecated and now throws an exception, advising users to refactor nested ternaries into explicit control structures like early returns instead of converting them to match statements.

rules/CodingStyle/Rector/Assign · high confidence

New coding style rules for class constants

Two new Rector rules have been added to the CodingStyle suite. The RemoveFinalFromConstRector automatically removes the final modifier from class constants within final classes, aligning with PHP 8.1+ behavior where final class constants are redundant. The SplitGroupedClassConstantsRector enforces a style where each class constant is declared on its own line, splitting grouped constant declarations into separate statements for improved readability.

rules/CodingStyle/Rector/ClassConst · high confidence

New coding style rules for function calls and array handling

This update introduces several new Rector rules in the CodingStyle/FuncCall directory to modernize and standardize PHP code. The new rules include CallUserFuncToMethodCallRector, which refactors call\_user\_func() calls on known methods into direct method calls, and CallUserFuncArrayToVariadicRector, which replaces call\_user\_func\_array() with variadic syntax (available in PHP 5.6+). Additionally, ClosureFromCallableToFirstClassCallableRector upgrades Closure::fromCallable() to the first-class callable syntax (PHP 8.1+), and FunctionFirstClassCallableRector converts string callback functions to first-class callables. Other new rules enforce consistent implode() argument order, add strict comparison to in\_array() and array\_search() when types match, and replace version\_compare() calls with PHP\_VERSION\_ID constants. Two previously existing rules, ArraySpreadInsteadOfArrayMergeRector and CountArrayToEmptyArrayComparisonRector, are now deprecated and throw exceptions when executed, as they are considered personal preferences or low-value.

rules/CodingStyle/Rector/FuncCall · high confidence

New coding style rules for statement spacing and use statement aliases

Two new Rector rules are introduced to improve code style consistency. The NewlineAfterStatementRector automatically inserts empty new lines between different types of statements (such as assignments and returns) to enhance readability. The RemoveUselessAliasInUseStatementRector cleans up import statements by removing aliases that duplicate the original class name, simplifying the use declarations.

rules/CodingStyle/Rector/Stmt · high confidence

New coding-style rules for method refactoring and formatting

This update introduces three new static analysis rules in the CodingStyle module. The FuncGetArgsToVariadicParamRector automatically converts functions using func\_get\_args() into modern variadic parameters (...$args), requiring PHP 8.0+. The MakeInheritedMethodVisibilitySameAsParentRector aligns child method visibility with parent definitions to ensure consistent access control. Additionally, the NewlineBeforeNewAssignSetRector inserts blank lines between distinct variable assignment blocks to improve code readability, while the BinaryOpStandaloneAssignsToDirectRector is marked as deprecated due to its narrow scope.

rules/CodingStyle/Rector/ClassMethod · high confidence

New coding-style rules for string simplification and class resolution

Two new Rector rules have been added to the CodingStyle/String\_ directory. The SimplifyQuoteEscapeRector automatically switches string delimiters to the opposite quote type when the string contains only one kind of quote character, reducing unnecessary escaping. The UseClassKeywordForClassNameResolutionRector replaces hardcoded string references to class names (e.g., 'App\\SomeClass::method') with the modern \\App\\SomeClass::class constant syntax, improving refactoring safety and IDE support.

rules/CodingStyle/Rector/String\ · high confidence_

New configurable rector rules for transforming function calls

Added four new configurable rector rules in the Transform/FuncCall namespace: FuncCallToConstFetchRector converts specific function calls (like php\_sapi\_name) to constants (like PHP\_SAPI); FuncCallToNewRector transforms configured function calls into new instance instantiations; FuncCallToStaticCallRector changes function calls to static method calls; and FuncCallToMethodCallRector, which is now deprecated and throws an exception, previously attempted to convert function calls to local method calls but was removed due to safety concerns.

rules/Transform/Rector/FuncCall · high confidence

New configurable rector rules for transforming method calls

Added two new configurable rector rules in the Transform/Rector/MethodCall directory: MethodCallToFuncCallRector, which allows converting specific instance method calls into global function calls (e.g., converting $this-\>render() to view()), and MethodCallToStaticCallRector, which enables converting instance method calls into static method calls on a different class (e.g., converting $dependency-\>process() to StaticCaller::anotherMethod()). Both rules are configurable via value objects that map old method signatures to new function or static call targets.

rules/Transform/Rector/MethodCall · high confidence

New configurable rules to remove interfaces and trait usages

Added RemoveInterfacesRector and RemoveTraitUseRector, which allow users to configure specific interface names or trait names to be stripped from classes. RemoveInterfacesRector removes listed interfaces from class implementation lists and interface extension lists, while RemoveTraitUseRector removes specified trait usages from classes and traits, cleaning up empty use statements.

rules/Removing/Rector/Class\ · high confidence_

New configuration management and rule filtering system

Rector now introduces a dedicated configuration layer in src/Configuration to manage rule execution and setup. The new ConfigInitializer class automates the creation of rector.php config files by detecting project paths and prompting users in interactive terminals, while the ConfigurationFactory centralizes the parsing of command-line options (such as --only, --filter, and --composer-based) into a unified Configuration object. Additionally, the ConfigurationRuleFilter enforces rule selection logic by excluding deprecated rules and applying filters for specific rule sets, PHP version constraints, or composer-based dependencies, ensuring that only relevant transformations are applied during a run.

src/Configuration · high confidence

New constructor-assigned type resolution for docblock analysis

A new ConstructorAssignedTypeResolver class has been added to the TypeDeclarationDocblocks NodeAnalyzer to improve type inference for properties assigned in constructors. This analyzer identifies property assignments within the constructor method and resolves their types, enabling more accurate docblock generation for class properties initialized via constructor injection or assignment.

rules/TypeDeclarationDocblocks/NodeAnalyzer · high confidence

New dead code rectors for narrowing union return types and removing redundant returns

Two new rules have been added to the DeadCode set. The NarrowWideUnionReturnTypeRector analyzes function return statements to identify and remove unused types from overly broad union return type declarations, updating both the PHP type hint and the PHPDoc @return tag to reflect the actual returned values. The RemoveDeadReturnRector cleans up code by eliminating the final return statement in functions when it is redundant (e.g., an empty return at the end of a function or a bare return inside a simple if-block that is the last statement).

rules/DeadCode/Rector/FunctionLike · high confidence

New dead-code cleanup rules for if/else statements

The \rules/DeadCode/Rector/If\_/\ directory now contains a suite of new Rector rules that automatically simplify or remove redundant conditional logic. These include \ReduceAlwaysFalseIfOrRector\ to simplify \if (false \|\| $b)\ conditions, \RemoveAlwaysTrueIfConditionRector\ to strip \if (true)\ blocks, \RemoveDeadIfBlockRector\ to merge or remove empty if/elseif/else branches, \RemoveDeadInstanceOfRector\ to eliminate redundant type checks on typed variables, \RemoveOverriddenAssignBeforeIfElseRector\ to remove variable assignments immediately overwritten in both branches, \RemoveTypedPropertyDeadInstanceOfRector\ to remove redundant instanceof checks on typed properties, \RemoveUnusedNonEmptyArrayBeforeForeachRector\ to remove unnecessary non-empty array checks before foreach loops, \SimplifyIfElseWithSameContentRector\ to collapse if/else blocks with identical bodies, and \UnwrapFutureCompatibleIfPhpVersionRector\ to remove PHP version checks that are already satisfied.

rules/DeadCode/Rector/If\ · high confidence_

New dead-code detection for version comparisons and empty-array foreach checks

The DeadCode rule set now includes logic to detect and remove specific patterns of dead code. A new ConditionResolver and ConditionEvaluator infrastructure allows the system to resolve and evaluate version\_compare() calls (including PHP\_VERSION and PHP\_VERSION\_ID) against binary operators, enabling the removal of conditions that are always true or false based on the current PHP version. Additionally, a new UselessIfCondBeforeForeachDetector identifies and flags useless conditional checks before foreach loops, specifically matching patterns like empty($array), !empty($array), and $array !== \[\] or $array != \[\] when the loop iterates over that same array.

rules/DeadCode · high confidence

New dead-code detection helpers for method parameters and array counts

The DeadCode rule engine now includes several new NodeManipulator classes to support more precise code cleanup. ClassMethodParamRemover and PrivateMethodParamRemover identify and remove unused parameters from class methods, with the latter also updating caller arguments and PHPDoc tags to stay in sync. ControllerClassMethodManipulator detects controller action methods by checking for parent classes ending in 'Controller' or 'Presenter' and specific PHPDoc tags. CountManipulator recognizes patterns like count($array) \> 0 or count($array) \>= 1 to help identify redundant checks. LivingCodeManipulator assists in preserving code that has side effects or is necessary for type resolution, such as clone operations with magic methods or array access checks.

rules/DeadCode/NodeManipulator · high confidence

New dead-code removal rules for class methods and docblocks

This update introduces a suite of new Rector rules in the DeadCode/ClassMethod namespace to automatically clean up redundant code and documentation. The new rules remove empty class methods not required by parents, strip parent-delegating constructors and methods that pass arguments unchanged, and eliminate default arguments from parent calls when they match the parent's defaults. It also cleans up PHPDoc by removing @return tags that duplicate native self/static types, removing @param/@return/@var null tags, and removing @param mixed or @return mixed tags when a native type is already declared. Additionally, it removes @return tags that contradict native return types and strips unused parameters from constructors and private test methods.

rules/DeadCode/Rector/ClassMethod · high confidence

New dead-code removal rules for conditions and unreachable statements

Three new Rector rules have been added to the DeadCode set to automatically simplify code structure. RemoveConditionExactReturnRector removes redundant if-blocks that return the exact same expression as the subsequent return statement. RemoveNextSameValueConditionRector merges consecutive if-statements that share the same condition and have no side effects, consolidating their bodies. RemoveUnreachableStatementRector detects and deletes code that follows a terminating statement (such as a return), ensuring that unreachable lines are cleaned up.

rules/DeadCode/Rector/Stmt · high confidence

New dead-code removal rules for expression statements

Two new Rector rules have been added to the DeadCode package to clean up unnecessary expression statements. The RemoveDeadStmtRector now removes standalone expressions that have no side effects (such as a variable reference like \$value;\), while preserving comments and handling special cases like magic \\_\_get\ properties or no-discard void casts. The SimplifyMirrorAssignRector removes redundant self-assignments (e.g., \$result = $result;\), effectively stripping out statements that assign a variable to itself without changing its value.

rules/DeadCode/Rector/Expression · high confidence

New dead-code removal rules for loops and control structures

This location introduces three new Rector rules in the DeadCode namespace that automatically clean up unnecessary code patterns. RemoveDeadContinueRector strips useless continue statements that appear at the end of loop bodies. RemoveDeadIfForeachForRector eliminates empty if, foreach, and for blocks, and simplifies if-else structures where the if branch is empty by inverting the condition and moving the else body into the if branch. RemoveDeadLoopRector removes loop constructs (for, foreach, while, do-while) that have no body, provided their conditions and initializers do not contain side effects.

rules/DeadCode/Rector/For\ · high confidence_

New dead-code rules for double and unused variable assignments

Three new Rector rules have been added to the DeadCode category to clean up redundant code. RemoveDoubleAssignRector detects and removes consecutive assignments to the same variable when the first is immediately overwritten, provided there are no side effects. RemoveDoubleSelfAssignRector simplifies chained self-assignments (e.g., $x = $x = ...) into a single assignment. RemoveUnusedVariableAssignRector identifies and removes variable assignments that are never read afterwards, with safeguards to preserve side effects, handle destructors, and avoid removing internal object resets.

rules/DeadCode/Rector/Assign · high confidence

New dead-code rules for property cleanup

Added four new Rector rules in the DeadCode/Property namespace to automatically clean up PHP code: RemoveDefaultValueFromAssignedPropertyRector removes redundant default values from properties that are always assigned in the constructor; RemoveUnusedPrivatePropertyRector deletes private properties that are never read; RemoveUselessReadOnlyTagRector strips the @readonly PHPDoc annotation from properties that use the native readonly type (PHP 8.1+); and RemoveUselessVarTagRector removes @var annotations on properties and class constants where the type is already explicit.

rules/DeadCode/Rector/Property · high confidence

New dead-code rules for simplifying ternary expressions

Two new Rector rules have been added to the DeadCode category to automatically simplify ternary operators. The \RemoveUselessTernaryRector\ removes redundant ternary expressions where the fallback value is falsey (e.g., converting \$value ?: false\ to \$value\). The \TernaryToBooleanOrFalseToBooleanAndRector\ transforms ternary expressions that return a boolean or false into logical AND operations (e.g., converting \$value ? $this-\>getBool() : false\ to \$value && $this-\>getBool()\).

rules/DeadCode/Rector/Ternary · high confidence

New dead-code rules to remove redundant null arguments

Added two new Rector rules that automatically remove explicit null arguments from method calls, static calls, new instances, and function calls when the corresponding parameter already has a null default value. The first rule handles positional arguments, while the second specifically targets named arguments, ensuring that redundant nulls are stripped to clean up code without changing behavior.

rules/DeadCode/Rector/MethodCall · high confidence

New docblock type decoration and private method flagging rules

The \TypeDeclarationDocblocks\ area now includes two new components: \NodeDocblockTypeDecorator\, which adds logic to decorate generic iterable parameter, return, and variable types in PHPDoc blocks while avoiding useless 'mixed' or 'never' array types, and \PrivateMethodFlagger\, which determines if a method should be treated as private based on class finality and visibility rules. These changes enhance the precision of automatic PHPDoc type generation for iterable structures and refine the detection of private methods within final classes.

rules/TypeDeclarationDocblocks · high confidence

New factory for converting array-callable syntax to method calls

A new \ArrayCallableToMethodCallFactory\ class has been added to the \rules/CodingStyle/NodeFactory\ directory. This component provides logic to transform PHP array-callable syntax (e.g., \\[$object, 'methodName'\]\) into direct method calls, supporting the \CallUserFuncToMethodCallRector\ rule by handling the AST transformation for valid array structures containing a property fetch or variable and a string method name.

rules/CodingStyle/NodeFactory · high confidence

New guard for PHP 8.0 property promotion safety

A new MakePropertyPromotionGuard class has been added to the Php80 rules to validate whether converting constructor parameters to promoted properties is safe. It leverages the existing PropertyTypeChangeGuard to check type compatibility and applies additional logic to allow promotion for final classes, public inline parameters, private properties, or cases where type information is missing, ensuring that the refactoring does not break existing visibility or type contracts.

rules/Php80/Guard · high confidence

New guard prevents unsafe arrow function and closure conversions

A new \ArrowFunctionAndClosureFirstClassCallableGuard\ class has been added to the \rules/CodingStyle/Guard\ directory. This component acts as a safety filter for code style rules that convert closures or arrow functions. It implements logic to skip conversions in complex scenarios, such as when arguments are passed by reference, named arguments are used, the call is part of a chain, or when the function relies on \this\ in a non-object context. This ensures that the automated refactoring tool does not break code that depends on specific PHP argument passing behaviors or object scope.

rules/CodingStyle/Guard · high confidence

New interface for mapping PHP annotations to attributes

A new interface, AnnotationToAttributeInterface, has been added to the Php80 rules contract. This interface defines a contract for value objects that map PHP annotations to their corresponding PHP 8 attributes, requiring implementations to provide the tag name and the target attribute class.

rules/Php80/Contract/ValueObject · high confidence

New interface for skipping class name import rules

A new \ClassNameImportSkipVoterInterface\ has been added to the \Rector\\CodingStyle\\Contract\\ClassNameImport\ namespace. This interface defines a \shouldSkip\ method that allows specific logic to determine whether the class name import coding style rule should be bypassed for a given file, object type, and node, enabling more granular control over when import optimizations are applied.

rules/CodingStyle/Contract · high confidence

New matcher classes for variable and call analysis in naming rules

Added three new classes to the \Rector\\Naming\\Matcher\ namespace: \CallMatcher\, \ForeachMatcher\, and \VariableAndCallAssignMatcher\. \CallMatcher\ identifies function, static, or method calls within assignment or foreach nodes. \ForeachMatcher\ and \VariableAndCallAssignMatcher\ utilize \CallMatcher\ and \NodeNameResolver\ to detect specific patterns involving variables and calls in foreach loops and assignments, returning structured value objects (\VariableAndCallForeach\, \VariableAndCallAssign\) for downstream processing by naming rules.

rules/Naming/Matcher · high confidence

New modular type resolution and PHPStan integration architecture

The \src/NodeTypeResolver\ area has been restructured to introduce a modular type resolution system and direct PHPStan container integration. This includes new contracts (\NodeTypeResolverInterface\, \NodeTypeResolverAwareInterface\) and a central \NodeTypeResolver\ that dispatches resolution to specialized handlers (e.g., \CastTypeResolver\, \ClassAndInterfaceTypeResolver\, \NameTypeResolver\) for specific AST node types. A new \PHPStanServicesFactory\ allows the application to bootstrap and access PHPStan services (like \ReflectionProvider\ and \NodeScopeResolver\) directly. Additionally, a \NodeTypeCorrector\ and its sub-components (\AccessoryNonEmptyStringTypeCorrector\, etc.) are introduced to clean up unnecessary intersection/union types, improving the accuracy of type declarations for users.

src/NodeTypeResolver · high confidence

New naming guards and array filter utility

Added BreakingVariableRenameGuard, DateTimeAtNamingConventionGuard, and HasMagicGetSetGuard to prevent unsafe variable and property renames by checking for naming conflicts, magic \_\get/\\_set methods, and DateTime 'At' suffix conventions. Also added ArrayFilter utility to identify values appearing at least twice in an array.

rules/Naming/Guard · high confidence

New naming infrastructure for variable renaming and inflection

The rules/Naming location now includes two new classes: RectorNamingInflector, which handles singularization logic while preserving mass nouns like 'data' and 'info', and VariableRenamer, which provides the core functionality to rename variables within function-like scopes and update corresponding PHPDoc @var tags. These components form the foundation for automated variable renaming rules.

rules/Naming · high confidence

New naming rules for foreach value variables

Two new Rector rules have been added to automatically improve variable naming in foreach loops. The \RenameForeachValueVariableToMatchExprVariableRector\ renames the loop variable to match the singular form of the iterable expression's name (e.g., renaming \$property\ to \$variable\ when iterating over \$variables\). The \RenameForeachValueVariableToMatchMethodCallReturnTypeRector\ renames the loop variable to match the return type of the method call used as the iterable (e.g., renaming \$property\ to \$method\ when iterating over \$object-\>getMethods()\).

rules/Naming/Rector/Foreach\ · high confidence_

New naming rules for parameters and variables

Added two new Rector rules to improve code readability by aligning names with types. The \RenameParamToMatchTypeRector\ automatically renames function and method parameters to match their type hints (e.g., renaming \$pie\ to \$apple\ when the type is \Apple\), while skipping parameters in vendor code to preserve named argument compatibility. The \RenameVariableToMatchNewTypeRector\ renames local variables assigned to new objects to match the class name (e.g., renaming \$search\ to \$dreamSearch\ when assigned \new DreamSearch()\).

rules/Naming/Rector/ClassMethod · high confidence

New node decorators for tracking rule origin, property types, and statement depth

Added three new classes in the NodeDecorator namespace to enhance AST node metadata. CreatedByRuleDecorator tracks which Rector rules have processed specific nodes, allowing the system to record and manage the chain of transformations applied to a node. PropertyTypeDecorator automatically adds PHP type declarations to property nodes when the target PHP version supports typed properties, ensuring the code reflects the inferred types. StatementDepthAttributeDecorator marks statements within class methods to identify first-level statements, providing structural context for subsequent processing steps.

src/NodeDecorator · high confidence

New node-finder helpers for type declaration docblock analysis

Added a set of specialized NodeFinder classes in the TypeDeclarationDocblocks module to support more accurate static analysis of PHP code. ArrayDimFetchFinder detects array dimension fetches and assignments to variables or properties. DataProviderMethodsFinder identifies PHPUnit and Codeception data provider methods via attributes and docblocks. GetterClassMethodPropertyFinder and PropertyGetterFinder locate getter methods that return specific properties, including promoted constructor properties. ReturnNodeFinder isolates functions with a single return statement containing an expression. YieldNodeFinder extracts yield and yield-from nodes while ignoring nested scopes. These utilities enable the docblock type inference rules to better understand data flow and method signatures.

rules/TypeDeclarationDocblocks/NodeFinder · high confidence

New parallel processing engine for faster code analysis

The \src/Parallel\ directory now introduces a complete parallel processing infrastructure, enabling Rector to analyze multiple files simultaneously across multiple CPU cores. This change adds the \ParallelFileProcessor\ to orchestrate worker processes, \WorkerCommandLineFactory\ to spawn and configure child workers, and supporting value objects like \Schedule\ and \ProcessPool\ to manage job distribution and process lifecycle. By leveraging asynchronous I/O via ReactPHP and NDJSON communication, this new engine significantly reduces total processing time for large codebases compared to sequential execution.

src/Parallel · high confidence

New privatization guards for Laravel models, parent class overrides, and property lookups

Added four new guard classes in the Privatization/Guard directory to prevent unsafe privatization of methods and properties. LaravelModelGuard protects Laravel model attributes and scopes from being made private. OverrideByParentClassGuard ensures methods or properties are not privatized if they can be overridden by a parent class or implemented interfaces. ParentClassMagicCallGuard prevents privatization when a parent class uses dynamic method calls that might invoke the protected method. ParentPropertyLookupGuard safeguards properties that are accessed by parent classes, including specific handling for Symfony Console Command reserved properties.

rules/Privatization/Guard · high confidence

New property type declaration rules added

The rules/TypeDeclaration/Rector/Property directory now includes four new rector rules that automatically add type declarations to class properties. AddPropertyTypeDeclarationRector adds types based on configured parent class property types. TypedPropertyFromAssignsRector infers types from all property assignments within a class. TypedPropertyFromStrictConstructorRector infers types from constructor parameter assignments. TypedPropertyFromStrictSetUpRector infers types from PHPUnit setUp() method assignments. These rules help modernize code by adding PHP 7.4+ typed properties where types can be reliably inferred.

rules/TypeDeclaration/Rector/Property · high confidence

New rector rule to change constant visibility

Added the ChangeConstantVisibilityRector, a new configurable rule that allows users to automatically adjust the visibility of class constants defined in parent classes. By specifying target classes, constant names, and desired visibility levels, the tool can refactor code to enforce consistent access modifiers across inheritance hierarchies.

rules/Visibility/Rector/ClassConst · high confidence

New rector rule to convert global constant fetches to class constant fetches

A new rector rule, ConstFetchToClassConstFetchRector, has been added to automatically transform global constant references (e.g., CONTEXT\_COURSE) into class constant references (e.g., course::LEVEL). This change allows users to configure specific mappings to modernize code by replacing standalone constants with structured class constants, improving code organization and type safety.

rules/Transform/Rector/ConstFetch · high confidence

New rector rule to merge PHPStan docblock tags into native equivalents

A new rector rule, MergePhpstanDocTagIntoNativeRector, has been added to automatically consolidate more precise PHPStan-specific docblock tags (@phpstan-var, @phpstan-param, @phpstan-return) into their standard native counterparts (@var, @param, @return). This change simplifies PHPDoc comments by removing redundant PHPStan-specific annotations when a native tag with equivalent or broader type information is already present, applying to properties, parameters, class constants, class methods, and functions.

rules/TypeDeclarationDocblocks/Rector/Property · high confidence

New rector rule to move inner named functions to top level

A new code-quality rector rule has been added that automatically moves inner named functions out of their parent functions to the top level. This addresses compatibility issues with PHPStan, which does not support inner named functions. The rule detects inner function definitions, extracts them, and hoists them to the surrounding scope, while avoiding name collisions with existing sibling functions or native PHP functions.

rules/CodeQuality/Rector/StmtsAwareInterface · high confidence

New rector rule to optimize for-loop count() calls

A new code quality rule, ForRepeatedCountToOwnVariableRector, has been added to detect and refactor for-loops where the count() function is called repeatedly in the loop condition. This change improves performance by extracting the count result into a local variable before the loop starts, preventing redundant function calls on every iteration.

rules/CodeQuality/Rector/For\ · high confidence_

New rector rule to privatize protected properties in final classes

Added the \PrivatizeFinalClassPropertyRector\ rule, which automatically changes protected properties to private within final classes when it is safe to do so. This helps improve encapsulation by restricting property visibility where subclassing is not possible, specifically handling both standard protected properties and promoted constructor parameters.

rules/Privatization/Rector/Property · high confidence

New rector rule to remove obsolete PHP version checks

A new \RemovePhpVersionIdCheckRector\ has been added to the DeadCode ruleset. This tool automatically detects and removes conditional statements that check \PHP\_VERSION\_ID\ against specific version numbers (e.g., \if (PHP\_VERSION\_ID \< 80000)\), provided the current runtime version makes the condition always true or false, thereby cleaning up dead code paths.

rules/DeadCode/Rector/ConstFetch · high confidence

New rector rule to remove reference operators from function calls

A new rector rule, RemoveReferenceFromCallRector, has been added to the Php54 migration set. This rule automatically removes the \&\ reference operator from arguments in function, method, and static calls, aligning code with PHP 5.4+ standards where passing by reference in function calls is deprecated or removed. Users upgrading from older PHP versions will see their code automatically refactored to remove these reference indicators.

rules/Php54/Rector/FuncCall · high confidence

New rector rule to remove useless variable assignments

A new code quality rule, SimplifyUselessVariableRector, has been added to the FunctionLike rector category. This rule automatically simplifies code by removing unnecessary variable assignments when a variable is immediately assigned and then returned, replacing patterns like \$a = true; return $a;\ with \return true;\. The rule includes safeguards to skip transformations if the variable is static, global, used by reference, part of a new instance creation, or if comments reference the variable, ensuring safe refactoring.

rules/CodeQuality/Rector/FunctionLike · high confidence

New rector rule to replace continue with break in switch statements

A new PHP 5.2 rector rule, ContinueToBreakInSwitchRector, has been added to automatically convert \continue\ statements inside \switch\ blocks to \break\. This change aligns with PHP 5.2+ behavior where \continue\ in a switch acts like \break\, ensuring code consistency and preventing logical errors in older codebases being upgraded. The rule specifically targets \continue\ statements without arguments or those with an argument of 1, replacing them with \break\ while leaving \continue\ with higher arguments unchanged.

rules/Php52/Rector/Switch\ · high confidence_

New rector rule to replace empty() checks on nullable objects with instanceof

A new Rector rule, EmptyOnNullableObjectToInstanceOfRector, has been added to automatically refactor code that uses the empty() function on nullable object parameters. When empty() is used to check if a nullable object is null or empty, this rule replaces it with a more explicit instanceof check (e.g., changing empty($obj) to ! $obj instanceof Type). This improves type safety and clarity by leveraging PHP's type system rather than relying on the loose truthiness checks of empty().

rules/TypeDeclaration/Rector/Empty\ · high confidence_

New rector rule to replace nullable object checks with instanceof

A new rector rule, BinaryOpNullableToInstanceofRector, has been added to the TypeDeclaration rules. This rule automatically refactors code that uses boolean AND (&&) or OR (\|\|) operators with nullable object variables, replacing implicit null checks with explicit instanceof comparisons. For example, a condition like \$someClass && $someClass-\>someMethod()\ where \$someClass\ is nullable will be transformed into \$someClass instanceof SomeClass && $someClass-\>someMethod()\, improving type safety and code clarity.

rules/TypeDeclaration/Rector/BooleanAnd · high confidence

New rector rule to replace static::class with self::class in final classes

A new rector rule, StaticToSelfOnFinalClassRector, has been added to automatically refactor code within final classes. When a final class uses static::class to reference its own class name, this rule changes it to self::class. This optimization is safe because final classes cannot be extended, making self::class semantically equivalent but slightly more performant. The rule applies only to PHP 5.5+ environments where the CLASSNAME constant is available.

rules/Php55/Rector/ClassConstFetch · high confidence

New rector rule to replace string class names with class constants

The StringClassNameToClassConstantRector has been added to the Php55 ruleset. This rule automatically converts string literals representing fully qualified class names (e.g., 'Some\\Namespace\\Class') into the modern PHP 5.5+ \::class\ constant syntax (e.g., \Some\\Namespace\\Class::class\). It includes logic to skip short class names, invalid string usages, and arguments to the \is\_a\ function, and allows users to configure specific classes to skip via the \classesToSkip\ option.

rules/Php55/Rector/String\ · high confidence_

New rector rule to simplify negated instanceof ternaries

A new static analysis rule, FlipNegatedTernaryInstanceofRector, has been added to automatically refactor negated instanceof checks within ternary expressions. This change improves code readability by converting patterns like \! $object instanceof Product ? null : $object-\>getPrice()\ into their positive counterparts, \$object instanceof Product ? $object-\>getPrice() : null\, reducing unnecessary negation logic.

rules/Instanceof\ · high confidence_

New rector rule to wrap variable variables in curly braces

A new PHP 7.0 rector rule, WrapVariableVariableNameInCurlyBracesRector, has been added to automatically wrap variable variables in curly braces (e.g., changing $$foo-\>bar to ${$foo-\>bar}). This change ensures compatibility with PHP 7.0+ syntax requirements where variable variables must be explicitly delimited to avoid ambiguity.

rules/Php70/Rector/Variable · high confidence

New rector rules for adding and replacing method arguments

Two new rector rules have been introduced in the Arguments namespace to automate method signature and call updates. The ArgumentAdderRector automatically adds new default arguments to method calls and class method definitions based on configured rules, handling positional and named arguments. The ReplaceArgumentDefaultValueRector replaces specific argument default values in method calls and constructors with new values, supporting both instance and static method invocations.

rules/Arguments/Rector/ClassMethod · high confidence

New rector rules for inferring closure return types

Added four new static analysis rules in the TypeDeclaration/Closure directory that automatically add return type declarations to PHP closures. The new rules include AddClosureNeverReturnTypeRector (adds 'never' for closures that always throw), AddClosureVoidReturnTypeWhereNoReturnRector (adds 'void' for closures with no return statement), ClosureReturnTypeFromAssertInstanceOfRector (infers specific types from PHPUnit assertInstanceOf calls within test cases), and ClosureReturnTypeRector (infers general return types from return values). These changes improve type safety by ensuring closures have explicit return type hints where possible.

rules/TypeDeclaration/Rector/Closure · high confidence

New rector rules for str\_starts\_with() and str\_ends\_with()

Two new PHP 8.0 rector rules have been added to automatically refactor string comparison patterns into the native \str\_starts\_with()\ and \str\_ends\_with()\ functions. The \StrEndsWithRector\ converts patterns like \substr($haystack, -strlen($needle)) === $needle\ and \substr\_compare($haystack, $needle, -strlen($needle)) === 0\ into \str\_ends\_with()\. The \StrStartsWithRector\ handles similar patterns for prefix checks, converting \substr($haystack, 0, strlen($needle)) === $needle\ and related \strncmp\/\strpos\ usages into \str\_starts\_with()\. These changes improve code readability and performance for users upgrading to PHP 8.0+.

rules/Php80/Rector/Identical · high confidence

New rector rules to convert MyCLabs and Spatie enum classes to PHP 8.1 native enums

Two new rector rules have been added to automatically refactor legacy enum implementations into native PHP 8.1 enums. The MyCLabsClassToEnumRector converts classes extending MyCLabs\\Enum\\Enum into native string-backed enums, while the SpatieEnumClassToEnumRector handles Spatie\\Enum\\Enum classes, offering an optional configuration to convert case names to upper snake case.

rules/Php81/Rector/Class\ · high confidence_

New rector rules to replace deprecated each() usage

Two new PHP 7.2 rector rules have been added to automatically modernize code using the deprecated each() function. The ListEachRector converts list() assignments like list($key, $value) = each($array) into separate key(), current(), and next() calls. The ReplaceEachAssignmentWithKeyCurrentRector handles cases where each() is assigned to an array variable outside a loop, replacing it with explicit key and value assignments using current() and key() functions along with a next() call to advance the array pointer.

rules/Php72/Rector/Assign · high confidence

New rector to convert array callables to PHP 8.1 first-class callable syntax

A new rector rule, ArrayToFirstClassCallableRector, has been added to automatically upgrade array-based callables (e.g., \[$this, 'method'\]) to the PHP 8.1 first-class callable syntax (e.g., $this-\>method(...)). This change applies specifically to method callables within the Php81 ruleset, enabling cleaner code for users targeting PHP 8.1 or higher.

rules/Php81/Rector/Array\ · high confidence_

New rector to convert nested Doctrine annotations to PHP 8 attributes

A new \NestedAnnotationToAttributeRector\ has been added to the Php80 rules, enabling the automatic conversion of complex, nested Doctrine ORM annotations (such as \@ORM able\ containing \joinColumns\) into native PHP 8 attributes. This change specifically targets properties, classes, and parameters, flattening nested annotation structures into separate attribute groups while preserving the necessary use imports, thereby modernizing codebases to use the more concise and native attribute syntax.

rules/Php80/Rector/Property · high confidence

New rector to normalize case of user-defined constants

A new \SensitiveConstantNameRector\ has been added to the PHP 7.3 ruleset. This tool automatically converts case-insensitive user-defined constant fetches to their canonical uppercase form (e.g., changing \foo\ to \FOO\) to align with PHP 7.3's deprecation of case-insensitive constants. It specifically targets \ConstFetch\ nodes, skipping PHP reserved constants and constants that are already defined in the correct case, ensuring code compatibility with stricter constant naming conventions.

rules/Php73/Rector/ConstFetch · high confidence

New rector to remove extra function parameters in PHP 7.1+

A new rector rule, RemoveExtraParametersRector, has been added to the Php71 ruleset. This tool automatically removes excess arguments from function, method, and static calls when the number of provided arguments exceeds the maximum defined in the function's signature. It leverages PHPStan reflection to determine the correct parameter count and safely skips cases involving variadic parameters, abstract methods, interfaces, or unresolved reflections, ensuring that code is cleaned up without breaking runtime behavior.

rules/Php71/Rector/FuncCall · high confidence

New rector to remove redundant default cases in switch statements

A new rector, ReduceMultipleDefaultSwitchRector, has been added to the Php70 rules. It automatically removes duplicate default cases within switch statements, keeping only the last one, which aligns with PHP 7.0+ behavior where multiple default cases are invalid or redundant.

rules/Php70/Rector/Switch\ · high confidence_

New rector to upgrade exception handler type hints to Throwable

A new rector rule, ExceptionHandlerTypehintRector, has been added to automatically update exception handler functions and class methods. When a function or method named with 'handle' (case-insensitive) has exactly one parameter typed as Exception, the rector changes the type hint to Throwable, aligning with PHP 7.0+ standards.

rules/Php70/Rector/FunctionLike · high confidence

New rectors to add strict\_types declarations

Added two new Rector rules in the TypeDeclaration namespace: DeclareStrictTypesRector, which automatically adds \declare(strict\_types=1)\ to namespaced PHP files that are missing it, and SafeDeclareStrictTypesRector, which performs the same addition but only when the file is verified to be strictly type-safe (i.e., it contains no scalar type coercions). Both rules require PHP 7.0 or higher.

rules/TypeDeclaration/Rector/StmtsAwareInterface · high confidence

New reflection helper classes for resolving class and method metadata

Added four new classes in the src/Reflection namespace to centralize and simplify PHP reflection logic: ClassModifierChecker (checks if a class is final), ClassReflectionAnalyzer (resolves parent class names, handling enums), MethodReflectionResolver (resolves method reflections with support for @method annotations), and ReflectionResolver (a comprehensive resolver for class, method, and function reflections from various AST nodes). These utilities provide a consistent API for accessing PHPStan reflection data across the codebase.

src/Reflection · high confidence

New renaming value objects and contracts

The Renaming rules now include a set of new value objects and interfaces in the \rules/Renaming/Contract\ and \rules/Renaming/ValueObject\ directories. These additions define contracts for renaming method calls, annotations, class constant fetches, and introduce value objects for renaming attributes, casts, properties, and static methods. This provides a structured way to specify old and new names for various code elements during refactoring.

rules/Renaming/ValueObject · high confidence

New returned-node return type inference logic

A new \ReturnedNodesReturnTypeInfererTypeInferer\ class has been added to the \rules/TypeDeclaration/TypeInferer/ReturnTypeInferer\ directory. This component improves the accuracy of return type detection by analyzing the actual return statements within functions, closures, and class methods. It specifically handles cases involving silent voids and narrows array types, ensuring that inferred types better reflect the code's actual behavior rather than defaulting to mixed or void.

rules/TypeDeclaration/TypeInferer/ReturnTypeInferer · high confidence

New rule to add return types to arrow functions

A new Rector rule, AddArrowFunctionReturnTypeRector, has been introduced to automatically add explicit return type declarations to PHP arrow functions (fn) when the return type can be inferred. This helps improve code clarity and type safety for arrow functions that previously lacked explicit return type hints.

rules/TypeDeclaration/Rector/ArrowFunction · high confidence

New rule to finalize PHPUnit test classes

A new Rector rule, FinalizeTestCaseClassRector, has been added to automatically mark PHPUnit test classes as final. This change improves code safety and performance by preventing test classes from being extended, aligning with best practices for test isolation. The rule specifically targets classes that extend PHPUnit\\Framework\\TestCase and end with 'Test', while skipping abstract, anonymous, or already final classes.

rules/Privatization/Rector/Class\ · high confidence_

New rule to flatten empty or redundant code blocks

A new Rector rule, ReplaceBlockToItsStmtsRector, has been added to the DeadCode category. This rule automatically removes unnecessary block structures (curly braces) that contain only statements, effectively flattening the code. If a block is empty, the rule removes it entirely; if it contains statements, it replaces the block wrapper with the statements themselves, improving code readability by eliminating redundant syntax.

rules/DeadCode/Rector/Block · high confidence

New rule to preserve exception context in catch blocks

A new rector rule, \ThrowWithPreviousExceptionRector\, has been added to the CodeQuality ruleset. This rule automatically updates \throw\ statements inside \catch\ blocks to include the caught exception as the previous exception argument. This ensures that the original exception context is preserved in the exception chain, improving debugging and error tracking capabilities.

rules/CodeQuality/Rector/Catch\ · high confidence_

New rule to privatize protected constants in final classes

A new Rector rule, \PrivatizeFinalClassConstantRector\, has been added to automatically change protected class constants to private within final classes. This transformation is applied only when the constant is not defined in a parent class or interface and is not shared across multiple constants on a single line, ensuring that encapsulation is improved without breaking inheritance contracts.

rules/Privatization/Rector/ClassConst · high confidence

New rule to privatize protected methods in final classes

A new Rector rule, \PrivatizeFinalClassMethodRector\, has been added to automatically change protected class methods to private within final classes. This transformation improves encapsulation by restricting method visibility where inheritance is not possible, while safely skipping methods that are magic methods, part of the Nette framework's component creation pattern, or guarded by parent class traits and magic calls.

rules/Privatization/Rector/ClassMethod · high confidence

New rule to remove dead conditions above return statements

A new Rector rule, RemoveDeadConditionAboveReturnRector, has been added to the DeadCode category. This rule automatically cleans up code by removing unnecessary conditional blocks that immediately precede a return statement, provided the condition has no side effects and the return value inside the condition matches the subsequent return. For example, it simplifies an if-block that always returns a specific value followed by the same return statement into a single direct return.

rules/DeadCode/Rector/Return\ · high confidence_

New rule to remove dead zero and one operations

A new Rector rule, RemoveDeadZeroAndOneOperationRector, has been added to the DeadCode category. This rule automatically simplifies arithmetic expressions by removing operations involving zero and one that do not change the value, such as replacing \5 + 0\ with \5\ or \5 \* 1\ with \5\. It handles binary and assignment operators for addition, subtraction, multiplication, and division, while correctly preserving operations on floats where adding zero or subtracting might affect sign normalization.

rules/DeadCode/Rector/Plus · high confidence

New rule to remove duplicated array keys

A new Rector rule, RemoveDuplicatedArrayKeyRector, has been added to the DeadCode category. When applied, it automatically removes duplicate keys from defined arrays, keeping only the last assigned value for any given key (e.g., transforming \\[1 =\> 'A', 1 =\> 'B'\]\ into \\[1 =\> 'B'\]\). This helps clean up redundant code and potential logical errors in array definitions.

rules/DeadCode/Rector/Array\ · high confidence_

New rule to remove duplicated switch cases

A new Rector rule, RemoveDuplicatedCaseInSwitchRector, has been added to the DeadCode category. This rule automatically refactors switch statements by merging consecutive case branches that share identical logic and termination (break or return), reducing code duplication and improving readability.

rules/DeadCode/Rector/Switch\ · high confidence_

New rule to remove non-existing @var annotations

A new Rector rule, RemoveNonExistingVarAnnotationRector, has been added to the DeadCode ruleset. This rule automatically removes @var PHPDoc annotations that reference variables not actually present in the code, helping to keep documentation clean and accurate. It handles various statement types and intelligently skips cases where variables might be dynamically extracted or used in subsequent statements.

rules/DeadCode/Rector/Node · high confidence

New rule to remove null property initializations

A new Rector rule, RemoveNullPropertyInitializationRector, has been added to the DeadCode category. This rule automatically removes explicit null assignments from class property declarations (e.g., changing \private $myVar = null;\ to \private $myVar;\), helping to clean up redundant code.

rules/DeadCode/Rector/PropertyProperty · high confidence

New rule to remove orphaned parent static calls

A new dead-code removal rule, RemoveParentCallWithoutParentRector, has been added to automatically clean up static calls to parent methods (such as parent::\_\_construct()) in classes that do not actually extend a parent class. This prevents runtime errors and removes unnecessary code by detecting and removing these calls when the class has no parent, while safely preserving calls if the parent class cannot be resolved or if the method exists in an ancestor.

rules/DeadCode/Rector/StaticCall · high confidence

New rule to remove redundant instanceof assertions

A new static analysis rule, RemoveDeadInstanceOfAssertRector, has been added to the DeadCode ruleset. This tool automatically removes assert() calls that check an instanceof relationship when the variable's type is already known to match or be a subtype of the checked class, thereby cleaning up redundant code.

rules/DeadCode/Rector/StmtsAwareInterface · high confidence

New rule to remove redundant string casts in concatenation

A new Rector rule, RemoveConcatAutocastRector, has been added to the DeadCode category. This rule automatically removes explicit (string) casts within concatenation operations (e.g., changing 'hi ' . (string) $value to 'hi ' . $value), as PHP handles string conversion during concatenation by default. This helps clean up dead code and simplifies source code without changing behavior.

rules/DeadCode/Rector/Concat · high confidence

New rule to remove redundant type casts

A new Rector rule, RecastingRemovalRector, has been added to the DeadCode category. This rule automatically removes unnecessary type casts (such as (string), (int), (bool), etc.) when the variable being cast is already of the target type, effectively cleaning up dead code and simplifying expressions like \(string) $string\ to \$string\.

rules/DeadCode/Rector/Cast · high confidence

New rule to remove unused keys in foreach loops

A new dead-code rule, RemoveUnusedForeachKeyRector, has been added to automatically clean up foreach loops where the key variable is declared but never used within the loop body or in subsequent statements. When this rule detects such unused keys, it removes them from the code and updates the associated PHPDoc var tags to reflect the change, resulting in cleaner and more concise iteration syntax.

rules/DeadCode/Rector/Foreach\ · high confidence_

New rule to rename properties and method parameters to match their types

A new Rector rule, RenamePropertyToMatchTypeRector, has been added to automatically rename class properties and promoted constructor parameters so that their names match the type they hold (e.g., renaming $eventManager to $entityManager when the type is EntityManager). The rule specifically targets private and protected members, skipping public properties to avoid breaking external code, and excludes properties with specific types like MockObject or DateTime interfaces to prevent conflicts with other naming conventions.

rules/Naming/Rector/Class\ · high confidence_

New rule to rename variables to match method call return types

A new Rector rule, RenameVariableToMatchMethodCallReturnTypeRector, has been added to the Naming rules. This rule automatically renames variables assigned from method calls so that the variable name reflects the method's return type (e.g., renaming $a to $runner when assigned from $this-\>getRunner()). It handles updates to variable names within the function scope and synchronizes corresponding @var PHPDoc tags, while skipping renames that would break existing code or violate naming conventions.

rules/Naming/Rector/Assign · high confidence

New rule to replace default argument values in method signatures and calls

Rector now includes a new refactoring capability that automatically replaces default values for function and method arguments. This change introduces the \ArgumentDefaultValueReplacer\ class and its associated contract, enabling rules to detect specific argument positions and swap their default values (e.g., changing a default \null\ to a specific constant or string) in both method definitions and function calls.

rules/Arguments · high confidence

New rule to replace local getter calls with direct property access

A new rector rule, PrivatizeLocalGetterToPropertyRector, has been added to automatically refactor code by replacing calls to simple private getter methods (e.g., $this-\>getSome()) with direct property access (e.g., $this-\>some) when the getter merely returns a local property without parameters or side effects. This optimization reduces method call overhead and simplifies the code structure for internal class logic.

rules/Privatization/Rector/MethodCall · high confidence

New rule to replace loose equality with strict equality for same-type values

A new Rector rule, UseIdenticalOverEqualWithSameTypeRector, has been added to automatically refactor code by replacing loose equality operators (== and !=) with strict equality operators (=== and !==) when the compared values are determined to have the same static type. This change improves code safety and performance by ensuring type-safe comparisons, while safely skipping cases involving object types, mixed types, or array dimension fetches where loose comparison behavior might be intentional or ambiguous.

rules/CodeQuality/Rector/Equal · high confidence

New rule to replace variable-based class constant fetches with direct references

A new Rector rule, VariableConstFetchToClassConstFetchRector, has been added to automatically refactor code where a class constant is accessed via a variable (e.g., $obj::CONST) into a direct class constant fetch (e.g., ClassName::CONST). This transformation is applied only when the target class or the constant itself is marked as final, ensuring that the refactoring is safe and does not break polymorphic behavior. For users, this means their codebase can be automatically cleaned up to use more explicit and performant constant access patterns where stability is guaranteed.

rules/CodeQuality/Rector/ClassConstFetch · high confidence

New rule to simplify redundant boolean AND expressions

A new Rector rule, RemoveAndTrueRector, has been added to the DeadCode category. This rule automatically simplifies boolean AND expressions where one operand is always true (e.g., \true && $condition\ becomes \$condition\), removing dead code and improving readability.

rules/DeadCode/Rector/BooleanAnd · high confidence

New rule to split grouped class properties onto separate lines

A new Rector rule, SplitGroupedPropertiesRector, has been added to the CodingStyle rules. This rule automatically refactors PHP classes by separating multiple properties declared on a single line into individual property declarations, each on its own line, improving code readability and consistency.

rules/CodingStyle/Rector/Property · high confidence

New rule to split multi-import use statements and trait usages

A new \SeparateMultiUseImportsRector\ has been added to automatically split combined \use\ statements (e.g., \use A, B;\) into individual lines (\use A; use B;\) and separate multiple trait usages in a class (e.g., \use TraitA, TraitB;\) into distinct \use\ statements. This helps enforce a coding style where each import or trait is declared on its own line, improving readability and reducing merge conflicts.

rules/CodingStyle/Rector/Use\ · high confidence_

New rules to remove dead try/catch blocks and redundant catch clauses

Two new Rector rules have been added to the DeadCode category: RemoveDeadTryCatchRector and RemoveDeadCatchRector. RemoveDeadTryCatchRector removes entire try/catch structures when the try block is empty or contains only dead code, the catch block simply re-throws the caught exception, and the finally block is empty. RemoveDeadCatchRector removes individual catch clauses that merely re-throw the same exception variable, provided the next catch clause is provably unrelated to the removed one, thereby cleaning up redundant exception handling logic.

rules/DeadCode/Rector/TryCatch · high confidence

New rules to remove function calls and specific arguments

Added RemoveFuncCallRector and RemoveFuncCallArgRector to the Removing ruleset. RemoveFuncCallRector allows users to configure a list of function names (e.g., var\_dump) to be completely removed from the code. RemoveFuncCallArgRector allows users to specify function names and argument positions to remove specific arguments from those function calls.

rules/Removing/Rector/FuncCall · high confidence

New side-effect detection logic for dead code removal

The DeadCode rules now include two new helper classes, PureFunctionDetector and SideEffectNodeDetector, to more accurately identify expressions with side effects. PureFunctionDetector uses PHPStan's reflection to determine if a function call is pure, while SideEffectNodeDetector analyzes various expression types (like method calls, new instances, and function calls) to decide if they should be preserved during dead code elimination. This improves the safety of removing unused code by better distinguishing between pure computations and operations that produce side effects.

rules/DeadCode/SideEffect · high confidence

New skipper subsystem for precise rule and path exclusions

The \src/Skipper\ directory introduces a new skipper subsystem that refines how Rector handles exclusions. It adds a \PathNormalizer\ to standardize path separators and a \FileInfoMatcher\ to robustly match file paths against configured patterns, supporting both absolute and relative paths as well as wildcard globbing. The \SkippedClassResolver\ and \SkippedPathsResolver\ parse the \SKIP\ configuration option to identify which rules and file paths should be ignored. These components feed into \PathSkipper\ and \SkipSkipper\, which determine whether a specific file or rule instance should be bypassed. The central \Skipper\ class orchestrates these checks, while the \UsedSkipCollector\ tracks which skip rules and paths were actually triggered during execution, enabling the detection and reporting of unused skip configurations.

src/Skipper · high confidence

New static call transformation rules for converting to functions, methods, and new instances

Three new configurable rector rules have been added to the Transform/Rector/StaticCall location: StaticCallToFuncCallRector converts specific static method calls into standalone function calls; StaticCallToMethodCallRector replaces static calls with instance method calls (supporting constructor injection or direct instantiation); and StaticCallToNewRector transforms static factory-style calls (like JsonResponse::create) into direct object instantiation (new JsonResponse). These rules allow users to automatically refactor static call patterns into more flexible or modern instantiation styles.

rules/Transform/Rector/StaticCall · high confidence

New switch-statement refactoring rules and deprecation of legacy pattern

This location introduces three new code-quality rectors for the \Switch\_\ namespace: \SingularSwitchToIfRector\ converts switch statements containing a single case into simpler if statements; \SwitchTrueToMatchRector\ upgrades \switch (true)\ patterns with single-return cases into PHP 8.0+ \match (true)\ expressions, requiring a default arm to preserve fallthrough semantics; and \SwitchTrueToIfRector\ is deprecated, warning users that expanding \switch (true)\ into multiple if statements reduces readability and recommending \match (true)\ as the modern alternative.

rules/CodeQuality/Rector/Switch\ · high confidence_

New ternary simplification rules for array, numeric, and boolean patterns

This location introduces several new code-quality rector rules that automatically simplify ternary expressions into more idiomatic PHP constructs. Specifically, the new \ArrayKeyExistsTernaryThenValueToCoalescingRector\ converts \array\_key\_exists()\ checks with null fallbacks to the null coalescing operator (\??\), while \TernaryEmptyArrayArrayDimFetchToCoalesceRector\ performs a similar conversion for empty array checks. The \NumberCompareToMaxFuncCallRector\ replaces ternary comparisons of integers against a constant with \max()\ function calls, and \TernaryImplodeToImplodeRector\ simplifies ternaries that conditionally return an empty string or an \implode()\ result into a direct \implode()\ call. Additionally, \SimplifyTautologyTernaryRector\ removes redundant ternaries where both branches return the same value, and \UnnecessaryTernaryExpressionRector\ strips ternaries that merely wrap boolean comparisons or invert boolean logic.

rules/CodeQuality/Rector/Ternary · high confidence

New transform value objects for code migration rules

Added a suite of value objects in the \rules/Transform/ValueObject\ directory to support various code transformation rules. These include \ArrayDimFetchToMethodCall\ for converting array access to method calls, \AttributeKeyToClassConstFetch\ for mapping attribute keys to class constants, \ConstFetchToClassConstFetch\ for migrating global constants to class constants, and several others for converting between function calls, static calls, and method calls (e.g., \FuncCallToMethodCall\, \MethodCallToStaticCall\, \StaticCallToFuncCall\). Additional value objects like \WrapReturn\ and \StringToClassConstant\ provide configuration structures for specific refactoring patterns, enabling more precise and type-safe code migrations within the Rector framework.

rules/Transform/ValueObject · high confidence

New type declaration node analyzers for improved type inference

The TypeDeclaration rules now include a suite of new NodeAnalyzer classes that provide shared logic for type resolution and parameter matching. These analyzers enable more precise type inference for array callback parameters (ArrayCallbackParamTypeResolver), resolve return and argument types from method/static calls (CallTypesResolver), match parameters between caller and callee signatures (CallerParamMatcher), and complete class method parameter types based on usage (ClassMethodParamTypeCompleter). Additional helpers detect autowired dependencies (AutowiredClassMethodOrPropertyAnalyzer), analyze class method and property assignments (ClassMethodAndPropertyAnalyzer), find strict type declarations (DeclareStrictTypeFinder), resolve JMS type attributes (JMSTypeAnalyzer), detect never-returning functions (NeverFuncCallAnalyzer), and analyze return statements (ReturnAnalyzer). A new analyzer also infers property types from setUp assignments in test classes (SetUpAssignedPropertyTyper).

rules/TypeDeclaration/NodeAnalyzer · high confidence

New type declaration node manipulators for automatic return type inference

Added five new classes in the \rules/TypeDeclaration/NodeManipulator\ directory to automatically infer and add return types to PHP functions and methods. \AddNeverReturnType\ assigns the \never\ type to functions that only throw or contain never-returning calls. \AddReturnTypeFromCast\ infers return types from cast expressions in return statements. \AddReturnTypeFromParam\ assigns a return type matching a typed parameter when that parameter is returned unchanged. \AddReturnTypeFromStrictNativeCall\ infers return types based on the return values of strict native function calls. \AddUnionReturnType\ adds union return types when the inferred return type is a union. These manipulators support Rector's type declaration rules by providing specialized logic for different inference scenarios.

rules/TypeDeclaration/NodeManipulator · high confidence

New type inference rules for properties, return types, and array narrowing

The TypeInferer location now includes several new components that enhance automatic type declaration. AssignToPropertyTypeInferer infers property types by analyzing assignments and default values, while ReturnTypeInferer determines function return types by examining returned nodes. SilentVoidResolver improves void type detection by correctly handling switch statements and other control flow structures. Additionally, SplArrayFixedTypeNarrower narrows generic array types for specific classes like SplFixedArray and PhpCsFixer tokens, and FunctionLikeReturnTypeResolver provides a utility for mapping function return types to PHPStan types.

rules/TypeDeclaration/TypeInferer · high confidence

New type node analyzers for union type inspection

Added GenericTypeNodeAnalyzer and MixedArrayTypeNodeAnalyzer to the DeadCode rules, enabling more precise detection of generic types and mixed array types within union type nodes. These new utilities allow the dead code detection logic to better identify and remove unused code that involves complex type structures.

rules/DeadCode/TypeNodeAnalyzer · high confidence

New type resolvers for array dimension fetch and assignment variables

Added two new internal type-resolving classes, ArrayDimFetchTypeResolver and AssignVariableTypeResolver, to the CodeQuality rules. These components improve the accuracy of static type inference for array dimension fetch operations and variable assignments, enabling more precise code quality rules that rely on knowing the specific types of array keys and assigned values.

rules/CodeQuality/TypeResolver · high confidence

New type-analysis helpers for data providers and return types

The TypeAnalyzer directory now includes several new classes that improve how Rector infers and validates types. ParameterTypeFromDataProviderResolver extracts parameter types from PHPUnit data providers by analyzing return arrays and yield statements, allowing more accurate type declarations for test methods. ReturnStrictTypeAnalyzer collects strict return types from method calls, static calls, function calls, and literals, handling native vs. docblock return types and normalizing static types. NullableTypeAnalyzer resolves nullable object types by stripping null from union types. PropertyTypeDefaultValueAnalyzer checks for conflicts between property types and their default values. GenericClassStringTypeNormalizer checks if all types in a union are GenericClassStringType. These changes enhance the accuracy of type inference during refactoring.

rules/TypeDeclaration/TypeAnalyzer · high confidence

New type-declaration rules for PHPUnit, Doctrine, JMS Serializer, and Behat

This update introduces a suite of new Rector rules in the TypeDeclaration/Class\_ directory that automatically add PHP type declarations based on context-specific patterns. For PHPUnit tests, rules now add void return types to test methods with no return, infer property types from @var docblocks in setUp(), detect MockObject assignments from createMock(), and type properties assigned via container get() or repository getRepository() calls. For Doctrine, a new rule infers return types on EntityRepository subclasses based on method names like findOneBy or findBy. For JMS Serializer, properties annotated with \#\[Type(...)\] attributes are now typed as nullable scalars or objects. Finally, Behat context classes can have their static properties typed from @var docblocks.

rules/TypeDeclaration/Rector/Class\ · high confidence_

New type-declaration rules for array function closures

Added four new Rector rules in the TypeDeclaration/FuncCall directory that automatically infer and add type hints to closure parameters in array functions. The new rules cover \array\_any\ and \array\_all\ (adding or narrowing types based on item type), standard functions like \array\_filter\ and \array\_map\ (inferring types from the iterable), and cases where array dimension fetches are used inside closures (adding \array\ type hints). These changes improve code quality by ensuring closure parameters are properly typed based on the data they process.

rules/TypeDeclaration/Rector/FuncCall · high confidence

New type-declaration rules for closures, array functions, and yields

This update introduces several new Rector rules in the TypeDeclaration/FunctionLike directory that automatically add type hints to improve code strictness. The new AddClosureParamTypeForArrayMapRector infers parameter types for closures passed to array\_map based on the array arguments. AddClosureParamTypeForArrayReduceRector adds type hints to the carry and value parameters of closures in array\_reduce. AddClosureParamTypeFromIterableMethodCallRector applies type hints to closures in iterable method calls (like map) by analyzing the collection's key and value types. AddClosureParamTypeFromVariableCallRector infers object types for closure parameters by examining the arguments used when the closure variable is invoked. AddParamTypeSplFixedArrayRector adds generic type annotations to SplFixedArray parameters for specific known classes (e.g., PhpCsFixer Tokens). Finally, AddReturnTypeDeclarationFromYieldsRector adds return type declarations to functions and methods based on the types of values they yield.

rules/TypeDeclaration/Rector/FunctionLike · high confidence

New type-declaration rules for strict param types and array docblocks

This location introduces three new Rector rules to improve type safety in PHP code. The \AbstractParamTypeByMethodCallTypeRector\ provides a shared engine that infers and adds parameter types based on the types of arguments passed by callers, with concrete subclasses narrowing the scope to specific type groups. The \AddMethodCallBasedStrictParamTypeRector\ specifically targets private methods, automatically adding strict parameter types derived from the types of arguments used in local method calls. Additionally, the \AddParamArrayDocblockBasedOnCallableNativeFuncCallRector\ analyzes calls to native functions like \array\_walk\ to add precise array element types to parameter docblocks, ensuring better type information for array parameters.

rules/TypeDeclaration/Rector/ClassMethod · high confidence

New utility classes for configuration merging, memory management, and reflection

The src/Util directory now includes several new helper classes to support internal tooling. ArrayParametersMerger provides a recursive configuration merge with left-side priority, while ArrayChecker offers a simple existence check via a callable. MemoryLimiter validates and applies PHP memory limits from configuration, and FileHasher generates fast hashes (using xxh128 on PHP 8.1+ or md4 otherwise) for strings and files. NodePrinter formats AST nodes for console output with syntax highlighting, and PrivatesAccessor allows safe access to private methods and properties via reflection (handling PHP 8.1+ changes). Additional utilities include PhpVersionFactory for parsing version strings, RectorClassesSorter for filtering and sorting rectors, NewLineSplitter for line splitting, and StringUtils for regex matching.

src/Util · high confidence

New value objects for argument manipulation rules

Added five new value objects in the \rules/Arguments/ValueObject\ namespace to support argument-related refactoring rules: \ArgumentAdder\ and \ArgumentAdderWithoutDefaultValue\ for specifying new method arguments, \RemoveMethodCallParam\ for removing specific parameters, and \ReplaceArgumentDefaultValue\ and \ReplaceFuncCallArgumentDefaultValue\ for changing default values in method and function calls respectively.

rules/Arguments/ValueObject · high confidence

New value objects for constant and method visibility changes

Added ChangeConstantVisibility and ChangeMethodVisibility value objects in the Visibility rules namespace to encapsulate the class, target member name, and visibility level required for refactoring operations. These classes provide a structured way to represent visibility change intents, including validation via RectorAssert, supporting the underlying logic for modifying constant and method access modifiers.

rules/Visibility/ValueObject · high confidence

New value objects for naming rule context

Added five new value objects in the \rules/Naming/ValueObject\ directory to encapsulate context for naming transformations: \ExpectedName\ holds a name and its singularized form; \ParamRename\ captures current and expected parameter names along with the variable and function context; \PropertyRename\ stores property rename details including class context and validation assertions; \VariableAndCallAssign\ links a variable to its assignment and call expression; and \VariableAndCallForeach\ links a variable to its foreach iteration and call expression. These classes provide structured data for the naming rules to operate on.

rules/Naming/ValueObject · high confidence

New value objects for removing method arguments and function call arguments

Added ArgumentRemover and RemoveFuncCallArg value objects to the rules/Removing/ValueObject directory. ArgumentRemover stores details for removing a specific argument from a class method (class, method, position, value), while RemoveFuncCallArg stores details for removing an argument from a function call (function name, argument position). These classes provide the structured data needed for refactoring rules that remove arguments from code.

rules/Removing/ValueObject · high confidence

New value objects for type declaration rules

Added new value objects in the TypeDeclaration rules namespace to encapsulate metadata for type declarations. Specifically, AddParamTypeDeclaration, AddPropertyTypeDeclaration, and AddReturnTypeDeclaration store details about class, method, and parameter/property types for automatic type inference. Additionally, AssignToVariable captures variable assignment context, and DataProviderNodes aggregates class methods from PHPUnit attributes and PHPDoc tags to support data provider detection.

rules/TypeDeclaration/ValueObject · high confidence

New value objects for version comparison conditions

Added two new value objects, VersionCompareCondition and BinaryToVersionCompareCondition, to the DeadCode rule set. These classes encapsulate the data required for version comparison logic, with VersionCompareCondition storing version integers and comparison signs, and BinaryToVersionCompareCondition wrapping a VersionCompareCondition along with binary class and expected value information.

rules/DeadCode/ValueObject · high confidence

New version-bonding infrastructure for conditional rule activation

This change introduces the core filtering and configuration components for Rector's version-bonding system. It adds interfaces (ComposerPackageConstraintInterface, MinPhpVersionInterface, RelatedPolyfillInterface) that allow rules to declare dependencies on specific Composer package versions, PHP versions, or polyfill packages. Corresponding filter classes (ComposerPackageConstraintFilter, PhpVersionedFilter) implement the logic to skip rules whose constraints are not met by the current project environment, including support for a configurable PHP version ceiling for polyfilled rules. A new value object (ComposerBoundRuleConfiguration) supports the configuration API for binding rules to specific package version constraints.

src/VersionBonding · high confidence

New visibility rules for class methods

Two new Rector rules have been added to the Visibility category. The ExplicitPublicClassMethodRector now automatically adds the explicit public keyword to class methods that lack a visibility modifier, improving code clarity. Additionally, the ChangeMethodVisibilityRector allows users to configure specific parent class methods to have their visibility changed in child classes (for example, enforcing protected visibility), helping to maintain consistent access control across inheritance hierarchies.

rules/Visibility/Rector/ClassMethod · high confidence

Rector now adds FilesystemIterator::SKIP\_DOTS for PHP 8.2 compatibility

The new FilesystemIteratorSkipDotsRector rule ensures that instantiations of FilesystemIterator explicitly include the SKIP\DOTS flag when targeting PHP 8.2. Since PHP 8.2 changed the default behavior to no longer skip dots, this rector automatically adds the flag to existing code (e.g., changing \new FilesystemIterator(\\DIR\\_, FilesystemIterator::KEY\_AS\_FILENAME)\ to include \\| FilesystemIterator::SKIP\_DOTS\), preserving the previous behavior where dots were skipped by default.

rules/Php82/Rector/New\ · high confidence_

Remove unused variables from closure use clauses

A new dead-code rule has been added to automatically remove variables that are declared in a closure's \use()\ clause but are never actually referenced inside the closure body. This helps clean up code by eliminating unnecessary variable imports, resulting in more concise and readable closures.

rules/DeadCode/Rector/Closure · high confidence

Remove unused variables in catch blocks

The new RemoveUnusedVariableInCatchRector rector now automatically removes unused variables from catch clauses (e.g., changing \catch (Throwable $e)\ to \catch (Throwable)\) when the variable is not used within the catch block, the associated finally block, or in subsequent statements. This feature requires PHP 8.0+ to support non-capturing catch syntax.

rules/Php80/Rector/Catch\ · high confidence_

Remove zero arguments from break and continue statements

A new rector rule has been added to automatically remove the literal zero argument from \break 0\ and \continue 0\ statements, simplifying them to \break\ and \continue\. This change aligns code with PHP 5.4+ behavior where a zero argument is treated as invalid or redundant, ensuring cleaner control flow without altering the logic for non-zero or variable arguments.

rules/Php54/Rector/Break\ · high confidence_

Support for $this::class syntax in PHP 8.0

A new rector rule has been added to handle the PHP 8.0 feature allowing $this::class. When refactoring code for PHP 8.0, instances of $this::class are automatically converted to static::class or self::class depending on whether the class is final, ensuring compatibility and adherence to best practices for late static binding.

rules/Php80/Rector/ClassConstFetch · high confidence

Support for multi-catch exception syntax in PHP 7.1+

The new MultiExceptionCatchRector automatically refactors multiple consecutive catch blocks handling the same logic into a single multi-catch statement using the pipe (\|) separator, a feature introduced in PHP 7.1. This reduces code duplication and improves readability by merging catch clauses that contain identical statements.

rules/Php71/Rector/TryCatch · high confidence

Support for null coalescing assignment operator (??=)

A new rector rule has been added to automatically convert existing null coalescing assignments (e.g., \$array\['key'\] = $array\['key'\] ?? 'value'\) into the shorter null coalescing assignment operator (\$array\['key'\] ??= 'value'\). This change is available for PHP 7.4 and later, allowing users to modernize their codebase with more concise syntax.

rules/Php74/Rector/Assign · high confidence

Support for readonly anonymous classes in PHP 8.3

A new rector rule has been added to automatically decorate anonymous classes with the \readonly\ keyword when they contain only readonly properties. This change aligns code with PHP 8.3's new feature, ensuring that anonymous classes are properly marked as immutable where applicable.

rules/Php83/Rector/Class\ · high confidence_

Support for refactoring strncmp, strpos, and substr patterns to str\_starts\_with

The Php80 rules now detect and refactor additional legacy string-comparison patterns into the native PHP 8.0 \str\_starts\_with\ function. This change introduces new matchers for \strncmp\, \strpos\, and \substr\ calls that check if a string begins with a specific needle. Specifically, \strpos\ comparisons against \0\ are converted, while \strncmp\ and \substr\ patterns are converted when they use \strlen\ for the length argument or compare against a hardcoded string with a matching numeric length. This expands the automated modernization capabilities for string prefix checks.

rules/Php80/MatchAndRefactor · high confidence

Removals

Removal of InjectAnnotationToConstructorReconstructor

The \InjectAnnotationToConstructorReconstructor\ class has been removed from the codebase. This component previously handled the automatic conversion of properties marked with \@inject\ annotations into private properties with corresponding constructor parameters and assignments. Its removal means this specific automatic dependency injection pattern transformation is no longer performed by the rector system.

src/Reconstructor · high confidence

Architecture

Refactored property renaming logic into dedicated helper classes

The property renaming rules have been restructured to improve maintainability by extracting specific responsibilities into new classes: MatchTypePropertyRenamer handles the core logic for renaming properties based on type matching, PropertyFetchRenamer manages the traversal and update of property access nodes within a class, and PropertyPromotionRenamer specifically handles the renaming of promoted constructor parameters in PHP 8+. This change isolates the concerns of type-based renaming, fetch updating, and constructor promotion, making the renaming process more modular without altering the external behavior of the rules.

rules/Naming/PropertyRenamer · high confidence

Behavioural changes

Added PHP 8.0/8.1 compatibility stubs for Rector analysis

The stubs-rector package now includes internal stub definitions for PHP 8.0 and 8.1 features, ensuring Rector can analyze codebases running on older PHP versions. New files define stubs for PHP 8.0 additions like \ReflectionUnionType\, \ReflectionAttribute\, and the \Attribute\ class, as well as PHP 8.1 additions including \UnitEnum\, \BackedEnum\, \ReturnTypeWillChange\, \ReflectionIntersectionType\, and the \MHASH\XXH\\ constants. A stub for \PHPUnit\\Framework\\TestCase\ is also provided to support mocking in older environments. These definitions allow static analysis tools to understand modern language constructs without requiring the runtime to be upgraded.

stubs-rector · high confidence

Added PHP 8.1 enum constants for attribute names and null-to-strict-null function mappings

The Php81 rule set now includes two new enum classes to support stricter type handling. AttributeName defines the 'AllowDynamicProperties' attribute constant, enabling rules to target this specific PHP 8.1 attribute. NameNullToStrictNullFunctionMap provides a comprehensive mapping of functions (such as preg\_split, strlen, and json\_decode) to their string parameters, allowing the tool to enforce strict null checks on these arguments when upgrading to PHP 8.1's stricter typing requirements.

rules/Php81/Enum · high confidence

Added attribute decorators for Doctrine and Sensio param converters

New attribute decorators have been introduced to handle specific PHP 8 attribute transformations. The DoctrineConverterAttributeDecorator now converts string 'true'/'false' values to boolean constants in Doctrine ORM Column attributes, while the SensioParamConverterAttributeDecorator removes the name from the first argument of Sensio ParamConverter attributes to resolve a known issue.

rules/Php80/AttributeDecorator · high confidence

Added guards to prevent removal of specific PHPDoc types

New guard classes, StandaloneTypeRemovalGuard and TemplateTypeRemovalGuard, have been introduced in the DeadCode PhpDoc rules to protect certain type annotations from being incorrectly removed. StandaloneTypeRemovalGuard ensures that standalone 'true' and 'false' types are preserved when associated with boolean identifiers, while TemplateTypeRemovalGuard prevents the removal of PHPStan template types and mixed template unions, ensuring that generic type information remains intact during dead code analysis.

rules/DeadCode/PhpDoc/Guard · high confidence

Added guards to prevent unsafe type declarations on parameters and properties

New guard classes (ParamTypeAddGuard and PropertyTypeOverrideGuard) have been introduced to refine how Rector applies type declarations. ParamTypeAddGuard now prevents adding parameter types when the argument is reassigned or used in conditional logic within the function, avoiding incorrect static analysis assumptions. PropertyTypeOverrideGuard ensures that property types are only added if they do not conflict with parent class definitions, specifically protecting against covariance fatal errors when protected properties on non-final classes might be redeclared untyped in child classes.

rules/TypeDeclaration/Guard · high confidence

Added safety guards for PHP 7.4 typed property changes

Introduced two new guard classes, MakePropertyTypedGuard and PropertyTypeChangeGuard, within the Php74 ruleset to prevent unsafe automatic type additions. These guards ensure that properties are only typed if they are single-property declarations, belong to actual classes (excluding traits and interfaces), do not conflict with existing trait properties, and are either private, protected in final classes with safe parent lookups, or marked for inline public visibility.

rules/Php74/Guard · high confidence

Automated fixes for PHP 8.5 deprecations in array\_key\_exists, chr, ord, and finfo\_buffer

New rector rules have been added to automatically update code for four PHP 8.5 deprecations: passing null to array\_key\_exists is replaced with an empty string, out-of-range integers in chr() are wrapped with a modulo 256 operation, multi-byte strings in ord() are sliced to the first character, and the deprecated context argument in finfo\_buffer() is removed.

rules/Php85/Rector/FuncCall · high confidence

CoalesceToTernaryRector rule deprecated and disabled

The CoalesceToTernaryRector rule has been deprecated and effectively disabled because the ?? and ?: operators are not interchangeable (?: also falls back on empty string, 0, and empty arrays). The rule now throws an exception if triggered, requiring users to manually fix any regressions caused by previous automatic transformations.

rules/CodeQuality/Rector/Coalesce · high confidence

Deprecated DisallowedEmptyRuleFixerRector in Strict rules

The DisallowedEmptyRuleFixerRector, previously used to automatically convert empty() checks into explicit strict comparisons (e.g., $items === \[\]), has been deprecated. While the rule remains present in the codebase, it now throws a ShouldNotHappenException upon execution, signaling that users should refactor their code to use clear type comparisons instead of relying on this automated fixer, which was deemed to produce unreadable code.

rules/Strict · high confidence

Deprecation of Encapsed String Rector rules

The \EncapsedStringsToSprintfRector\ and \WrapEncapsedVariableInCurlyBracesRector\ rules in the CodingStyle package are now deprecated. These rules, which previously converted interpolated strings to \sprintf\/concat or wrapped variables in curly braces, now throw exceptions at runtime. This change reflects the decision that such transformations are matters of personal preference or coding standards best handled by dedicated linting tools, rather than automated refactoring rules.

rules/CodingStyle/Rector/Encapsed · high confidence

Deprecation of FluentSettersToStandaloneCallMethodRector rule

The FluentSettersToStandaloneCallMethodRector rule, which previously attempted to transform fluent setter chains into standalone method calls, has been deprecated. This change reflects that breaking fluent chains into individual statements requires a more complex, context-aware approach due to varying method return semantics, making the previous automatic transformation unsafe. Users relying on this rule will now encounter a deprecation notice and a runtime exception if the rule is executed, indicating that this specific code style transformation is no longer supported in its prior form.

rules/Unambiguous/Rector/Expression · high confidence

Deprecation of RemoveAnnotationRector and RemoveTypedPropertyNonMockDocblockRector

The RemoveAnnotationRector and RemoveTypedPropertyNonMockDocblockRector rules in the DeadCode set are now deprecated. These rules no longer perform any code transformations; attempting to use them will throw an exception. The RemoveAnnotationRector is deprecated because removing annotations by name is considered a coding standard concern rather than an upgrade path, and the RemoveTypedPropertyNonMockDocblockRector is deprecated as it offers no real value for removing specific @var docblocks on typed properties.

rules/DeadCode/Rector/ClassLike · high confidence

Deprecation of automatic sensitive parameter attribute addition

The AddSensitiveParameterAttributeRector rule in the Php82 set has been deprecated. Previously, this rule automatically added the \#\[\\SensitiveParameter\] attribute to function parameters based on a configured list of names. The new implementation throws an exception upon execution, indicating that matching parameters by name is considered vague and risky. Users are now advised to manually add the \#\[\\SensitiveParameter\] attribute to specific parameters where needed, rather than relying on automatic detection.

rules/Php82/Rector/Param · high confidence

Deprecation of legacy set configuration and introduction of version-bonded rules

The Set component has been refactored to deprecate the legacy object-based set model (SetInterface, SetProviderInterface, Set, ComposerTriggeredSet) in favor of version-bonded rules that implement ComposerPackageConstraintInterface. This change means sets are no longer matched against installed packages via object instances; instead, rules now state the exact package version their target API is available from and apply upwards. Consequently, many specific PHP version sets (PHP\_52 through PHP\_86) and framework-specific sets (Laravel, Drupal) in SetList and SetGroup are deprecated, with users advised to use withPhpSets(), withPhpLevel(), or composer-based sets instead. New interfaces and value objects like ComposerTriggeredSet and SetGroup provide the updated mechanism for defining and matching sets based on Composer package constraints.

src/Set · high confidence

Deprecation of the @deprecated annotation to \#\[Deprecated\] attribute conversion rule

The rule that automatically converted @deprecated annotations on constants and traits into the new \#\[Deprecated\] attribute has been deprecated. This change reflects the distinction that the \#\[Deprecated\] attribute triggers runtime deprecation warnings, whereas the @deprecated annotation is a static hint; they serve different purposes and are not interchangeable. Users should instead rely on tools like phpstan/phpstan-deprecation-rules for reporting deprecated annotations.

rules/Php85/Rector/Const\ · high confidence_

Deprecation of the AddAssertArrayFromClassMethodDocblockRector rule

The \AddAssertArrayFromClassMethodDocblockRector\ rule in the Assert ruleset has been deprecated. This rule, which previously attempted to generate runtime assertions (such as \Webmozart\\Assert\\Assert::allInteger\) from PHPDoc \@param\ type declarations, is now marked as deprecated because converting docblock types into runtime checks is considered risky, academic, and adds unnecessary performance overhead. The rule's implementation now throws a \ShouldNotHappenException\ upon execution, signaling that users should write custom rules if they require this specific functionality.

rules/Assert · high confidence

Deprecation of the Nested Function Calls to Pipe Operator Rector

The rule that automatically converted nested function calls into PHP 8.5 pipe operator chains has been deprecated. While the code remains present to identify the target syntax, attempting to apply this transformation now throws an exception, preventing the generation of unreadable, excessively long pipe chains. Users relying on this automatic refactoring will need to handle such conversions manually or remove the rule from their configuration.

rules/Php85/Rector/Expression · high confidence

Deprecation of the RemoveReturnThisFromSetterClassMethodRector rule

The Rector rule that previously attempted to remove 'return $this' from setter methods to enforce void return types is now deprecated. This change reflects that such a transformation can break existing fluent APIs where callers rely on the method returning the instance. Attempting to use this rule will now result in an error, encouraging users to handle setter return types manually or via more context-aware solutions.

rules/Unambiguous/Rector/Class\ · high confidence_

Deprecation of the Sequential Assignments to Pipe Operator Rector

The rector rule that automatically transforms sequential variable assignments into the PHP pipe operator (\|\>) has been deprecated. Users relying on this rule will now encounter a runtime exception instead of code transformation, as the maintainers determined that merging assignments into pipe chains removes meaningful intermediate variable names and can significantly reduce code readability. This change affects the Php85 rector rules specifically targeting statement-aware nodes.

rules/Php85/Rector/StmtsAwareInterface · high confidence

EarlyReturn rules restructured and several deprecated

The EarlyReturn rule set has been reorganized into a new PSR-4 directory structure, introducing new helper classes like ConditionInverter and BareSingleAssignIf to support active transformations. Several existing rules—ChangeNestedForeachIfsToEarlyContinueRector, ChangeNestedIfsToEarlyReturnRector, ChangeOrIfContinueToMultiContinueRector, and ReturnBinaryOrToEarlyReturnRector—have been deprecated and now throw exceptions to prevent usage, as their transformations were deemed to reduce code readability. Meanwhile, active rules such as RemoveAlwaysElseRector, ChangeIfElseValueAssignToEarlyReturnRector, PreparedValueToEarlyReturnRector, and ReturnEarlyIfVariableRector remain available to refactor code by replacing conditional assignments and nested structures with early returns.

rules/EarlyReturn · high confidence

Enum case naming rule deprecated

The EnumCaseToPascalCaseRector rule has been deprecated and now throws an exception when executed. This change reflects that the rule is considered risky because it does not handle enum usage across the entire code context. Users are advised to handle enum case naming conversions manually, via their IDE, or by implementing a custom rule instead.

rules/CodingStyle/Rector/Enum\ · high confidence_

Fix empty list() syntax errors in PHP 7.0+

The tool now automatically fixes invalid empty list() declarations (e.g., list() = $values;) by injecting a dummy unused variable, ensuring compatibility with PHP 7.0 and later where empty lists are no longer allowed.

rules/Php70/Rector/List\ · high confidence_

Improved docblock merging for promoted properties

The tool now better handles PHP 8 property promotion by merging docblocks from constructor parameters into the resulting class properties. This new logic ensures that @param tags take priority over @var tags when both are present, and correctly transfers type information from property docblocks to constructor parameters when the parameter lacks an explicit type hint, resulting in more accurate and consistent documentation after refactoring.

rules/Php80/DocBlock · high confidence

Improved type generalization and union handling in privatization rules

The privatization rules now produce more accurate and concise PHPDoc types by generalizing specific constant types (such as true, false, and literal strings) into broader base types like bool and string. Additionally, the system better handles union types containing arrays by identifying their shared structure, which helps prevent overly verbose or complex union docblocks when narrowing types.

rules/Privatization/TypeManipulator · high confidence

Improved type resolution for constant arrays and yield statements in docblock generation

The TypeDeclarationDocblocks rule now includes two new internal resolvers to handle specific PHP type scenarios more accurately. ConstantArrayTypeGeneralizer prevents excessively deep nesting in array shape docblocks by capping recursion at three levels, falling back to mixed types for deeper structures. YieldTypeResolver improves the detection of return types for generators by analyzing yield expressions, correctly identifying Iterator or Generator types and their generic item types based on the yielded values.

rules/TypeDeclarationDocblocks/TypeResolver · high confidence

Introduce centralized PHP-based configuration entry point

The configuration system now uses a single \config/config.php\ file as the main entry point, replacing previous YAML-based setups. This file initializes the \RectorConfig\ with default settings such as parallel execution, specific indentation rules, and cache directories, while explicitly disabling features like auto-importing and unused import removal to prevent unintended side effects. It also dynamically loads internal extension configurations via \ExtensionConfigResolver\ and sets options to maintain backward compatibility with fluent calls and reporting paths.

config · high confidence

Introduce dedicated node manipulators for class and switch renaming

The renaming logic is now handled by new dedicated classes: ClassRenamer manages the renaming of class names, fully qualified names, and PHPDoc annotations while tracking renamed names via RenamedNameCollector, and SwitchManipulator adjusts break statements in switch blocks to account for removed cases. This refactors the renaming process into specific node manipulators, improving maintainability and precision of the renaming behavior.

rules/Renaming/NodeManipulator · high confidence

Introduces specialized resolvers for detecting unused and overridden method parameters

The DeadCode analysis engine now utilizes two new internal classes, OverriddenParameterResolver and UnusedParameterResolver, to more accurately identify parameters that are never read. OverriddenParameterResolver specifically detects parameters whose values are immediately overwritten by a direct assignment before any usage, while UnusedParameterResolver identifies parameters that are completely unused within the method body. This refinement allows the tool to provide more precise dead code removal suggestions for method signatures.

rules/DeadCode/NodeCollector · high confidence

Introduction of specific exception classes and enhanced ShouldNotHappenException

The exception handling layer now includes dedicated exception classes for specific failure scenarios: CachingException, InvalidConfigurationException, RectorRuleNameAmbiguousException, RectorRuleNotFoundException, NotImplementedYetException, MissingPrivatePropertyException, and VersionException. Additionally, ShouldNotHappenException has been improved to automatically generate a default error message indicating the calling method and line number when no message is provided, aiding in debugging unexpected internal errors.

src/Exception · high confidence

Nette Utils library updated with Rector-prefixed namespaces

The vendor/nette/utils library has been updated, introducing a namespace prefix (RectorPrefix202609) to all classes and interfaces. This change affects core components such as the SmartObject trait, ArrayHash and ArrayList collections, and the CachingIterator, ensuring that the library's utilities are correctly isolated within the prefixed namespace.

vendor/nette/utils · high confidence

New and deprecated coding style rules for if statements

A new \AlternativeIfToBracketRector\ rule has been added to automatically convert PHP alternative if/elseif/else/endif syntax into standard bracket syntax. Additionally, the \NullableCompareToNullRector\ rule is now deprecated; it previously converted implicit null checks to explicit comparisons, but users should now use instanceof checks instead as null comparisons are considered ambiguous.

rules/CodingStyle/Rector/If\ · high confidence_

New and deprecated docblock inference rules for class methods

The \rules/TypeDeclarationDocblocks/Rector/ClassMethod\ area now includes several new Rector rules that automatically add \@param\ and \@return\ array docblocks based on code patterns: inferring array element types from \array\_map\ closures, parameter references, data provider data, and array dimension fetches; and inferring return types from JSON decoding, direct array instances, property \@var\ tags, and common object denominators. Additionally, a rule refines Doctrine \ArrayCollection\ union types into generic forms. Several older, less reliable inference rules (e.g., based on \array\_map\ closures, data providers, or copying docblocks from other methods) are now deprecated and throw exceptions to prevent vague or incorrect type guessing.

rules/TypeDeclarationDocblocks/Rector/ClassMethod · high confidence

New and updated class refactoring rules

This location introduces several new code-quality rules for PHP classes: CompleteDynamicPropertiesRector adds missing dynamic properties as explicit class members; ConvertStaticToSelfRector changes static:: references to self:: on final classes or for private static members; InlineConstructorDefaultToPropertyRector moves property defaults from the constructor to the property declaration; InnerFunctionToPrivateMethodRector converts inner named functions inside class methods into private methods; RemoveReadonlyPropertyVisibilityOnReadonlyClassRector removes the readonly modifier from properties and constructor parameters in readonly classes; and ReturnIteratorInDataProviderRector adds an Iterator return type to PHPUnit data provider methods that use yield. Additionally, DynamicDocBlockPropertyToNativePropertyRector is deprecated and now throws an exception because it previously changed public @property access to private native properties, which could break code relying on public access.

rules/CodeQuality/Rector/Class\ · high confidence_

New arrow function refactoring rule and deprecation of static arrow function rule

A new coding style rule, ArrowFunctionDelegatingCallToFirstClassCallableRector, has been added to automatically convert arrow functions that simply delegate a call (e.g., \fn ($p) =\> Class::method($p)\) into PHP 8.1+ first-class callable syntax (e.g., \Class::method(...)\). Additionally, the StaticArrowFunctionRector, which previously converted arrow functions to static when possible, is now deprecated and throws an exception if invoked, advising users to apply this change manually or via custom rules instead.

rules/CodingStyle/Rector/ArrowFunction · high confidence

New console commands for composer-bound rules and deprecated legacy commands

The console layer introduces a new \composer-based\ command that displays a table of Rector rules and configurations bound to specific Composer package versions, indicating which are active based on the installed versions. Additionally, the \custom-rule\, \list-rules\, and \setup-ci\ commands are now deprecated; they no longer generate files or list rules, instead returning a failure exit code with an error message directing users to use AI agents or explicit configuration.

src/Console · high confidence

New dead-code detection analyzers for method calls, parameters, and variables

The DeadCode rule engine now includes a suite of new NodeAnalyzer classes to improve the accuracy of unused code detection. CallCollectionAnalyzer and IsClassMethodUsedAnalyzer handle complex scenarios such as fluent method chains, null-safe calls, static calls, and dynamic array-based method invocations (e.g., \array\_map\). CallLikeParamDefaultResolver identifies parameters with null defaults to support related cleanup rules. NoDiscardCallAnalyzer detects calls marked with the \\#\[NoDiscard\]\ attribute to prevent their removal. Additional analyzers (ExprUsedInNodeAnalyzer, UsedVariableNameAnalyzer, PropertyWriteonlyAnalyzer, SafeLeftTypeBooleanAndOrAnalyzer, ParentClassAnalyzer) refine variable usage checks, property write-only detection, and boolean expression safety, ensuring that code is only removed when it is truly dead.

rules/DeadCode/NodeAnalyzer · high confidence

New guard prevents property renaming when it conflicts with existing property names

A new \MatchPropertyTypeConflictingNameGuard\ class has been added to the naming rules. This component checks whether a proposed property rename would conflict with the expected names of other properties in the same class. It resolves expected names based on property types (falling back to current names if type-based resolution fails) and filters for names that appear at least twice, ensuring that renames do not create ambiguity or collisions within the class structure.

rules/Naming/Guard/PropertyConflictingNameGuard · high confidence

New internal naming infrastructure for variable and property suggestions

The \rules/Naming/Naming\ directory now contains a suite of new helper classes (including \AliasNameResolver\, \ConflictingNameResolver\, \ExpectedNameResolver\, \OverriddenExistingNamesResolver\, \PropertyNaming\, \UseImportsResolver\, and \VariableNaming\) that provide the core logic for resolving expected variable names, detecting naming conflicts, and analyzing naming conventions. These components form the internal engine that enables Rector's naming-related rules to suggest more descriptive variable and property names based on types, method names, and existing code context.

rules/Naming/Naming · high confidence

New value objects for tracking pending and used imports

The \PendingImports\ and \UsedImports\ value objects have been added to the \Rector\\CodingStyle\\ClassNameImport\\ValueObject\ namespace. \PendingImports\ provides a mutable container for collecting use, function, and constant imports during the post-rector chain, allowing the system to queue imports to be added in the next \UseAddingPostRector\ run. \UsedImports\ serves as an immutable snapshot of the currently used imports (including aliased types) for a file. These objects support the internal logic for managing and deduplicating import statements during code style transformations.

rules/CodingStyle/ClassNameImport/ValueObject · high confidence

PHPStan configuration files for Rector integration

Added three new PHPStan configuration files (better-infer.neon, parser.neon, static-reflection.neon) to customize static analysis behavior for Rector. The better-infer.neon enables private property type inference from constructors, parser.neon configures a custom parser chain using Rector's RichParser and caching, and static-reflection.neon sets up dynamic source locators for better reflection capabilities.

config/phpstan · high confidence

Rector 2.3 introduces breaking API changes for custom rule writers

This release upgrades Rector to require PHP 7.4+ and adopts PHP-Parser 5 and PHPStan 2. For users maintaining custom rules, the \AbstractScopeAwareRector\ base class has been removed in favor of \AbstractRector\ with explicit \ScopeFetcher\ usage, and the \getRuleDefinition()\ method is no longer required. Additionally, the \FileWithoutNamespace\ node is deprecated and replaced by \FileNode\, which now handles both namespaced and non-namespaced files, requiring updates to \getNodeTypes()\ and \refactor()\ implementations.

(repo-wide) · high confidence

Rector bootstrap rewritten for scoped installations and improved error reporting

The bin/rector entry point has been completely rewritten to support Rector installed as a scoped Composer package. It now uses a dedicated AutoloadIncluder to intelligently load the correct vendor/autoload.php (project, repository, or global) and respects the --autoload-file CLI option, replacing the previous bootstrap.php logic. Additionally, the script now includes explicit error handling that reports fatal configuration errors in JSON format when requested, and defines the \_\_RECTOR\RUNNING\\_ constant to signal execution context.

bin · high confidence

Rector configuration sets reorganized and updated for PHP 8.4 support

The configuration sets in the \config/set\ directory have been reorganized and updated. Several sets (e.g., \early-return\, \if\, \instanceof\) are now empty as their rules were moved to other sets or deprecated. New sets like \behat-annotations-to-attributes\ and \datetime-to-carbon\ have been added. The \php-version-based\ set has been significantly expanded to include rules for PHP 8.3 and 8.4 features, such as \JsonValidateRector\ and various \ForeachToArray\*\ rectors. The \php-polyfills\ set now includes rules for PHP 8.4 polyfills. The \code-quality\ and \coding-style\ sets now use centralized level configurations (\CodeQualityLevel\, \CodingStyleLevel\).

config/set · high confidence

Rector contract interfaces restructured and deprecated

The Rector contract layer has been reorganized to support a more modular architecture. Several new marker and functional interfaces have been introduced: \ResettableInterface\ for dependency injection reset capabilities, \DecoratingNodeVisitorInterface\ to tag node visitors that decorate AST nodes, \ConfigurableRectorInterface\ to standardize rule configuration via \Symplify\\RuleDocGenerator\, and \HTMLAverseRectorInterface\ to allow rules to skip files containing HTML nodes. The core \RectorInterface\ has been simplified to extend \NodeVisitor\ directly, exposing \getNodeTypes()\ and \refactor()\. Concurrently, the legacy \ReconstructorInterface\ has been removed, indicating a shift away from the previous reconstruction-based approach in favor of the new visitor-centric model.

src/Contract · high confidence

Refactor type declaration logic into dedicated property assignment detectors

The type declaration rules now use a set of specialized detectors to determine if a property is already assigned, improving the accuracy of type inference. The new \ConstructorAssignDetector\ analyzes assignments within constructors and PHPUnit setup methods, correctly handling conditional assignments and avoiding false positives when a property is used within its own assignment. The \NullTypeAssignDetector\ specifically checks for assignments that warrant an added null type, while excluding Doctrine collections. Additionally, \PropertyDefaultAssignDetector\ identifies properties initialized with default values at declaration. These changes refine how the tool detects existing property states to prevent redundant type declarations.

rules/TypeDeclaration/AlreadyAssignDetector · high confidence

Refactored ClassNameImport rule into modular helper classes

The ClassNameImport logic in the CodingStyle rules has been restructured into several dedicated helper classes to improve maintainability and separation of concerns. New components include AliasUsesResolver for identifying aliased imports, ClassNameImportSkipper for determining when to skip import resolution based on voters, NamespaceBeforeClassNameResolver for extracting namespace prefixes, ShortNameResolver for mapping short names to fully qualified names (including PHPDoc analysis), UseImportsTraverser for iterating over use statements, and UsedImportsResolver for aggregating all used imports. This refactoring organizes the internal mechanics of the class name import feature without changing its external behavior.

rules/CodingStyle/ClassNameImport · high confidence

Refactored NodeNameResolver to use a pluggable strategy pattern

The NodeNameResolver component has been restructured to replace its previous monolithic implementation with a pluggable strategy pattern. A new NodeNameResolverInterface defines the contract for individual resolvers, and specific classes (such as ClassNameResolver, FuncCallNameResolver, and VariableNameResolver) now handle name resolution for distinct PHP-Parser node types. The central NodeNameResolver class delegates to these specialized strategies, allowing for more modular and maintainable name resolution logic within the Rector codebase.

src/NodeNameResolver · high confidence

Refactored dead PHPDoc tag detection into dedicated analyzers

The logic for identifying unused or redundant PHPDoc tags (@param, @return, @var) has been extracted from the main rule into three new, specialized analyzer classes: DeadParamTagValueNodeAnalyzer, DeadReturnTagValueNodeAnalyzer, and DeadVarTagValueNodeAnalyzer. This change improves the maintainability and precision of the dead code removal process by isolating the complex type-comparison and guard-checking logic for each tag type, ensuring that redundant documentation is removed more reliably without affecting valid type hints.

rules/DeadCode/PhpDoc · high confidence

Refactored property type inference into specialized inferer classes

The property type inference logic in the TypeDeclaration rules has been restructured into distinct, specialized classes: AllAssignNodePropertyTypeInferer, GetterTypeDeclarationPropertyTypeInferer, SetterTypeDeclarationPropertyTypeInferer, and TrustedClassMethodPropertyTypeInferer. This change replaces the previous monolithic approach with a modular strategy where specific inferers handle different sources of type information, such as inferring types from getter return values, setter parameter types, or direct assignments within class methods. For users, this improves the precision and maintainability of automatic type declarations added by Rector, particularly for properties initialized via method parameters or returned by getters.

rules/TypeDeclaration/TypeInferer/PropertyTypeInferer · high confidence

Refined class name import skipping logic

The ClassNameImportSkipVoter system has been expanded with seven new specific voters to prevent unnecessary or conflicting use statements. These voters now skip imports when a class is already aliased, when a class-like name exists in the same namespace, when a fully qualified name is already used directly, when the original node name is preserved, when the name is a reserved keyword, when short class imports are disabled, or when a different class with the same short name is already imported.

rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter · high confidence

Refined property type decoration and union type analysis

The system now uses a new DetailedTypeAnalyzer to prevent overly complex union types (limiting them to 3 types) during type declaration analysis. Additionally, the PropertyTypeDecorator has been updated to better handle union types: it now assigns the type node directly for PHP 8.0+ environments, adds a null default value when null is part of the union, and conditionally updates PHPDoc @var tags only when necessary (e.g., for specific array types), improving the accuracy and cleanliness of generated type declarations.

rules/TypeDeclaration/NodeTypeAnalyzer · high confidence

Removal of CodeStyledPrinter class

The CodeStyledPrinter class has been removed from the codebase. This class previously handled printing code changes to files and strings using PhpParser's Standard pretty printer, including a check to skip writing if the original and new nodes were identical. Its removal indicates a shift in how code output is handled, likely moving towards a different printing mechanism or format-preserving transformation as suggested by the commit context.

src/Printer · high confidence

RenameClassRector now prevents renaming to identical class names

The RenameClassRector in the Renaming rules now validates configuration during setup and throws an InvalidConfigurationException if an old class name is mapped to the same new class name, preventing no-op or confusing rename operations.

rules/Renaming/Rector/Name · high confidence

Replaced null arguments with strict types in string and preg\_split functions

The rector rules in rules/Php81/Rector/FuncCall now automatically replace null arguments with strict types (empty string '' or integer 0) in functions like preg\_split and other string operations. This change aligns code with PHP 8.1's deprecation of passing null to string/int parameters, ensuring that calls such as preg\_split('/ /', $output, null) are converted to preg\_split('/ /', $output, 0) or preg\_split('\#a\#', '') to prevent deprecation warnings and improve type safety.

rules/Php81/Rector/FuncCall · high confidence

Replaces Symfony-based container with a custom RectorConfig factory

The dependency injection layer has been refactored to remove the Symfony HttpKernel dependency. The old AppKernel and ContainerFactory classes are deleted and replaced by a new LazyContainerFactory and RectorContainerFactory that build the container using a custom RectorConfig DSL. This change simplifies the container bootstrap, removes the need for Symfony compiler passes, and provides a more explicit, code-driven configuration for services, commands, and node visitors.

src/DependencyInjection · high confidence

ScalarValueToConstFetchRector deprecated

The ScalarValueToConstFetchRector rule has been deprecated because it is too broad and risks replacing scalar values in unrelated contexts, such as array keys or version numbers. The rule now throws an exception if executed, and users are advised to create custom, scoped rules for specific replacement needs instead.

rules/Transform/Rector/Scalar · high confidence

Skip AssignArrayToStringRector when variable is not previously defined

The AssignArrayToStringRector now skips processing when the assigned variable has not been defined before the assignment. This prevents false positives where the rector might incorrectly attempt to convert a string to an array in cases where the variable's initial state is unknown or undefined.

rules/Php71/Rector/Assign · high confidence

StaticCallOnNonStaticToInstanceCallRector is deprecated

The StaticCallOnNonStaticToInstanceCallRector, which previously attempted to convert static calls to instance calls, is now deprecated and throws an exception if executed. This change reflects the assessment that the transformation is risky and offers little value, so users should remove this rule from their configuration or apply such changes manually.

rules/Php70/Rector/StaticCall · high confidence

Test coverage

Added PHP 5.3 compatibility test fixture; Added end-to-end test for class matching on PHP 7.4; Added end-to-end tests for Rector configuration and PHP 5.3 parsing; Added end-to-end tests for the RenameSimpleRector rule; Refactored testing infrastructure with new fixture and test case components; Removed test infrastructure for InjectAnnotationToConstructorReconstructor.

Dependencies

Updated Rector dependency to version 2.6.2

The Rector static analysis and refactoring tool has been updated to version 2.6.2. This upgrade brings in the latest bug fixes and improvements from the Rector project, ensuring that automated code refactoring and static analysis features remain up to date with the latest PHP standards and best practices.

src/Application, vendor · high confidence

Updated Rector to commit 0e96615c363cc0c29834f10461e16d25e74122e4

The Rector dependency has been updated to commit 0e96615c363cc0c29834f10461e16d25e74122e4, bringing in the latest changes from the upstream repository.

(dependencies) · high confidence

Updated Rector to commit 1d141d573432ebc152383bf884f488dc62619f0c

The Rector static analysis and refactoring engine has been updated to commit 1d141d573432ebc152383bf884f488dc62619f0c. This update brings the latest improvements and bug fixes from the upstream Rector repository to the PhpParser component.

src/PhpParser · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 41 → 65 (+23.3)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 92 → 88 (-4.5)
  • Architecture 94 → 91 (-2.6)
  • Maturity 62 → 66 (+3.6)
  • Readiness 24 → 56 (+31.9)
  • Security 37 → 70 (+33.2)

Resolved (27)

  • Coverage not measured — test suite did not build
  • Dimension evaluation failed
  • Duplicated block (5 lines × 2) (rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php)
  • Duplicated block (6 lines × 2) (rules/Php84/Rector/Foreach_/ForeachToArrayAllRector.php)
  • Duplicated block (6 lines × 2) (rules/Php84/Rector/Foreach_/ForeachToArrayAnyRector.php)
  • Duplicated block (7 lines × 2) (rules/Php84/Rector/FuncCall/AddEscapeArgumentRector.php)
  • Duplicated block (9 lines × 2) (src/NodeAnalyzer/CallLikeArgumentNameAdder.php)
  • Duplicated block (9 lines × 2) (src/NodeAnalyzer/CallLikeArgumentNameAdder.php)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 7 more

New (352)

  • AbstractParamTypeByMethodCallTypeRector.refactorFunctionLike (cognitive 20) (rules/TypeDeclaration/Rector/ClassMethod/AbstractParamTypeByMethodCallTypeRector.php)
  • AddArrayFunctionClosureParamTypeRector.refactor (cognitive 23) (rules/TypeDeclaration/Rector/FuncCall/AddArrayFunctionClosureParamTypeRector.php)
  • AddArrowFunctionParamArrayWhereDimFetchRector.refactor (cognitive 24) (rules/TypeDeclaration/Rector/FuncCall/AddArrowFunctionParamArrayWhereDimFetchRector.php)
  • AddClosureParamTypeForArrayMapRector.refactor (cognitive 18) (rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php)
  • AddClosureParamTypeFromIterableMethodCallRector.refactor (cognitive 19) (rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php)
  • AddClosureParamTypeFromIterableMethodCallRector.refactor (cyclomatic 16) (rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php)
  • AddEscapeArgumentRector.refactor (cognitive 19) (rules/Php84/Rector/FuncCall/AddEscapeArgumentRector.php)
  • AddEscapeArgumentRector.refactor (cyclomatic 16) (rules/Php84/Rector/FuncCall/AddEscapeArgumentRector.php)
  • AddOverrideAttributeToOverriddenMethodsRector.shouldSkipParentClassMethod (cognitive 18) (rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php)
  • AddOverrideAttributeToOverriddenMethodsRector.shouldSkipParentClassMethod (cyclomatic 17) (rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php)
  • AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.refactor (cognitive 30) (rules/TypeDeclaration/Rector/ClassMethod/AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.php)
  • AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.refactor (cyclomatic 29) (rules/TypeDeclaration/Rector/ClassMethod/AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.php)
  • AddParamArrayDocblockFromAssignsParamToParamReferenceRector.refactor (cognitive 16) (rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockFromAssignsParamToParamReferenceRector.php)
  • AddParamArrayDocblockFromDimFetchAccessRector.refactor (cognitive 25) (rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockFromDimFetchAccessRector.php)
  • AddParamBasedOnParentClassMethodRector.refactor (cognitive 25) (rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php)
  • AddParamBasedOnParentClassMethodRector.refactor (cyclomatic 16) (rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php)
  • AddParamFromDimFetchKeyUseRector.refactor (cognitive 37) (rules/TypeDeclaration/Rector/ClassMethod/AddParamFromDimFetchKeyUseRector.php)
  • AddParamStringTypeFromSprintfUseRector.refactor (cognitive 16) (rules/TypeDeclaration/Rector/ClassMethod/AddParamStringTypeFromSprintfUseRector.php)
  • AddReturnDocblockForArrayDimAssignedObjectRector.isVariableExclusivelyArrayDimAssigned (cognitive 34) (rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddReturnDocblockForArrayDimAssignedObjectRector.php)
  • AddReturnDocblockForArrayDimAssignedObjectRector.isVariableExclusivelyArrayDimAssigned (cyclomatic 17) (rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddReturnDocblockForArrayDimAssignedObjectRector.php)
  • …and 332 more

Changes since last survey

  • 279 commits — 279 feature/other, 0 fixes

By area

  • vendor/composer — 76 commits
  • src/Application — 62 commits
  • vendor/rector — 28 commits
  • rules/TypeDeclarationDocblocks — 13 commits
  • config/set — 12 commits
  • rules/CodeQuality — 11 commits
  • src/Configuration — 7 commits
  • rules/DeadCode — 6 commits
  • rules/TypeDeclaration — 6 commits
  • vendor/symfony — 6 commits
  • rules/CodingStyle — 4 commits
  • rules/Php84 — 4 commits
  • src/BetterPhpDocParser — 4 commits
  • rules/Naming — 3 commits
  • rules/Php74 — 3 commits
  • rules/Transform — 3 commits
  • (root) — 2 commits
  • rules/Renaming — 2 commits
  • src/Caching — 2 commits
  • src/ChangesReporting — 2 commits

Notable commits

  • change: Rector 2.6.2
  • change: Rector 2.6.3
  • change: Rector 2.6.4
  • change: Rector 2.6.5
  • change: Rector 2.6.6
  • change: Rector 2.6.7
  • change: Updated Rector to commit 02ca77e04d38b1210ca514e9a1e066b559f12d15
  • change: Updated Rector to commit 0381177ec98f11475610f46836e18453b3f85ff4
  • change: Updated Rector to commit 052375d871b7a0770871dd046e1c657b124370ef
  • change: Updated Rector to commit 054379c853b1f7f7578b285ffe14f142d9966fbc
  • change: Updated Rector to commit 0607fe06fd59d2582ba10caaa722d565d82100ed
  • change: Updated Rector to commit 0639221afa10449f3f22c1d908509e6ede505baf
  • change: Updated Rector to commit 0639221afa10449f3f22c1d908509e6ede505baf
  • change: Updated Rector to commit 067194ef92ab62106d6fed017745a8b634c7dc24
  • change: Updated Rector to commit 0919678db52fe2ede06192b3b19834401da4a472
  • change: Updated Rector to commit 091e1ef77c4c4881d5ba38f98dc9e5b8827610f4
  • change: Updated Rector to commit 09a140b0ceb3c01e17ee8340fda470f607417816
  • change: Updated Rector to commit 09ee9549d7e20c168004ec0111ba165f91350541
  • change: Updated Rector to commit 0c2c04e93063219e00302cd86c06d96b62e28d5b
  • change: Updated Rector to commit 0c2c04e93063219e00302cd86c06d96b62e28d5b
  • …and 259 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

rectorphp/rector was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 26 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 721b50224691b6782803b602b6ae8c6147539fb4 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-a15879f6f801.