-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop supporting PHP 7.1 and minimum required version 8.1 #48
Conversation
Improve type checks and update Psalm config The commit introduces type checks for string variables, particularly the $docComment variable in src/DocMethod.php and path in src/XmlLoader.php. It also adjusts a boolean condition in src/DocMethod.php and modifies fields in the Psalm config file.
This commit creates a new rector.php configuration file and registers the rule InlineConstructorDefaultToPropertyRector. Additionally, it defines sets of rules available up to PHP 8.1. The PHP version requirement in composer.json is also updated to match this, now requiring PHP 8.1 or above.
Refactor code for PHP 8.1 constructor property promotion Several classes have been refactored to use PHP 8.1's constructor property promotion. This simplifies the code by allowing properties to be defined directly in the constructor. Additionally, various classes now implement the Stringable interface. The version of "rector/rector" in the composer file has also been specified.
The GitHub actions 'static-analysis', 'continuous-integration', and 'coding-standards' have been downgraded from version 2 to version 1. Additionally, the PHP version has been updated to 8.3 in static analysis and coding standards workflows. The 'continuous-integration' workflow now considers PHP 8.3 as the current stable version with 8.1 and 8.2 as old stable versions.
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes focus on downgrading GitHub Actions versions, updating PHP versions and dependencies, and refactoring code for better readability and maintainability. Key updates include modifying workflows, enhancing exception handling, implementing the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
An ignore comment for the PHP Code Sniffer (phpcs) was added to the DocMethod.php. This was necessary to avoid the SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.NoAssignment rule and ensure the code quality standard is met.
@coderabbitai review |
Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Outside diff range and nitpick comments (1)
src/DocClass.php (1)
Line range hint
73-74
: JsonSchema annotation class not found.+ use BEAR\Resource\Annotation\JsonSchema;
Ensure that the
JsonSchema
class is correctly imported to resolve the static analysis issue.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
vendor-bin/tools/composer.lock
is excluded by!**/*.lock
Files selected for processing (20)
- .github/workflows/coding-standards.yml (1 hunks)
- .github/workflows/continuous-integration.yml (1 hunks)
- .github/workflows/static-analysis.yml (1 hunks)
- composer.json (2 hunks)
- phpcs.xml (1 hunks)
- psalm.xml (1 hunks)
- rector.php (1 hunks)
- src/AppMetaModule.php (1 hunks)
- src/Config.php (2 hunks)
- src/DocClass.php (1 hunks)
- src/DocMethod.php (4 hunks)
- src/DocParam.php (2 hunks)
- src/Index.php (2 hunks)
- src/Schema.php (2 hunks)
- src/SchemaConstraints.php (2 hunks)
- src/SchemaProp.php (1 hunks)
- src/Src.php (2 hunks)
- src/TagLinks.php (2 hunks)
- src/TagParam.php (1 hunks)
- src/XmlLoader.php (1 hunks)
Files skipped from review due to trivial changes (3)
- .github/workflows/coding-standards.yml
- .github/workflows/static-analysis.yml
- src/TagParam.php
Additional context used
PHPStan
rector.php
9-9: Parameter $rectorConfig of anonymous function has invalid type Rector\Config\RectorConfig.
16-16: Class Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector not found.
20-20: Access to constant UP_TO_PHP_81 on an unknown class Rector\Set\ValueObject\LevelSetList.
src/AppMetaModule.php
15-15: Class BEAR\ApiDoc\AppMetaModule extends unknown class Ray\Di\AbstractModule.
17-17: Parameter $appMeta of method BEAR\ApiDoc\AppMetaModule::__construct() has invalid type BEAR\AppMeta\AbstractAppMeta.
17-17: Parameter $module of method BEAR\ApiDoc\AppMetaModule::__construct() has invalid type Ray\Di\AbstractModule.
17-17: Property BEAR\ApiDoc\AppMetaModule::$appMeta has unknown class BEAR\AppMeta\AbstractAppMeta as its type.
19-19: BEAR\ApiDoc\AppMetaModule::__construct() calls parent::__construct() but BEAR\ApiDoc\AppMetaModule does not extend any class.
27-27: Call to an undefined method BEAR\ApiDoc\AppMetaModule::bind().
27-27: Class BEAR\AppMeta\AbstractAppMeta not found.
30-30: Call to an undefined method BEAR\ApiDoc\AppMetaModule::bind().
30-30: Class BEAR\Sunday\Extension\Application\AppInterface not found.
31-31: Call to an undefined method BEAR\ApiDoc\AppMetaModule::bind().
31-31: Class BEAR\Resource\Annotation\AppName not found.
src/Src.php
34-34: Instantiated class Rize\UriTemplate not found.
36-36: Class Rize\UriTemplate\Parser not found.
39-39: Class Rize\UriTemplate\Node\Literal not found.
src/SchemaConstraints.php
36-36: No error to ignore is reported on line 36.
src/Index.php
41-41: No error to ignore is reported on line 41.
44-44: Instantiated class phpDocumentor\Reflection\DocBlock\Description not found.
44-44: Instantiated class phpDocumentor\Reflection\DocBlock\Tags\Link not found.
src/XmlLoader.php
59-59: No error to ignore is reported on line 59.
60-60: No error to ignore is reported on line 60.
70-70: No error to ignore is reported on line 70.
src/DocClass.php
31-31: Parameter $reader of method BEAR\ApiDoc\DocClass::__construct() has invalid type Doctrine\Common\Annotations\Reader.
31-31: Property BEAR\ApiDoc\DocClass::$reader has unknown class Doctrine\Common\Annotations\Reader as its type.
73-73: Class BEAR\Resource\Annotation\JsonSchema not found.
74-74: Class BEAR\Resource\Annotation\JsonSchema not found.
src/Config.php
145-145: Instantiated class BEAR\AppMeta\Meta not found.
150-150: Instantiated class Ray\Di\Injector not found.
151-151: Class Ray\Di\InjectorInterface not found.
152-152: Class Doctrine\Common\Annotations\Reader not found.
153-153: Class Doctrine\Common\Annotations\Reader not found.
161-161: Caught class Ray\Di\Exception\Unbound not found.
169-169: Caught class Ray\Di\Exception\Unbound not found.
181-181: Class Aura\Router\Route not found.
190-190: Method BEAR\ApiDoc\Config::getRouterMap() has invalid return type Aura\Router\Map.
190-190: Parameter $injector of method BEAR\ApiDoc\Config::getRouterMap() has invalid type Ray\Di\InjectorInterface.
193-193: Class Aura\Router\RouterContainer not found.
197-197: Caught class Ray\Di\Exception\Unbound not found.
src/DocMethod.php
42-42: Parameter $reader of method BEAR\ApiDoc\DocMethod::__construct() has invalid type Doctrine\Common\Annotations\Reader.
42-42: Property BEAR\ApiDoc\DocMethod::$reader has unknown class Doctrine\Common\Annotations\Reader as its type.
45-45: Call to static method createInstance() on an unknown class phpDocumentor\Reflection\DocBlockFactory.
83-83: Parameter $docblock of method BEAR\ApiDoc\DocMethod::getTagParams() has invalid type phpDocumentor\Reflection\DocBlock.
190-190: Class BEAR\Resource\Annotation\Embed not found.
216-216: Class BEAR\Resource\Annotation\Link not found.
Additional comments not posted (19)
.github/workflows/continuous-integration.yml (1)
10-13
: Ensure the downgraded GitHub Action version is compatible with the new PHP version specifications.psalm.xml (1)
7-9
: Updatedxsi:schemaLocation
and analysis settings align with the new PHP version requirements.src/TagLinks.php (1)
18-25
: Implementation ofStringable
and use of property promotion enhance readability and maintainability.src/SchemaProp.php (1)
14-23
: Implementation ofStringable
and use of property promotion enhance readability and maintainability.src/Src.php (2)
26-29
: Constructor changes look good and align with PHP 8.1 features.
Line range hint
34-34
: Ensure that the classesRize\UriTemplate
,Rize\UriTemplate\Parser
, andRize\UriTemplate\Node\Literal
are correctly included in the project.Also applies to: 36-36, 39-39
src/SchemaConstraints.php (2)
24-24
: Constructor changes look good and align with PHP 8.1 features.
24-24
: The__toString
method implementation is appropriate and well-implemented.src/Index.php (2)
17-17
: The__toString
method implementation is appropriate and well-implemented.
Line range hint
44-44
: Ensure that the classesphpDocumentor\Reflection\DocBlock\Description
andphpDocumentor\Reflection\DocBlock\Tags\Link
are correctly included in the project.src/XmlLoader.php (2)
54-54
: The__invoke
method implementation is appropriate and well-implemented.
54-54
: Thevalidate
method implementation is appropriate and well-implemented.src/DocParam.php (2)
20-20
: Constructor changes look good and align with PHP 8.1 features.
20-20
: The__toString
method implementation is appropriate and well-implemented.phpcs.xml (1)
42-43
: Configuration settings inphpcs.xml
are appropriately tailored to the project's coding standards.composer.json (1)
12-12
: Updated PHP version requirement to "^8.1" aligns with the PR's objective.src/Config.php (1)
169-169
: Updated catch block to use PHP 8.0's feature for catching exceptions without variable assignment.Verification successful
Both instances of catching the
Unbound
exception insrc/Config.php
use PHP 8.0's feature for catching exceptions without variable assignment, ensuring consistency.
src/Config.php
: Lines 169 and another instance in the same file.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of the Unbound exception. # Test: Search for other instances of Unbound being caught. Expect: Consistent handling. rg --type php 'catch \(Unbound\)'Length of output: 121
src/Schema.php (1)
48-52
: Use of property promotion in the constructor simplifies the code and enhances readability.src/DocMethod.php (1)
25-25
: Implementation of the Stringable interface enhances usability by allowing objects of this class to be used directly where a string is expected.
Closes #47