Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request introduces PHPStan for static analysis, adding a configuration file, stubs, and comprehensive PHPDoc type hints throughout the project. It also migrates path-related utility calls to the "WP_CLI\Path" class and refactors type checks to use "instanceof". Key feedback points include the potential for compilation errors due to the removal of Blade component tag handling in "BladeGettextExtractor" and the breaking of inheritance and backward compatibility caused by renaming "multilineQuote" in "PotGenerator".
| $blade_compiler->withoutComponentTags(); | ||
| } | ||
|
|
||
| return $blade_compiler; |
There was a problem hiding this comment.
The removal of the withoutComponentTags() call might lead to compilation errors when BladeOne encounters Blade component tags (<x-...>). Since these tags are manually handled later in the extraction process, disabling their compilation in the main engine is important to prevent the compiler from failing on unresolved components in a non-Laravel environment.
if ( method_exists( $blade_compiler, 'withoutComponentTags' ) ) {
$blade_compiler->withoutComponentTags();
}
return $blade_compiler;| * @return string[] | ||
| */ | ||
| protected static function multilineQuote( $text ) { | ||
| protected static function wpMultilineQuote( $text ) { |
There was a problem hiding this comment.
Renaming multilineQuote to wpMultilineQuote breaks the override of the parent PoGenerator::multilineQuote method. This means any other methods in the parent class that use late static binding to call multilineQuote will no longer use the WP-specific implementation. It also breaks backward compatibility for any third-party code extending this class.
protected static function multilineQuote( $text ) {| */ | ||
| protected static function addLines( array &$lines, $name, $value ) { | ||
| $newlines = self::multilineQuote( $value ); | ||
| $newlines = self::wpMultilineQuote( $value ); |
There was a problem hiding this comment.
This call should be updated to use the original method name and prefer static:: to allow for late static binding, consistent with how the parent PoGenerator class handles this method.
$newlines = static::multilineQuote( $value );References
- In PHP, prefer static:: over self:: for static access to allow consuming classes to override them via late static binding.
No description provided.