-
-
Notifications
You must be signed in to change notification settings - Fork 0
Better namespace, add tests for PHPStan
config and enhanced tests.
#7
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
""" WalkthroughThis update refactors namespaces to lowercase for consistency, enhances type safety and static analysis via PHPStan-specific annotations, and improves test reliability with clearer assertions and fixture validation. Test support models and queries are reorganized, with new files introduced under lowercase namespaces and obsolete files removed. Composer and PHPStan configurations are updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as PHPUnit Test
participant Model as Tree/MultipleTree
participant Query as TreeQuery/MultipleTreeQuery
participant Behavior as NestedSetsBehavior/NestedSetsQueryBehavior
Test->>Model: Call static find()
Model->>Query: Return new Query instance
Query->>Behavior: Attach NestedSetsQueryBehavior via behaviors()
Test->>Model: Perform operation (e.g., makeRoot, appendTo)
Model->>Behavior: Delegate tree operation
Behavior-->>Model: Update tree structure
Test->>Test: Assert result, validate against fixture
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 phpcs (3.7.2)tests/TestCase.phpWarning: PHP Startup: Invalid date.timezone value 'UTC', using 'UTC' instead in Unknown on line 0 Fatal error: Uncaught Error: Class "Phar" not found in /usr/local/bin/phpcs:3 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 (
|
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: 2
🧹 Nitpick comments (2)
tests/support/model/TreeQuery.php (1)
17-22
: Consider adding method documentation for better maintainability.While the
behaviors()
method implementation is correct, adding a brief PHPDoc comment would improve code maintainability:+ /** + * @return array<string> Behaviors attached to this query. + */ public function behaviors(): array { return [ NestedSetsQueryBehavior::class, ]; }tests/support/model/MultipleTreeQuery.php (1)
17-22
: Consider adding method documentation for consistency.For consistency with the TreeQuery class and better maintainability, consider adding method documentation:
+ /** + * @return array<string> Behaviors attached to this query. + */ public function behaviors(): array { return [ NestedSetsQueryBehavior::class, ]; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
composer.json
(3 hunks)phpstan.neon
(1 hunks)src/NestedSetsBehavior.php
(2 hunks)src/NestedSetsQueryBehavior.php
(2 hunks)tests/NestedSetsBehaviorTest.php
(1 hunks)tests/NestedSetsQueryBehaviorTest.php
(1 hunks)tests/Support/Model/MultipleTreeQuery.php
(0 hunks)tests/Support/Model/TreeQuery.php
(0 hunks)tests/TestCase.php
(6 hunks)tests/config/phpstan-config.php
(0 hunks)tests/phpstan-config.php
(2 hunks)tests/support/model/MultipleTree.php
(2 hunks)tests/support/model/MultipleTreeQuery.php
(1 hunks)tests/support/model/Tree.php
(2 hunks)tests/support/model/TreeQuery.php
(1 hunks)
💤 Files with no reviewable changes (3)
- tests/Support/Model/TreeQuery.php
- tests/Support/Model/MultipleTreeQuery.php
- tests/config/phpstan-config.php
🧰 Additional context used
🧬 Code Graph Analysis (5)
tests/support/model/TreeQuery.php (2)
src/NestedSetsQueryBehavior.php (1)
NestedSetsQueryBehavior
(36-142)tests/support/model/MultipleTreeQuery.php (1)
behaviors
(17-22)
tests/phpstan-config.php (4)
tests/support/model/MultipleTree.php (1)
MultipleTree
(18-59)tests/support/model/MultipleTreeQuery.php (1)
MultipleTreeQuery
(15-23)tests/support/model/Tree.php (1)
Tree
(17-55)tests/support/model/TreeQuery.php (1)
TreeQuery
(15-23)
tests/support/model/Tree.php (2)
src/NestedSetsBehavior.php (1)
NestedSetsBehavior
(44-1393)tests/support/model/TreeQuery.php (2)
behaviors
(17-22)TreeQuery
(15-23)
tests/TestCase.php (2)
tests/support/model/MultipleTree.php (2)
MultipleTree
(18-59)find
(55-58)tests/support/model/Tree.php (2)
Tree
(17-55)find
(51-54)
tests/NestedSetsBehaviorTest.php (5)
tests/support/model/MultipleTree.php (1)
MultipleTree
(18-59)tests/support/model/Tree.php (1)
Tree
(17-55)tests/TestCase.php (4)
TestCase
(13-212)createDatabase
(59-93)buildFlatXMLDataSet
(28-57)generateFixtureTree
(150-184)src/NestedSetsBehavior.php (14)
makeRoot
(830-835)prependTo
(959-965)appendTo
(292-298)insertBefore
(647-653)insertAfter
(606-612)deleteWithChildren
(519-541)parents
(900-924)children
(470-495)leaves
(775-797)prev
(990-996)next
(860-866)isRoot
(746-749)isChildOf
(678-696)isLeaf
(719-723)src/NestedSetsQueryBehavior.php (1)
leaves
(59-82)
🪛 phpcs (3.7.2)
tests/support/model/TreeQuery.php
[ERROR] 2-2: Missing file doc comment
(PEAR.Commenting.FileComment.Missing)
[ERROR] 10-10: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 14-14: Missing @category tag in class comment
(PEAR.Commenting.ClassComment.MissingCategoryTag)
[ERROR] 14-14: Missing @Package tag in class comment
(PEAR.Commenting.ClassComment.MissingPackageTag)
[ERROR] 14-14: Missing @author tag in class comment
(PEAR.Commenting.ClassComment.MissingAuthorTag)
[ERROR] 14-14: Missing @license tag in class comment
(PEAR.Commenting.ClassComment.MissingLicenseTag)
[ERROR] 14-14: Missing @link tag in class comment
(PEAR.Commenting.ClassComment.MissingLinkTag)
[ERROR] 17-17: Missing doc comment for function behaviors()
(PEAR.Commenting.FunctionComment.Missing)
tests/support/model/MultipleTreeQuery.php
[ERROR] 2-2: Missing file doc comment
(PEAR.Commenting.FileComment.Missing)
[ERROR] 10-10: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 14-14: Missing @category tag in class comment
(PEAR.Commenting.ClassComment.MissingCategoryTag)
[ERROR] 14-14: Missing @Package tag in class comment
(PEAR.Commenting.ClassComment.MissingPackageTag)
[ERROR] 14-14: Missing @author tag in class comment
(PEAR.Commenting.ClassComment.MissingAuthorTag)
[ERROR] 14-14: Missing @license tag in class comment
(PEAR.Commenting.ClassComment.MissingLicenseTag)
[ERROR] 14-14: Missing @link tag in class comment
(PEAR.Commenting.ClassComment.MissingLinkTag)
[ERROR] 17-17: Missing doc comment for function behaviors()
(PEAR.Commenting.FunctionComment.Missing)
tests/NestedSetsQueryBehaviorTest.php
[ERROR] 10-10: Missing doc comment for class NestedSetsQueryBehaviorTest
(PEAR.Commenting.ClassComment.Missing)
[ERROR] 12-12: Missing doc comment for function testReturnLeavesForSingleAndMultipleTreeModels()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 17-17: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 22-22: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 28-28: Missing doc comment for function testReturnRootsForSingleAndMultipleTreeModels()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 33-33: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 38-38: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
tests/support/model/MultipleTree.php
[ERROR] 10-10: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 17-17: Missing @category tag in class comment
(PEAR.Commenting.ClassComment.MissingCategoryTag)
[ERROR] 17-17: Missing @Package tag in class comment
(PEAR.Commenting.ClassComment.MissingPackageTag)
[ERROR] 17-17: Missing @author tag in class comment
(PEAR.Commenting.ClassComment.MissingAuthorTag)
[ERROR] 17-17: Missing @license tag in class comment
(PEAR.Commenting.ClassComment.MissingLicenseTag)
[ERROR] 17-17: Missing @link tag in class comment
(PEAR.Commenting.ClassComment.MissingLinkTag)
[ERROR] 20-20: Missing doc comment for function tableName()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 25-25: Missing doc comment for function behaviors()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 35-35: Missing doc comment for function rules()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 42-42: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 44-44: Missing @return tag in function comment
(PEAR.Commenting.FunctionComment.MissingReturn)
[ERROR] 52-52: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 54-54: Missing @return tag in function comment
(PEAR.Commenting.FunctionComment.MissingReturn)
tests/support/model/Tree.php
[ERROR] 19-19: Missing doc comment for function tableName()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 24-24: Missing doc comment for function behaviors()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 31-31: Missing doc comment for function rules()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 38-38: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 40-40: Missing @return tag in function comment
(PEAR.Commenting.FunctionComment.MissingReturn)
[ERROR] 48-48: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 50-50: Missing @return tag in function comment
(PEAR.Commenting.FunctionComment.MissingReturn)
tests/TestCase.php
[ERROR] 13-13: Missing doc comment for class TestCase
(PEAR.Commenting.ClassComment.Missing)
[ERROR] 18-18: Missing doc comment for function getDb()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 23-23: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 23-23: Doc comment for parameter "$dataSet" missing
(PEAR.Commenting.FunctionComment.MissingParamTag)
[ERROR] 27-27: Missing @return tag in function comment
(PEAR.Commenting.FunctionComment.MissingReturn)
[ERROR] 95-95: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 107-107: Missing @return tag in function comment
(PEAR.Commenting.FunctionComment.MissingReturn)
[ERROR] 126-126: Missing short description in doc comment
(Generic.Commenting.DocComment.MissingShort)
[ERROR] 138-138: Missing @return tag in function comment
(PEAR.Commenting.FunctionComment.MissingReturn)
[ERROR] 202-202: Missing doc comment for function setUp()
(PEAR.Commenting.FunctionComment.Missing)
tests/NestedSetsBehaviorTest.php
[ERROR] 14-14: Missing doc comment for class NestedSetsBehaviorTest
(PEAR.Commenting.ClassComment.Missing)
[ERROR] 16-16: Missing doc comment for function testReturnTrueAndMatchXmlAfterMakeRootNewForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 54-54: Missing doc comment for function testThrowExceptionWhenMakeRootWithTreeAttributeFalseAndRootExists()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 66-66: Missing doc comment for function testReturnTrueAndMatchXmlAfterPrependToNewNodeForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 109-109: Missing doc comment for function testThrowExceptionWhenAppendToNewNodeTargetIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 121-121: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertBeforeNewForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 164-164: Missing doc comment for function testThrowExceptionWhenInsertBeforeNewNodeTargetIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 176-176: Missing doc comment for function testThrowExceptionWhenInsertBeforeNewNodeTargetIsRoot()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 194-194: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertAfterNewForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 238-238: Missing doc comment for function testThrowExceptionWhenInsertAfterNewNodeTargetIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 250-250: Missing doc comment for function testThrowExceptionWhenInsertAfterNewNodeTargetIsRoot()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 269-269: Missing doc comment for function testReturnTrueAndMatchXmlAfterMakeRootOnExistingMultipleTreeNode()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 300-300: Missing doc comment for function testThrowExceptionWhenMakeRootOnNonRootNodeWithTreeAttributeFalse()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 314-314: Missing doc comment for function testThrowExceptionWhenMakeRootOnRootNodeInMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 331-331: Missing doc comment for function testReturnTrueAndMatchXmlAfterPrependToUpForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 388-388: Missing doc comment for function testReturnTrueAndMatchXmlAfterPrependToDownForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 445-445: Missing doc comment for function testReturnTrueAndMatchXmlAfterPrependToMultipleTreeWhenTargetIsInAnotherTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 482-482: Missing doc comment for function testThrowExceptionWhenPrependToTargetIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 496-496: Missing doc comment for function testThrowExceptionWhenPrependToTargetIsSame()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 510-510: Missing doc comment for function testThrowExceptionWhenPrependToTargetIsChild()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 534-534: Missing doc comment for function testReturnTrueAndMatchXmlAfterAppendToUpForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 591-591: Missing doc comment for function testReturnTrueAndMatchXmlAfterAppendToDownForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 648-648: Missing doc comment for function testReturnTrueAndMatchXmlAfterAppendToMultipleTreeWhenTargetIsInAnotherTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 686-686: Missing doc comment for function testThrowExceptionWhenAppendToTargetIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 700-700: Missing doc comment for function testThrowExceptionWhenAppendToTargetIsSame()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 724-724: Missing doc comment for function testThrowExceptionWhenAppendToTargetIsChild()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 748-748: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertBeforeUpForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 805-805: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertBeforeDownForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 862-862: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertBeforeMultipleTreeWhenTargetIsInAnotherTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 899-899: Missing doc comment for function testThrowExceptionWhenInsertBeforeTargetIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 916-916: Missing doc comment for function testThrowExceptionWhenInsertBeforeTargetIsSame()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 930-930: Missing doc comment for function testThrowExceptionWhenInsertBeforeTargetIsChild()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 954-954: Missing doc comment for function testThrowExceptionWhenInsertBeforeTargetIsRoot()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 978-978: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertAfterUpForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1035-1035: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertAfterDownForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1092-1092: Missing doc comment for function testReturnTrueAndMatchXmlAfterInsertAfterMultipleTreeWhenTargetIsInAnotherTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1129-1129: Missing doc comment for function testThrowExceptionWhenInsertAfterTargetIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1143-1143: Missing doc comment for function testThrowExceptionWhenInsertAfterTargetIsSame()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1160-1160: Missing doc comment for function testThrowExceptionWhenInsertAfterTargetIsChild()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1184-1184: Missing doc comment for function testThrowExceptionWhenInsertAfterTargetIsRoot()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1202-1202: Missing doc comment for function testReturnAffectedRowsAndMatchXmlAfterDeleteWithChildrenForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1230-1230: Missing doc comment for function testThrowExceptionWhenDeleteWithChildrenIsCalledOnNewRecordNode()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1242-1242: Missing doc comment for function testReturnOneWhenDeleteNodeForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1270-1270: Missing doc comment for function testThrowExceptionWhenDeleteNodeIsNewRecord()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1282-1282: Missing doc comment for function testThrowNotSupportedExceptionWhenDeleteIsCalledOnRootNode()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1301-1301: Missing doc comment for function testThrowNotSupportedExceptionWhenInsertIsCalledOnTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1315-1315: Missing doc comment for function testReturnOneWhenUpdateNodeName()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1328-1328: Missing doc comment for function testReturnParentsForTreeAndMultipleTreeWithAndWithoutDepth()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1333-1333: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1338-1338: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1343-1343: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1348-1348: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1354-1354: Missing doc comment for function testReturnChildrenForTreeAndMultipleTreeWithAndWithoutDepth()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1359-1359: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1364-1364: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1369-1369: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1374-1374: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1380-1380: Missing doc comment for function testReturnLeavesForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1385-1385: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1390-1390: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1396-1396: Missing doc comment for function testReturnPrevNodesForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1401-1401: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1406-1406: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1412-1412: Missing doc comment for function testReturnNextNodesForTreeAndMultipleTree()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1417-1417: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1422-1422: File is being conditionally included; use "include" instead
(PEAR.Files.IncludingFile.UseInclude)
[ERROR] 1428-1428: Missing doc comment for function testReturnIsRootForRootAndNonRootNode()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1436-1436: Missing doc comment for function testReturnIsChildOfForMultipleTreeNodeUnderVariousAncestors()
(PEAR.Commenting.FunctionComment.Missing)
[ERROR] 1480-1480: Missing doc comment for function testIsLeafReturnsTrueForLeafAndFalseForRoot()
(PEAR.Commenting.FunctionComment.Missing)
🪛 PHPMD (2.15.0)
tests/NestedSetsQueryBehaviorTest.php
18-18: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnLeavesForSingleAndMultipleTreeModels'. (Clean Code Rules)
(StaticAccess)
23-23: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnLeavesForSingleAndMultipleTreeModels'. (Clean Code Rules)
(StaticAccess)
34-34: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnRootsForSingleAndMultipleTreeModels'. (Clean Code Rules)
(StaticAccess)
39-39: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnRootsForSingleAndMultipleTreeModels'. (Clean Code Rules)
(StaticAccess)
tests/NestedSetsBehaviorTest.php
72-72: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterPrependToNewNodeForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
85-85: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterPrependToNewNodeForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
127-127: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeNewForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
140-140: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeNewForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
181-181: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertBeforeNewNodeTargetIsRoot'. (Clean Code Rules)
(StaticAccess)
200-200: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterNewForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
214-214: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterNewForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
256-256: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertAfterNewNodeTargetIsRoot'. (Clean Code Rules)
(StaticAccess)
273-273: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterMakeRootOnExistingMultipleTreeNode'. (Clean Code Rules)
(StaticAccess)
304-304: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenMakeRootOnNonRootNodeWithTreeAttributeFalse'. (Clean Code Rules)
(StaticAccess)
318-318: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testThrowExceptionWhenMakeRootOnRootNodeInMultipleTree'. (Clean Code Rules)
(StaticAccess)
335-335: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterPrependToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
344-344: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterPrependToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
355-355: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterPrependToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
364-364: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterPrependToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
392-392: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterPrependToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
401-401: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterPrependToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
412-412: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterPrependToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
421-421: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterPrependToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
449-449: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterPrependToMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
458-458: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterPrependToMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
486-486: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenPrependToTargetIsNewRecord'. (Clean Code Rules)
(StaticAccess)
500-500: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenPrependToTargetIsSame'. (Clean Code Rules)
(StaticAccess)
514-514: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenPrependToTargetIsChild'. (Clean Code Rules)
(StaticAccess)
521-521: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenPrependToTargetIsChild'. (Clean Code Rules)
(StaticAccess)
538-538: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterAppendToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
547-547: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterAppendToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
558-558: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterAppendToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
567-567: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterAppendToUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
595-595: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterAppendToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
604-604: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterAppendToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
615-615: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterAppendToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
624-624: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterAppendToDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
652-652: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterAppendToMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
661-661: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterAppendToMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
690-690: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenAppendToTargetIsNewRecord'. (Clean Code Rules)
(StaticAccess)
704-704: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenAppendToTargetIsSame'. (Clean Code Rules)
(StaticAccess)
711-711: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenAppendToTargetIsSame'. (Clean Code Rules)
(StaticAccess)
728-728: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenAppendToTargetIsChild'. (Clean Code Rules)
(StaticAccess)
735-735: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenAppendToTargetIsChild'. (Clean Code Rules)
(StaticAccess)
752-752: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
761-761: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
772-772: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
781-781: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
809-809: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
818-818: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
829-829: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
838-838: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
866-866: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
875-875: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertBeforeMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
903-903: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertBeforeTargetIsNewRecord'. (Clean Code Rules)
(StaticAccess)
920-920: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertBeforeTargetIsSame'. (Clean Code Rules)
(StaticAccess)
934-934: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertBeforeTargetIsChild'. (Clean Code Rules)
(StaticAccess)
941-941: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertBeforeTargetIsChild'. (Clean Code Rules)
(StaticAccess)
958-958: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertBeforeTargetIsRoot'. (Clean Code Rules)
(StaticAccess)
965-965: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertBeforeTargetIsRoot'. (Clean Code Rules)
(StaticAccess)
982-982: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
991-991: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1002-1002: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1011-1011: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterUpForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1039-1039: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1048-1048: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1059-1059: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1068-1068: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterDownForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1096-1096: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
1105-1105: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnTrueAndMatchXmlAfterInsertAfterMultipleTreeWhenTargetIsInAnotherTree'. (Clean Code Rules)
(StaticAccess)
1133-1133: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertAfterTargetIsNewRecord'. (Clean Code Rules)
(StaticAccess)
1147-1147: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertAfterTargetIsSame'. (Clean Code Rules)
(StaticAccess)
1164-1164: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertAfterTargetIsChild'. (Clean Code Rules)
(StaticAccess)
1171-1171: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertAfterTargetIsChild'. (Clean Code Rules)
(StaticAccess)
1188-1188: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertAfterTargetIsRoot'. (Clean Code Rules)
(StaticAccess)
1192-1192: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowExceptionWhenInsertAfterTargetIsRoot'. (Clean Code Rules)
(StaticAccess)
1286-1286: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testThrowNotSupportedExceptionWhenDeleteIsCalledOnRootNode'. (Clean Code Rules)
(StaticAccess)
1319-1319: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\Tree' in method 'testReturnOneWhenUpdateNodeName'. (Clean Code Rules)
(StaticAccess)
1334-1334: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnParentsForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1339-1339: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnParentsForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1344-1344: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnParentsForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1349-1349: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnParentsForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1360-1360: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnChildrenForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1365-1365: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnChildrenForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1370-1370: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnChildrenForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1375-1375: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnChildrenForTreeAndMultipleTreeWithAndWithoutDepth'. (Clean Code Rules)
(StaticAccess)
1386-1386: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnLeavesForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1391-1391: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnLeavesForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1402-1402: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnPrevNodesForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1407-1407: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnPrevNodesForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1418-1418: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnNextNodesForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1423-1423: Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'testReturnNextNodesForTreeAndMultipleTree'. (Clean Code Rules)
(StaticAccess)
1440-1440: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnIsChildOfForMultipleTreeNodeUnderVariousAncestors'. (Clean Code Rules)
(StaticAccess)
1447-1447: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnIsChildOfForMultipleTreeNodeUnderVariousAncestors'. (Clean Code Rules)
(StaticAccess)
1455-1455: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnIsChildOfForMultipleTreeNodeUnderVariousAncestors'. (Clean Code Rules)
(StaticAccess)
1463-1463: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnIsChildOfForMultipleTreeNodeUnderVariousAncestors'. (Clean Code Rules)
(StaticAccess)
1471-1471: Avoid using static access to class '\yii2\extensions\nestedsets\tests\support\model\MultipleTree' in method 'testReturnIsChildOfForMultipleTreeNodeUnderVariousAncestors'. (Clean Code Rules)
(StaticAccess)
🪛 GitHub Actions: build
tests/TestCase.php
[error] 157-157: Exception: String could not be parsed as XML due to failure loading external XML file in test cases.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: phpunit / PHP 8.3-windows-latest
🔇 Additional comments (30)
phpstan.neon (1)
12-12
: Excellent addition for comprehensive static analysis coverage.Including the tests directory in PHPStan analysis ensures test code maintains the same quality standards as production code and helps catch type errors in test files.
src/NestedSetsQueryBehavior.php (2)
5-5
: LGTM: Namespace modernization to lowercase convention.The namespace change from uppercase to lowercase follows modern PSR-4 conventions and improves consistency across the codebase.
29-31
: LGTM: Enhanced static analysis with PHPStan-specific annotations.The migration from generic
@template
and@extends
to PHPStan-specific@phpstan-template
and@phpstan-extends
annotations provides better type safety and static analysis support.tests/support/model/TreeQuery.php (1)
1-23
: LGTM: Clean query class implementation with good type safety.The TreeQuery class correctly extends ActiveQuery, attaches the NestedSetsQueryBehavior, and uses PHPStan generics for type safety. The implementation follows expected patterns and integrates well with the updated namespace structure.
tests/support/model/MultipleTreeQuery.php (1)
1-23
: LGTM: Consistent query class implementation.The MultipleTreeQuery class correctly mirrors the TreeQuery implementation with appropriate generic typing for the MultipleTree model. The consistent structure across query classes enhances maintainability.
src/NestedSetsBehavior.php (2)
5-5
: LGTM: Consistent namespace modernization.The lowercase namespace change aligns with the broader refactoring effort and follows modern PSR-4 conventions, maintaining consistency with NestedSetsQueryBehavior.
33-35
: LGTM: Enhanced type safety with PHPStan annotations.The update to PHPStan-specific template annotations improves static analysis capabilities and maintains consistency with the query behavior class updates.
tests/phpstan-config.php (2)
6-7
: LGTM: Namespace and import updates are consistent.The namespace changes from PascalCase to lowercase and the addition of new model imports align perfectly with the broader refactoring objectives.
17-28
: LGTM: PHPStan behavior mappings are properly configured.The behavior mappings correctly associate the new test models (
MultipleTree
,Tree
) and their query classes (MultipleTreeQuery
,TreeQuery
) with the appropriate nested sets behaviors, enhancing static analysis coverage.composer.json (4)
14-14
: LGTM: Version constraint improvement.The change from
"dev-master|^22"
to"^2.0.53|^22"
is a good improvement, moving away from development versions to stable releases while maintaining compatibility.
23-23
: LGTM: PHPStan dependency stabilized.Updating from
"dev-main"
to"^0.3.0"
provides better version stability for the PHPStan extension.
27-27
: LGTM: Namespace standardization to lowercase.The autoloading namespace changes from PascalCase to lowercase are consistent with the broader refactoring across the codebase.
Also applies to: 32-32
51-51
: LGTM: Simplified PHPStan script command.The removal of the
analyse src
argument is appropriate since PHPStan configuration should handle the analysis scope via its configuration files.tests/NestedSetsQueryBehaviorTest.php (2)
5-8
: LGTM: Namespace and import improvements.The namespace update to lowercase and the use of grouped imports enhance code consistency and readability.
12-26
: LGTM: Enhanced test method naming and assertions.The renamed test methods (
testReturnLeavesForSingleAndMultipleTreeModels
andtestReturnRootsForSingleAndMultipleTreeModels
) are more descriptive. The improved assertions withself::assertEquals
and descriptive messages enhance test maintainability.Also applies to: 28-42
tests/support/model/Tree.php (3)
5-8
: LGTM: Namespace standardization and explicit imports.The lowercase namespace and explicit imports for
ActiveRecord
andNestedSetsBehavior
improve code clarity and consistency.
17-17
: LGTM: Type safety improvements.Making the class
final
and adding explicit return types (string
,array
) enhances type safety and prevents unintended inheritance in test models.Also applies to: 19-19, 24-24, 31-31
38-46
: LGTM: Enhanced static analysis support.The PHPStan docblocks (
@phpstan-return
) and the typedfind()
method returningTreeQuery<self>
significantly improve static analysis capabilities and type safety.Also applies to: 48-54
tests/support/model/MultipleTree.php (3)
5-8
: LGTM: Consistent namespace and import improvements.The lowercase namespace and explicit imports maintain consistency with the Tree model and broader refactoring objectives.
18-18
: LGTM: Type safety enhancements.The
final
class declaration and explicit return types forbehaviors()
andrules()
methods improve type safety and prevent unintended modifications in test scenarios.Also applies to: 25-25, 35-35
42-50
: LGTM: Static analysis and query improvements.The PHPStan docblocks and typed
find()
method returningMultipleTreeQuery<self>
enhance static analysis capabilities. The configuration correctly supports multi-tree scenarios with thetreeAttribute
setting.Also applies to: 52-58
tests/TestCase.php (6)
5-11
: LGTM! Namespace and import improvements.The namespace change to lowercase and grouped imports improve consistency and readability.
16-16
: Good addition for fixture path management.Centralizing the fixture directory path improves maintainability.
23-57
: Excellent improvements to XML handling and type safety.The additions of PHPStan annotations, nullsafe operators, explicit string casting, and validation assertions significantly improve the robustness of this method.
95-124
: Type annotations and data consistency improvements.Good addition of PHPStan annotations and ensuring consistent tree attribute values.
126-148
: Well-structured new method for multiple tree datasets.The method is properly annotated and correctly re-indexes the array to match the list return type.
202-202
: Correct PHPUnit lifecycle method naming.Good fix - PHPUnit expects
setUp()
notsetup()
.tests/NestedSetsBehaviorTest.php (3)
5-12
: Consistent namespace and import improvements.Changes align with the project-wide namespace standardization.
16-107
: Excellent test improvements for reliability and clarity.The enhanced test method names, null checks, detailed assertion messages, and proper error handling for XML loading significantly improve test quality and debugging experience.
60-64
: Correct exception expectation ordering.Good practice placing expectation calls before the triggering operation.
…tree roots query.
…andling and code clarity.
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 standardizes namespaces to lowercase, enhances PHPStan configuration, and refactors test fixtures and assertions for improved type safety and static analysis support.
- Renamed namespaces and updated PSR-4 mappings in source and test files.
- Extended PHPStan config to include tests and added phpstan annotations in models and behaviors.
- Refactored
TestCase
and test classes with stricter method signatures, clearer fixture loading, and updated PHPUnit setup.
Reviewed Changes
Copilot reviewed 15 out of 55 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
tests/support/model/TreeQuery.php | Lowercased namespace and added phpstan template annotation. |
tests/support/model/Tree.php | Lowercased namespace, added strict return types and phpstan tags. |
tests/support/model/MultipleTree.php | Lowercased namespace, added stricter signatures and phpstan tags. |
tests/TestCase.php | Improved XML fixture helper, added null checks, fixed setUp/tearDown. |
src/NestedSetsQueryBehavior.php | Lowercased namespace, replaced generic annotations with phpstan tags. |
src/NestedSetsBehavior.php | Lowercased namespace, replaced generic annotations with phpstan tags. |
phpstan.neon | Included tests directory in analysis paths. |
composer.json | Updated autoload mappings and dependency constraints. |
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: 0
🧹 Nitpick comments (1)
tests/TestCase.php (1)
40-49
: String casting inconsistency in XML attribute handling.All attributes except 'name' are explicitly cast to string. For consistency, either cast 'name' to string as well or document why it's treated differently.
- $treeElement?->addAttribute('name', $item['name']); + $treeElement?->addAttribute('name', (string) $item['name']);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/TestCase.php
(6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/TestCase.php (2)
tests/support/model/MultipleTree.php (2)
MultipleTree
(18-59)find
(55-58)tests/support/model/Tree.php (2)
Tree
(17-55)find
(51-54)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: phpunit / PHP 8.3-ubuntu-latest
- GitHub Check: easy-coding-standard / PHP 8.4-ubuntu-latest
- GitHub Check: phpunit-compatibility / PHP 8.2-windows-latest
- GitHub Check: phpunit-compatibility / PHP 8.1-windows-latest
- GitHub Check: phpunit-compatibility / PHP 8.3-windows-latest
- GitHub Check: phpunit-compatibility / PHP 8.4-windows-latest
- GitHub Check: composer-require-checker / PHP 8.4-ubuntu-latest
- GitHub Check: phpstan / PHP 8.4-ubuntu-latest
- GitHub Check: phpunit / PHP 8.3-windows-latest
- GitHub Check: phpunit / PHP 8.2-ubuntu-latest
- GitHub Check: phpunit / PHP 8.3-ubuntu-latest
- GitHub Check: phpunit / PHP 8.4-windows-latest
- GitHub Check: phpunit / PHP 8.1-ubuntu-latest
- GitHub Check: phpunit-compatibility / PHP 8.1-ubuntu-latest
- GitHub Check: phpunit-compatibility / PHP 8.1-windows-latest
🔇 Additional comments (9)
tests/TestCase.php (9)
5-18
: LGTM! Namespace and import improvements follow best practices.The changes to lowercase namespace, grouped imports with curly braces, and explicit function imports improve code organization and follow PHP coding standards.
22-22
: Good addition for centralized fixture path management.The fixture directory property improves maintainability and addresses the path consistency issues mentioned in previous reviews.
29-33
: Excellent PHPStan type annotations for better type safety.The comprehensive type documentation improves code maintainability and enables better static analysis.
54-64
: Excellent error handling improvement!The addition of runtime exceptions addresses the previous feedback about using exceptions instead of assertions, ensuring proper error handling in production environments.
66-75
: Clean refactoring of string replacement logic.The array-based approach for string replacement is more readable and maintainable than sequential calls.
113-133
: Great type safety and data consistency improvements.The comprehensive PHPStan annotations and default tree=0 value ensure better type safety and consistent data structure across different tree types.
144-166
: Well-implemented new method with excellent type safety.The comprehensive PHPStan annotations and use of
array_values()
for proper re-indexing demonstrate good attention to detail and type safety.
175-177
: Good use of fixture directory property and null-safe handling.Using the centralized fixture directory and safely handling potential null children with empty array fallback improves code reliability.
220-225
: Correct PHPUnit lifecycle method implementation.The proper
setUp()
method name and movingmockConsoleApplication()
here follows PHPUnit best practices and ensures proper test initialization.
…e safety and clarity.
Summary by CodeRabbit
Refactor
Tests
Chores