Skip to content

Bake migration snapshot should not allow reserved words #693

Open

Description

This is a (multiple allowed):

  • bug
  • enhancement
  • feature-discussion (RFC)

bin/cake bake migration_snapshot New

class New extends AbstractMigration
{
    ...
}

When trying to generate it, it throws this at the end

[ParseError] syntax error, unexpected token "new", expecting identifier in /shared/httpd/app/config/Migrations/20240221034352_New.php on line 6

I guess it is mainly about this list? https://www.php.net/manual/en/reserved.php

If someone can help to gather the list of all possible words, I can whip up a PR addressing the issue.

My approach would be to ask() the user about a possible prefix in this case to avoid the collision (prefix defaulting to "Migration"), or allow aborting.
If continue, it would then use e.g. "MigrationNew" and that would be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions