-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: abstracts are now deprecated
- Loading branch information
Showing
14 changed files
with
61 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* Please use another implementation of {@see Optional} if possible. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PetrKnap\Optional; | ||
|
||
use InvalidArgumentException; | ||
use Throwable; | ||
|
||
/** | ||
* Please use another implementation of {@see AbstractOptional} if possible. | ||
* | ||
* @todo make it final | ||
* | ||
* @deprecated will be converted to final | ||
* | ||
* @template T of mixed | ||
* | ||
* @template-extends AbstractOptional<T> | ||
*/ | ||
class Optional extends AbstractOptional | ||
/* abstract */ class Optional extends AbstractOptional | ||
{ | ||
protected static function isSupported(mixed $value): bool | ||
/* abstract */ protected static function isSupported(mixed $value): bool | ||
{ | ||
trigger_error( | ||
static::class . ' does not check the type of value.', | ||
error_level: E_USER_NOTICE, | ||
); | ||
return $value !== null; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,27 @@ | ||
<?php | ||
|
||
/** | ||
* Please use another implementation of {@see OptionalObject} if possible. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PetrKnap\Optional; | ||
|
||
use PetrKnap\Shorts\Exception\NotImplemented; | ||
|
||
/** | ||
* Please use another implementation of {@see AbstractOptionalObject} if possible. | ||
* | ||
* @template T of object | ||
* | ||
* @template-extends AbstractOptionalObject<object> | ||
*/ | ||
final class OptionalObject extends AbstractOptionalObject | ||
/* abstract */ class OptionalObject extends AbstractOptionalObject | ||
{ | ||
protected static function isSupported(mixed $value): bool | ||
/* abstract */ protected static function getObjectClassName(): string | ||
{ | ||
trigger_error( | ||
self::class . ' does not check the instance of object.', | ||
static::class . ' does not check the instance of object.', | ||
error_level: E_USER_NOTICE, | ||
); | ||
return is_object($value); | ||
} | ||
|
||
protected static function getObjectClassName(): string | ||
{ | ||
NotImplemented::throw(__METHOD__); | ||
/** @var class-string */ | ||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* Please use another implementation of {@see OptionalResource} if possible. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PetrKnap\Optional; | ||
|
||
use PetrKnap\Shorts\Exception\NotImplemented; | ||
|
||
/** | ||
* Please use another implementation of {@see AbstractOptionalResource} if possible. | ||
*/ | ||
final class OptionalResource extends AbstractOptionalResource | ||
/* abstract */ class OptionalResource extends AbstractOptionalResource | ||
{ | ||
protected static function isSupported(mixed $value): bool | ||
/* abstract */ protected static function getResourceType(): string | ||
{ | ||
trigger_error( | ||
self::class . ' does not check the type of resource.', | ||
static::class . ' does not check the type of resource.', | ||
error_level: E_USER_NOTICE, | ||
); | ||
return is_resource($value); | ||
} | ||
|
||
protected static function getResourceType(): string | ||
{ | ||
NotImplemented::throw(__METHOD__); | ||
/** @var non-empty-string */ | ||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters