-
-
Notifications
You must be signed in to change notification settings - Fork 2
Update PHP and Yii2 versions, enhance README.md, and refine asset management.
#86
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
Conversation
|
Warning Rate limit exceeded@terabytesoftw has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 55 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis update modernizes the project's dependencies and workflows, raising the PHP requirement to 8.2, updating Yii2 and related packages, and reorganizing configuration and CI files. Several new configuration files are introduced for code quality tools, while obsolete or redundant files are removed. Minor formatting and namespace adjustments are made throughout the codebase. Workflow triggers and PHP versions are updated, and environment constants are set explicitly. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub Actions
participant Composer
participant ECS
participant Rector
Developer->>GitHub Actions: Push or PR triggers workflows
GitHub Actions->>Composer: Install/update dependencies (PHP 8.2+)
GitHub Actions->>ECS: Run code style checks (ecs.yml)
GitHub Actions->>Rector: Run code upgrades (rector.php)
GitHub Actions->>Composer: Run scripts (dependency-check, tests, etc.)
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…ersion to `8.2`.
…ic into fix-mini-1
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: 6
🔭 Outside diff range comments (1)
phpstan.neon (1)
20-22:⚠️ Potential issueVerify and refine
excludePathspattern.The new
excludePaths: - vendorentry may not exclude all files undervendor. PHPStan expects glob patterns (e.g.,vendor/**orvendor/*) to ignore directories recursively. Also confirm thatscanFilesforvendor/yiisoft/yii2/Yii.phpis still included despite this exclusion.Apply this diff:
@@ -20,3 +20,4 - excludePaths: - - vendor + excludePaths: + - vendor/**
🧹 Nitpick comments (4)
package.json (1)
1-6: Ensure reproducible installs and metadata
A newpackage.jsonlists frontend dependencies, but there's no lockfile (e.g.,package-lock.jsonoryarn.lock) committed to lock down versions. Please add a lockfile to guarantee consistent installs. Also consider adding standard metadata fields (name,version,license, etc.) if you plan to publish or maintain this package long-term.src/UseCase/Contact/ContactController.php (1)
10-11: Good practice: Explicit function import improves code clarity.Adding the explicit import for
array_mergefollows modern PHP best practices and improves static analysis capabilities. This change aligns well with the code quality improvements mentioned in the PR objectives.Consider applying this pattern consistently across the codebase for all global functions used within namespaced classes to maintain consistency and improve static analysis.
ecs.php (1)
41-48: Consistent spacing for named arguments.For readability, align the spacing in
withPreparedSets, e.g. changecomments:truetocomments: true.- ->withPreparedSets( - cleanCode: true, - comments:true, - docblocks: true, - namespaces: true, - strict: true, - ) + ->withPreparedSets( + cleanCode: true, + comments: true, + docblocks: true, + namespaces: true, + strict: true, + ).github/workflows/ecs.yml (1)
25-28: Use YAML sequences forphpandosinputs.Using proper list literals avoids parsing ambiguities in composite actions.
- os: >- - ['ubuntu-latest'] + os: + - ubuntu-latest - php: >- - ['8.2'] + php: + - '8.2'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (34)
.github/workflows/build.yml(1 hunks).github/workflows/compatibility.yml(0 hunks).github/workflows/dependency-check.yml(1 hunks).github/workflows/ecs.yml(1 hunks)README.md(2 hunks)composer.json(3 hunks)config/config-plugin.php(0 hunks)config/params-web.php(1 hunks)config/web/components.php(2 hunks)config/web/extension.php(1 hunks)ecs.php(1 hunks)package.json(1 hunks)phpstan-yii-config.php(0 hunks)phpstan.neon(1 hunks)public/index.php(1 hunks)rector.php(1 hunks)src/Framework/Asset/AppAsset.php(1 hunks)src/Framework/Asset/ToggleThemeAsset.php(1 hunks)src/Framework/EventHandler/ContactEventHandler.php(1 hunks)src/Framework/resource/layout/component/footer-icons.php(5 hunks)src/Framework/resource/layout/component/menu.php(1 hunks)src/Framework/resource/layout/footer.php(1 hunks)src/Framework/resource/layout/main.php(1 hunks)src/UseCase/Contact/ContactController.php(1 hunks)src/UseCase/Contact/Index/IndexAction.php(1 hunks)src/UseCase/Site/view/about.php(2 hunks)src/UseCase/Site/view/index.php(2 hunks)tests/Acceptance/SiteCest.php(1 hunks)tests/Functional/ContactCest.php(1 hunks)tests/Support/AcceptanceTester.php(1 hunks)tests/Support/Data/UserIdentity.php(1 hunks)tests/Support/FunctionalTester.php(1 hunks)tests/Support/UnitTester.php(1 hunks)tests/Unit/ContactControllerCest.php(1 hunks)
💤 Files with no reviewable changes (3)
- phpstan-yii-config.php
- config/config-plugin.php
- .github/workflows/compatibility.yml
🧰 Additional context used
🪛 GitHub Actions: static analysis
composer.json
[error] 1-1: Composer dependency resolution failed: PHP version requirement >=8.2 not met (current version 8.1.32).
[error] 1-1: Composer dependency resolution failed: Package 'yii2-extensions/localeurls' requires PHP >=8.2 but current PHP version is 8.1.32.
🔇 Additional comments (33)
src/Framework/resource/layout/component/menu.php (1)
47-47: Consistent formatting: trailing comma in method call
A trailing comma was added after->width(200)to align with the project's updated code style rules and ECS configuration. This is purely stylistic; no functional change.tests/Support/UnitTester.php (1)
21-21: Fixed PHPDoc closing syntax
The PHPDoc block termination has been corrected from an invalid token to*/. This improves comment validity without affecting functionality.tests/Support/FunctionalTester.php (1)
21-21: Fixed PHPDoc closing syntax
Adjusted the docblock ending to*/for proper PHPDoc formatting, matching related test support files.tests/Support/AcceptanceTester.php (1)
21-21: Fixed PHPDoc closing syntax
Corrected the docblock termination to*/, ensuring consistent and valid PHPDoc across all support tester classes.src/UseCase/Site/view/about.php (2)
8-8: Good PHPDoc formatting improvement.Condensing the simple PHPDoc comment to a single line improves readability and follows modern PHP documentation standards.
19-20: Excellent addition of trailing comma.Adding trailing commas to function arguments is a good practice that makes version control diffs cleaner and reduces the chance of syntax errors when adding new arguments in the future.
src/Framework/resource/layout/main.php (1)
29-29: Good practice adding trailing comma to array.The trailing comma addition follows modern PHP practices and makes future array modifications cleaner in version control diffs.
tests/Support/Data/UserIdentity.php (1)
32-32: Excellent security improvement with strict type checking.Adding the strict parameter to
in_array()enforces strict type comparison, which is crucial for identity validation. This prevents potential type juggling vulnerabilities and ensures more precise identity matching.tests/Functional/ContactCest.php (1)
62-62: Good formatting improvement with trailing comma.Adding the trailing comma to the method argument follows modern PHP practices and maintains consistency with the broader code style improvements in this PR.
src/Framework/Asset/AppAsset.php (1)
7-8:✅ Verification successful
Excellent migration to official Yii2 Bootstrap 5 package.
The namespace change from custom
Yii2\Assetto officialyii\bootstrap5improves maintainability and aligns with the Yii2 ecosystem standards.Please ensure all Bootstrap asset references are updated consistently:
🏁 Script executed:
#!/bin/bash # Description: Verify all Bootstrap asset references use the new namespace # Expected: No references to old Yii2\Asset namespace should remain echo "Checking for any remaining old Bootstrap asset imports..." rg "Yii2\\\\Asset" --type php echo "Verifying new Bootstrap 5 namespace usage..." rg "yii\\\\bootstrap5" --type php -A 2 echo "Checking for any Bootstrap asset class usage that might need updating..." rg "BootstrapAsset|BootstrapPluginAsset" --type php -A 1 -B 1Length of output: 1831
All Bootstrap asset references updated successfully
No remaining imports of the old
Yii2\Assetnamespace were found. Verified consistent usage of the officialyii\bootstrap5package in:
- src/Framework/Asset/AppAsset.php
- src/Framework/Asset/ToggleThemeAsset.php
Great job on the migration—everything is aligned with the Yii2 Bootstrap 5 package.
tests/Unit/ContactControllerCest.php (1)
22-22: LGTM - Formatting aligns with coding standards.The removal of the space between
fnand()is a minor formatting improvement that aligns with the coding standards updates mentioned in this PR.src/UseCase/Site/view/index.php (1)
8-8: LGTM - PHPDoc simplification is appropriate.The single-line PHPDoc format is cleaner and appropriate for simple type annotations.
src/Framework/Asset/ToggleThemeAsset.php (1)
7-7:✅ Verification successful
Bootstrap 5 migration looks good, verify consistency across codebase.
The namespace update from
Yii2\Asset\BootstrapAssettoyii\bootstrap5\BootstrapAssetcorrectly aligns with the Bootstrap 5 upgrade. This change supports the modernization objectives of the PR.Please verify that all Bootstrap asset imports have been consistently updated across the codebase:
🏁 Script executed:
#!/bin/bash # Description: Verify all Bootstrap asset imports use the new yii\bootstrap5 namespace # Expected: All imports should use yii\bootstrap5\BootstrapAsset rg "BootstrapAsset" --type php -A 2 -B 2Length of output: 1215
Bootstrap 5 migration verified
All instances of
BootstrapAssetin thesrc/Framework/Assetdirectory now import fromyii\bootstrap5\BootstrapAsset. No remaining references to the old namespace were found.Files checked:
- src/Framework/Asset/ToggleThemeAsset.php
- src/Framework/Asset/AppAsset.php
No further action needed.
src/Framework/EventHandler/ContactEventHandler.php (1)
29-32: Critical syntax fix: Missing comma resolved.The addition of the missing comma after the translation string argument is essential - this was a syntax error that would have caused PHP parsing failures. The formatting improvements also enhance code readability.
This fix is crucial for the application to function correctly and demonstrates good attention to detail in code quality.
.github/workflows/dependency-check.yml (1)
28-29: Align composer-require-checker with PHP ≥ 8.2.The PHP version for the
composer-require-checkerjob has been bumped to 8.2, matching the new minimum requirement. Ensurecomposer.jsonalso specifies PHP ≥8.2 to avoid version mismatches..github/workflows/build.yml (1)
28-30: Update build matrix to PHP 8.2–8.4 and drop 8.1.Your change adjusts the CI to test against PHP versions 8.2, 8.3, and 8.4, which aligns perfectly with the project's updated PHP requirement and the removal of unsupported versions.
README.md (2)
9-14: Refresh PHP and Yii2 version badges.The header badges now accurately reflect PHP ≥8.2 and Yii2 22. This keeps the documentation in sync with the codebase and points users to the correct pages.
150-154: Add “Quality code” section for static analysis badges.Introducing a dedicated “Quality code” section for PHPStan and StyleCI badges improves organization and highlights our code quality practices.
src/Framework/resource/layout/footer.php (1)
33-45: LGTM! Trailing commas improve code maintainability.The addition of trailing commas to method call arguments follows modern PHP coding standards and improves code maintainability by making future additions cleaner and reducing diff noise.
config/web/components.php (2)
33-34: Configuration change looks correct for localized URL management.The switch to
UrlLanguageManagerand addition of thelanguagesconfiguration properly enables multi-language URL support. Ensure that$params['yii2.localeurls.languages']is defined in your parameter files.
5-5:✅ Verification successful
Verify the yii2-extensions/localeurls package is properly installed.
The import change suggests switching to a localized URL manager. Ensure the
yii2-extensions/localeurlspackage is included in composer dependencies.
🏁 Script executed:
#!/bin/bash # Description: Verify the localeurls package is installed and check for parameter configuration # Expected: Package should be in composer.json and params should be defined echo "Checking composer.json for localeurls package:" cat composer.json | jq -r '.require, .["require-dev"] | to_entries[] | select(.key | contains("localeurls")) | "\(.key): \(.value)"' echo -e "\nSearching for yii2.localeurls.languages parameter definition:" rg -A 5 -B 5 "yii2\.localeurls\.languages"Length of output: 1769
All Set:
localeurlsPackage and Parameters Confirmed
- composer.json includes
yii2-extensions/localeurls: dev-main- config/params-web.php defines the
yii2.localeurls.languagesparameterNo further action required.
config/web/extension.php (1)
1-25: Well-structured development environment configuration.This file follows Yii2 best practices for conditionally loading development tools:
- Proper use of
YII_ENV_DEVconstant for environment detection- Standard configuration for debug and gii modules
- Includes security consideration with commented IP allowlist
- Clean separation of development vs production concerns
The structure allows for easy merging with main application configuration.
src/UseCase/Contact/Index/IndexAction.php (2)
24-24: Good improvement: Adding default value for constructor parameter.Adding a default empty array for the
$configparameter improves the usability of the action class and follows good PHP practices.
29-29:✅ Verification successful
Verify the return type change doesn't break existing usage.
The return type was changed from
Response|stringto juststring. While$this->controller->render()typically returns a string, ensure this change doesn't break any code that might have been expecting aResponseobject.
🏁 Script executed:
#!/bin/bash # Description: Search for usage of IndexAction to verify return type expectations # Expected: Calls should handle string return type appropriately echo "Searching for IndexAction usage and instantiation:" rg -A 10 -B 5 "IndexAction" --type php echo -e "\nSearching for any code expecting Response return from run() method:" rg -A 5 -B 5 "->run\(\)" --type php | grep -E "(Response|response)"Length of output: 5372
Return type narrowing to
stringis safeI searched the codebase for any direct calls to IndexAction::run() and found no client code handling a
Responseobject. The action is only invoked through the Yii controller, which correctly handles string outputs. You can safely remove theResponseunion from the return type.ecs.php (3)
5-13: ECS imports and entry point look solid.All necessary fixers and the
ECSConfigentry are imported correctly under strict types.
14-33: Configured rules and path settings are clear.The
withConfiguredRulechain andwithPathsdefinitions forsrcandtestsare well scoped.
49-57: Additional rules and skip patterns are appropriate.The extra fixers and
withSkiparrays correctly exclude generated view files..github/workflows/ecs.yml (1)
1-17: Workflow triggers and ignore patterns are well defined.The
pull_requestandpushfilters correctly skip docs and non-code files.composer.json (5)
15-27: PHP requirement and core dependencies updated.Bumping PHP to >= 8.2 and upgrading Yii2 packages aligns with the project’s upgrade path.
38-44: Development dependencies aligned.Adding
phpstan,rector, andeasy-coding-standardis appropriate for the new quality workflows.
67-69: Composer plugin allowances are set correctly.
php-forge/foxyis whitelisted, ensuring the plugin can execute during install.
71-77: New Composer scripts improve developer experience.Scripts for dependency checks, ECS, Rector, PHPStan, and tests provide clear automation entry points.
15-15:✅ Verification successful
Verify CI workflows are on PHP 8.2+.
Since composer.json now requires PHP >= 8.2, ensure all GitHub Actions workflows have been updated accordingly.
🏁 Script executed:
#!/bin/bash # Check for any GitHub Actions workflow still using PHP 8.1 rg "php:\s*\[?8\.1" -n .github/workflowsLength of output: 42
All workflows upgraded to PHP 8.2+
Confirmed that no GitHub Actions workflow still references PHP 8.1—your CI now aligns with the
composer.jsonrequirement of PHP >= 8.2.
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.
Pull Request Overview
This PR updates PHP and Yii2 version requirements, reorganizes configuration files and assets, and refines documentation.
- Updates conversion of assets and namespaces to support new Yii2 version and Bootstrap 5 integration.
- Adjusts workflows, test configurations, and dependency versions for PHP 8.2 and Yii2 22.x.
- Enhances README badges and removes obsolete configuration files.
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Framework/EventHandler/ContactEventHandler.php | Adjusts translation formatting with trailing comma |
| src/Framework/Asset/ToggleThemeAsset.php | Updates asset namespace to yii\bootstrap5 |
| src/Framework/Asset/AppAsset.php | Updates asset namespaces with Bootstrap 5 components |
| rector.php | Introduces new Rector rules and configuration |
| public/index.php | Enables debug mode and sets environment to development |
| phpstan.neon | Removes outdated settings and excludes vendor paths |
| phpstan-yii-config.php | Empties obsolete configuration |
| package.json | Adds new frontend dependency versions |
| ecs.php | Configures EasyCodingStandard with updated parameters |
| config/web/extension.php | Introduces dev environment modules 'debug' and 'gii' |
| config/web/components.php | Replaces URL manager with a locale-aware version |
| config/params-web.php | Updates asset alias paths and icon configuration |
| config/config-plugin.php | Removes obsolete plugin configurations |
| composer.json | Upgrades PHP requirement and dependency versions |
| README.md | Updates badges and documentation to reflect new versions |
| .github/workflows/*.yml | Updates workflow PHP versions and removes deprecated workflows |
… class references in controllers.
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.
Pull Request Overview
This PR updates core platform versions, enhances documentation, and refines asset/config management for PHP and Yii2.
- Bumps minimum PHP to 8.2 and switches Yii2 to 22.x-dev, updating composer and CI workflows accordingly
- Replaces Bootstrap asset imports to
yii\bootstrap5, adjusts frontend paths, and adds code style/rector configs - Improves README badges and moves development defaults in
public/index.php
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Framework/Asset/ToggleThemeAsset.php | Switched import to yii\bootstrap5\BootstrapAsset |
| src/Framework/Asset/AppAsset.php | Updated asset bundle uses to bootstrap5 variants |
| public/index.php | Hardcoded YII_DEBUG=true and YII_ENV='dev' |
| config/web/components.php | Replaced UrlManager with UrlLanguageManager and added languages |
| config/params-web.php | Updated npm alias and fixed FontAwesome SVG path |
| composer.json | Bumped PHP/Yii2 versions, adjusted dependencies and scripts |
| README.md | Updated version badges and added quality badges |
| other config/workflow files | Added ECS and Rector configs, updated CI versions |
Comments suppressed due to low confidence (1)
config/web/components.php:34
- The
yii2.localeurls.languagesparameter is referenced here but not defined inparams-web.php, which will cause an undefined index error. Add this setting toparams-web.phpor provide a fallback default.
'languages' => $params['yii2.localeurls.languages'],
…ironment configuration.
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.
Pull Request Overview
This PR updates the project to PHP 8.2 and Yii2 22.x-dev, refines asset imports and configuration, and adds tooling for code style, static analysis, and rector.
- Bump PHP requirement to >=8.2 and Yii2 to 22.x-dev; update composer, workflows, and README badges
- Refine asset bundles (Bootstrap 5) and switch URL manager to locale-aware implementation
- Introduce ECS, Rector, and PHPStan configs; remove obsolete plugin entries
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Framework/EventHandler/ContactEventHandler.php | Adjust formatting around the Yii::t call in the event handler |
| src/Framework/Asset/ToggleThemeAsset.php | Fixed namespace import for BootstrapAsset |
| src/Framework/Asset/AppAsset.php | Fixed namespace imports for Bootstrap assets |
| rector.php | Added Rector configuration |
| public/index.php | Simplified environment definitions (YII_ENV, YII_DEBUG) |
| phpstan.neon | Updated PHPStan includes/excludes |
| phpstan-yii-config.php | Removed empty Yii config file |
| package.json | Introduced front-end dependencies |
| ecs.php | Added ECS configuration for code style |
| config/web/extension.php | Added debug & gii modules for dev |
| config/web/components.php | Switched to UrlLanguageManager and updated import |
| config/params-web.php | Updated aliases and icon paths |
| config/config-plugin.php | Removed legacy plugin entries |
| composer.json | Bumped versions, updated dependencies, scripts, and plugin config |
| README.md | Updated PHP, Yii2, and quality badges |
| .github/workflows/*.yml | Aligned GitHub Actions to PHP 8.2 |
Comments suppressed due to low confidence (4)
public/index.php:10
- [nitpick] By hard-coding
YII_DEBUGto false you disable debugging in all environments. Consider restoring environment-based logic (e.g., reading from an env var) or removing this line if debug should always be off.
defined('YII_DEBUG') || define('YII_DEBUG', false);
phpstan.neon:1
- The PHPStan Yii2 extension include and
yii2config have been removed. Without them, PHPStan will not understand Yii classes and behaviors. Re-add the extension or configure theyii2section to enable proper analysis.
parameters:
config/config-plugin.php:12
- Legacy plugin entries for bootstrap5, debug, gii, and localeurls were removed. This may prevent those modules from auto-loading. Ensure the plugin loader configuration reflects the new setup or re-add required entries.
'web' => [
src/Framework/EventHandler/ContactEventHandler.php:29
- The trailing comma after the translation string will produce a syntax error in PHP. Remove the comma and restore the closing parenthesis for the
Yii::tcall.
'Thank you for contacting us. We will respond to you as soon as possible.',
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Refactor
Tests