Skip to content

Commit

Permalink
refactor: rename Interfaces syntax to Contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTray committed Oct 14, 2024
1 parent 546d88d commit 31afd83
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion MIGRATION-GUIDES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ The base namespace of the package had also been changed, so you need to use new
- `tests/TestCase.php`, change namespace of `\RonasIT\Support\AutoDoc\Tests\AutoDocTestCaseTrait` to
`\RonasIT\AutoDoc\Traits\AutoDocTestCaseTrait`;
- `phpunit.xml`, change namespace of extension from `RonasIT\Support\AutoDoc\Tests\PhpUnitExtensions\SwaggerExtension` to
`RonasIT\AutoDoc\Support\PHPUnit\Extensions\SwaggerExtension`
`RonasIT\AutoDoc\Support\PHPUnit\Extensions\SwaggerExtension`;
- your custom documentation drivers, change interface from `RonasIT\AutoDoc\Interfaces\SwaggerDriverInterface` to
`RonasIT\AutoDoc\Contracts\SwaggerDriverContract`.
2 changes: 1 addition & 1 deletion config/auto-doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
|
| The name of driver, which will collect and save documentation
| Feel free to use your own driver class which should be inherited from
| `RonasIT\AutoDoc\Interfaces\SwaggerDriverInterface` interface,
| `RonasIT\AutoDoc\Contracts\SwaggerDriverContract` interface,
| or one of our drivers from the `drivers` config:
*/
'driver' => env('SWAGGER_DRIVER', 'local'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace RonasIT\AutoDoc\Interfaces;
namespace RonasIT\AutoDoc\Contracts;

interface SwaggerDriverInterface
interface SwaggerDriverContract
{
/**
* Save temporary data
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/BaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace RonasIT\AutoDoc\Drivers;

use RonasIT\AutoDoc\Interfaces\SwaggerDriverInterface;
use RonasIT\AutoDoc\Contracts\SwaggerDriverContract;

abstract class BaseDriver implements SwaggerDriverInterface
abstract class BaseDriver implements SwaggerDriverContract
{
protected string $tempFilePath;

Expand Down
6 changes: 3 additions & 3 deletions src/Services/SwaggerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
use RonasIT\AutoDoc\Exceptions\SwaggerDriverClassNotFoundException;
use RonasIT\AutoDoc\Exceptions\UnsupportedDocumentationViewerException;
use RonasIT\AutoDoc\Exceptions\WrongSecurityConfigException;
use RonasIT\AutoDoc\Interfaces\SwaggerDriverInterface;
use RonasIT\AutoDoc\Contracts\SwaggerDriverContract;
use RonasIT\AutoDoc\Traits\GetDependenciesTrait;
use RonasIT\AutoDoc\Validators\SwaggerSpecValidator;
use Symfony\Component\HttpFoundation\Response;

/**
* @property SwaggerDriverInterface $driver
* @property SwaggerDriverContract $driver
*/
class SwaggerService
{
Expand Down Expand Up @@ -124,7 +124,7 @@ protected function setDriver()
$this->driver = app($className);
}

if (!$this->driver instanceof SwaggerDriverInterface) {
if (!$this->driver instanceof SwaggerDriverContract) {
throw new InvalidDriverClassException($driver);
}
}
Expand Down

0 comments on commit 31afd83

Please sign in to comment.