Skip to content

Deny pass null to CreateService::getTemplate() #313

Open

Description

@vjik

null make no sense here.

⚠️ It breaks BC.

Activity

  1. added this to the 3.0 milestone on Dec 20, 2025
  2. samdark commented on Dec 20, 2025

    @samdark
    Member

    The reason was to have a nicer exception "You must define a template to generate the migration." instead of generic type mismatch.

    public function getTemplate(?string $key): string
        {
            $key = (string) $key;
    
            if ($this->templates === null) {
                $this->setDefaultTemplates();
            }
    
            if (!isset($this->templates[$key])) {
                throw new InvalidConfigException('You must define a template to generate the migration.');
            }
    
            return $this->templates[$key];
        }
  3. vjik commented on Dec 20, 2025

    @vjik
    MemberAuthor

    The reason was to have a nicer exception "You must define a template to generate the migration." instead of generic type mismatch.

    null is never passed to this method.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions