Skip to content

Generated Exception\NotFoundException is not abstract #912

@dkarlovi

Description

@dkarlovi

Jane version(s) affected: 7.10.4

Description

The base exception class <namespace>\Exception\NotFoundException is meant to be extended by all the other exceptions (to have them be tagged with the interface etc) and not used directly.

It should be marked as abstract.

How to reproduce

return [
    'directory' => 'src/API',
    'namespace' => 'Docker\\API',
    'openapi-file' => 'https://docs.docker.com/reference/api/engine/version/v1.53.yaml',
];

produces

namespace Docker\API\Exception;

final class NotFoundException extends \RuntimeException implements ClientException
{
    public function __construct(string $message)
    {
        parent::__construct($message, 404);
    }
}

Possible Solution

Mark the exception as abstract when dumping.

Additional context

With a strict coding style, classes should either be abstract or final. If the class is not marked as abstract, it will get marked as final, breaking the package (since the usage is actually intended to be by extending).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions