← All changes
|
includes/Dependencies/SuperClosure/SerializableClosure.php
+4
-1
3.4.0
→
4.9.3
View file →
| @@ -1,9 +1,12 @@ | ||
| 1 | 1 | <?php namespace WPDeveloper\BetterDocs\Dependencies\SuperClosure; |
| 2 | +// phpcs:ignoreFile -- Bundled third-party (Mozart) dependency; exempt from plugin coding standards. | |
| 2 | 3 | |
| 3 | 4 | use Closure; |
| 4 | 5 | use WPDeveloper\BetterDocs\Dependencies\SuperClosure\Exception\ClosureUnserializationException; |
| 5 | 6 | |
| 7 | +if ( ! defined( 'ABSPATH' ) ) { exit; } // Prevent direct file access. | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * This class acts as a wrapper for a closure, and allows it to be serialized. |
| 8 | 11 | * |
| 9 | 12 | * With the combined power of the Reflection API, code parsing, and the infamous |
| @@ -40,9 +43,9 @@ | ||
| 40 | 43 | * @param SerializerInterface|null $serializer |
| 41 | 44 | */ |
| 42 | 45 | public function __construct( |
| 43 | 46 | \Closure $closure, |
| 44 | - SerializerInterface $serializer = null | |
| 47 | + ?SerializerInterface $serializer = null | |
| 45 | 48 | ) { |
| 46 | 49 | $this->closure = $closure; |
| 47 | 50 | $this->serializer = $serializer ?: new Serializer; |
| 48 | 51 | } |