| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | +// phpcs:ignoreFile -- Bundled third-party (Mozart) dependency; exempt from plugin coding standards. | |
| 2 | 3 | |
| 3 | 4 | declare(strict_types=1); |
| 4 | 5 | |
| 5 | 6 | namespace WPDeveloper\BetterDocs\Dependencies\DI; |
| @@ -12,8 +13,10 @@ | ||
| 12 | 13 | use WPDeveloper\BetterDocs\Dependencies\DI\Definition\Reference; |
| 13 | 14 | use WPDeveloper\BetterDocs\Dependencies\DI\Definition\StringDefinition; |
| 14 | 15 | use WPDeveloper\BetterDocs\Dependencies\DI\Definition\ValueDefinition; |
| 15 | 16 | |
| 17 | +if ( ! defined( 'ABSPATH' ) ) { exit; } // Prevent direct file access. | |
| 18 | + | |
| 16 | 19 | if (! function_exists('WPDeveloper\BetterDocs\Dependencies\DI\value')) { |
| 17 | 20 | /** |
| 18 | 21 | * Helper for defining a value. |
| 19 | 22 | * |
| @@ -31,9 +34,9 @@ | ||
| 31 | 34 | * |
| 32 | 35 | * @param string|null $className Class name of the object. |
| 33 | 36 | * If null, the name of the entry (in the container) will be used as class name. |
| 34 | 37 | */ |
| 35 | - function create(string $className = null) : CreateDefinitionHelper | |
| 38 | + function create(?string $className = null) : CreateDefinitionHelper | |
| 36 | 39 | { |
| 37 | 40 | return new CreateDefinitionHelper($className); |
| 38 | 41 | } |
| 39 | 42 | } |
| @@ -44,9 +47,9 @@ | ||
| 44 | 47 | * |
| 45 | 48 | * @param string|null $className Class name of the object. |
| 46 | 49 | * If null, the name of the entry (in the container) will be used as class name. |
| 47 | 50 | */ |
| 48 | - function autowire(string $className = null) : AutowireDefinitionHelper | |
| 51 | + function autowire(?string $className = null) : AutowireDefinitionHelper | |
| 49 | 52 | { |
| 50 | 53 | return new AutowireDefinitionHelper($className); |
| 51 | 54 | } |
| 52 | 55 | } |