Fix false-positive primary key column length deprecation #6799
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 fixes false-positive primary key column length deprecation introduced in #6787. Originally, it would trigger if the array of column lengths passed to a primary key index is not empty. This is too strict since during introspection lengths are populated with null values by default:
dbal/src/Schema/AbstractSchemaManager.php
Line 857 in 113744f
Instead, we want to trigger the deprecation only if a non-null length would be associated with an indexed column.
Additionally, I want to introduce two more deprecation-related changes:
Indexclass similar toUniqueConstraintandForeignKeyConstraint.I had to add a couple of
@phpstan-ignores because even thoughIndexandUniqueConstraintaccept a non-empty list of column names, they initialize their corresponding properties with an empty array and then populate them by calling a protected method. So this property has to be initialized with an empty array and thus cannot be guaranteed to be non-empty.