Accept an array of tables to exclude#27
Open
neilgilmour wants to merge 7 commits intobeyondcode:mainfrom
Open
Conversation
Basically we're making sure that `include()` adds to the `availableTables` array, and doesn't replace it.
There was a problem hiding this comment.
Pull Request Overview
This PR extends the exclude() and include() methods in DumpSchema to accept arrays of table names, adds corresponding tests, and updates documentation examples.
- DumpSchema methods now handle both string and array inputs for table inclusion/exclusion
- Added PHPUnit tests to cover array-based include/exclude scenarios
- Updated docs with code snippets showing array usage
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/DumperTest.php | Added tests for array inputs in include/exclude and removed an unused import |
| src/DumpSchema.php | Changed exclude and include signatures to accept arrays and implemented the new logic |
| docs/schema-definition.md | Updated examples to demonstrate array support in exclude() and include() |
| tests/snapshots/* | Updated snapshots to match new include/exclude behavior |
Comments suppressed due to low confidence (4)
docs/schema-definition.md:129
- Remove the trailing comma after the
excludemethod call in this code snippet to avoid syntax errors in the example.
->exclude(['password_resets', 'secrets', 'lies', 'cat_birthdays']),
docs/schema-definition.md:130
- Remove the trailing comma after this
excludemethod call to ensure the code block is a valid example.
->exclude(config('database.forbidden_tables')),
src/DumpSchema.php:51
- [nitpick] Consider renaming the parameter
$tableNameto$tableNamesor$tablesto reflect that it accepts multiple values.
public function exclude(string|array $tableName)
src/DumpSchema.php:81
- [nitpick] Indent this line to align with the nested block inside the
foreachfor better readability and consistency.
$this->availableTables[] = $doctrineTable;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR widens the scope of the
exclude(string $tableName)method to also accept an array of table names. There's a passing test and updated docs.I don't think that this constitutes a breaking change; The method still accepts a string, the parameter name is unchanged, the method performs the same actions, and the return value is unchanged.