Skip to content

Restore CamelCaseTrait for 1.x backward compatibility #93

@koriym

Description

@koriym

Problem

ray/media-query 1.1.0 no longer ships Ray\MediaQuery\CamelCaseTrait. This is a source-compatible break for existing entity/read-model classes that still import the trait:

use Ray\MediaQuery\CamelCaseTrait;

final class AdminEntity
{
    use CamelCaseTrait;
}

After upgrading to 1.1.0, those classes fail at load time with Trait "Ray\MediaQuery\CamelCaseTrait" not found.

Evidence

Installed package:

$ composer show ray/media-query --format=json
versions: 1.1.0
source reference: 507d1efffd99f883b1c1afbc9d0cf1a35f927129

The 1.1.0 package contains Ray\MediaQuery\StringCase, but not src/CamelCaseTrait.php. The bundled changelog explicitly says:

CamelCaseTrait has been removed

MIGRATION.md says the trait has been deprecated, but the symbol is not present, so consumers get a hard fatal instead of a deprecation path.

Expected

For the 1.x line, please keep Ray\MediaQuery\CamelCaseTrait available for backward compatibility, ideally marked deprecated and implemented with the previous behavior or as a compatibility wrapper.

The 0.17.1 implementation was small enough to keep as a deprecated BC layer:

trait CamelCaseTrait
{
    public function __set(string $name, mixed $value): void
    {
        $propName = lcfirst(str_replace('_', '', ucwords($name, '_')));
        $this->{$propName} = $value;
    }
}

Why this matters

The recommended replacement (StringCase plus constructor property promotion) is a reasonable modernization path, but removing the trait in 1.x makes a minor upgrade require immediate source edits across all hydrated entity classes. Keeping the symbol avoids unnecessary upgrade friction while still allowing documentation to recommend migration away from it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions