Augmentation vers version 3.3.0

This commit is contained in:
Gauvain Boiché
2020-03-31 15:31:03 +02:00
parent d926806907
commit a1864c0414
2618 changed files with 406015 additions and 31377 deletions

View File

@@ -16,6 +16,8 @@
* and is licensed under the MIT license.
*/
declare(strict_types=1);
namespace ProxyManager\Exception;
use BadMethodCallException;
@@ -30,13 +32,8 @@ class DisabledMethodException extends BadMethodCallException implements Exceptio
{
const NAME = __CLASS__;
/**
* @param string $method
*
* @return self
*/
public static function disabledMethod($method)
public static function disabledMethod(string $method) : self
{
return new self(sprintf('Method "%s" is forcefully disabled', (string) $method));
return new self(sprintf('Method "%s" is forcefully disabled', $method));
}
}

View File

@@ -16,6 +16,8 @@
* and is licensed under the MIT license.
*/
declare(strict_types=1);
namespace ProxyManager\Exception;
/**

View File

@@ -16,11 +16,10 @@
* and is licensed under the MIT license.
*/
declare(strict_types=1);
namespace ProxyManager\Exception;
use InvalidArgumentException;
use ReflectionClass;
use ReflectionMethod;
use UnexpectedValueException;
/**
@@ -31,13 +30,7 @@ use UnexpectedValueException;
*/
class FileNotWritableException extends UnexpectedValueException implements ExceptionInterface
{
/**
* @param string $fromPath
* @param string $toPath
*
* @return self
*/
public static function fromInvalidMoveOperation($fromPath, $toPath)
public static function fromInvalidMoveOperation(string $fromPath, string $toPath) : self
{
return new self(sprintf(
'Could not move file "%s" to location "%s": '
@@ -48,19 +41,26 @@ class FileNotWritableException extends UnexpectedValueException implements Excep
}
/**
* @deprecated this method is unused, and will be removed in ProxyManager 3.0.0
*
* @param string $path
*
* @return self
*/
public static function fromNonWritableLocation($path)
public static function fromNonWritableLocation($path) : self
{
$messages = array();
$messages = [];
$destination = realpath($path);
if (($destination = realpath($path)) && ! is_file($destination)) {
if (! $destination) {
$messages[] = 'path does not exist';
}
if ($destination && ! is_file($destination)) {
$messages[] = 'exists and is not a file';
}
if (! is_writable($destination)) {
if ($destination && ! is_writable($destination)) {
$messages[] = 'is not writable';
}

View File

@@ -16,6 +16,8 @@
* and is licensed under the MIT license.
*/
declare(strict_types=1);
namespace ProxyManager\Exception;
use InvalidArgumentException;
@@ -30,32 +32,17 @@ use ReflectionMethod;
*/
class InvalidProxiedClassException extends InvalidArgumentException implements ExceptionInterface
{
/**
* @param ReflectionClass $reflection
*
* @return self
*/
public static function interfaceNotSupported(ReflectionClass $reflection)
public static function interfaceNotSupported(ReflectionClass $reflection) : self
{
return new self(sprintf('Provided interface "%s" cannot be proxied', $reflection->getName()));
}
/**
* @param ReflectionClass $reflection
*
* @return self
*/
public static function finalClassNotSupported(ReflectionClass $reflection)
public static function finalClassNotSupported(ReflectionClass $reflection) : self
{
return new self(sprintf('Provided class "%s" is final and cannot be proxied', $reflection->getName()));
}
/**
* @param ReflectionClass $reflection
*
* @return self
*/
public static function abstractProtectedMethodsNotSupported(ReflectionClass $reflection)
public static function abstractProtectedMethodsNotSupported(ReflectionClass $reflection) : self
{
return new self(sprintf(
'Provided class "%s" has following protected abstract methods, and therefore cannot be proxied:' . "\n%s",
@@ -63,12 +50,12 @@ class InvalidProxiedClassException extends InvalidArgumentException implements E
implode(
"\n",
array_map(
function (ReflectionMethod $reflectionMethod) {
function (ReflectionMethod $reflectionMethod) : string {
return $reflectionMethod->getDeclaringClass()->getName() . '::' . $reflectionMethod->getName();
},
array_filter(
$reflection->getMethods(),
function (ReflectionMethod $method) {
function (ReflectionMethod $method) : bool {
return $method->isAbstract() && $method->isProtected();
}
)

View File

@@ -16,6 +16,8 @@
* and is licensed under the MIT license.
*/
declare(strict_types=1);
namespace ProxyManager\Exception;
use InvalidArgumentException;
@@ -28,13 +30,8 @@ use InvalidArgumentException;
*/
class InvalidProxyDirectoryException extends InvalidArgumentException implements ExceptionInterface
{
/**
* @param string $directory
*
* @return self
*/
public static function proxyDirectoryNotFound($directory)
public static function proxyDirectoryNotFound(string $directory) : self
{
return new self(sprintf('Provided directory "%s" does not exist', (string) $directory));
return new self(sprintf('Provided directory "%s" does not exist', $directory));
}
}

View File

@@ -16,6 +16,8 @@
* and is licensed under the MIT license.
*/
declare(strict_types=1);
namespace ProxyManager\Exception;
use LogicException;
@@ -29,12 +31,7 @@ use ReflectionProperty;
*/
class UnsupportedProxiedClassException extends LogicException implements ExceptionInterface
{
/**
* @param ReflectionProperty $property
*
* @return self
*/
public static function unsupportedLocalizedReflectionProperty(ReflectionProperty $property)
public static function unsupportedLocalizedReflectionProperty(ReflectionProperty $property) : self
{
return new self(
sprintf(