Chris@0
|
1 <?php
|
Chris@0
|
2 /*
|
Chris@0
|
3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
Chris@0
|
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
Chris@0
|
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
Chris@0
|
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
Chris@0
|
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
Chris@0
|
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
Chris@0
|
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
Chris@0
|
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
Chris@0
|
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
Chris@0
|
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
Chris@0
|
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Chris@0
|
14 *
|
Chris@0
|
15 * This software consists of voluntary contributions made by many individuals
|
Chris@0
|
16 * and is licensed under the MIT license. For more information, see
|
Chris@0
|
17 * <http://www.doctrine-project.org>.
|
Chris@0
|
18 */
|
Chris@0
|
19
|
Chris@0
|
20 namespace Doctrine\Common\Proxy\Exception;
|
Chris@0
|
21
|
Chris@0
|
22 use UnexpectedValueException as BaseUnexpectedValueException;
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * Proxy Unexpected Value Exception.
|
Chris@0
|
26 *
|
Chris@0
|
27 * @link www.doctrine-project.org
|
Chris@0
|
28 * @since 2.4
|
Chris@0
|
29 * @author Marco Pivetta <ocramius@gmail.com>
|
Chris@0
|
30 */
|
Chris@0
|
31 class UnexpectedValueException extends BaseUnexpectedValueException implements ProxyException
|
Chris@0
|
32 {
|
Chris@0
|
33 /**
|
Chris@0
|
34 * @param string $proxyDirectory
|
Chris@0
|
35 *
|
Chris@0
|
36 * @return self
|
Chris@0
|
37 */
|
Chris@0
|
38 public static function proxyDirectoryNotWritable($proxyDirectory)
|
Chris@0
|
39 {
|
Chris@0
|
40 return new self(sprintf('Your proxy directory "%s" must be writable', $proxyDirectory));
|
Chris@0
|
41 }
|
Chris@0
|
42
|
Chris@0
|
43 /**
|
Chris@12
|
44 * @param string $className
|
Chris@12
|
45 * @param string $methodName
|
Chris@12
|
46 * @param string $parameterName
|
Chris@12
|
47 * @param \Exception|null $previous
|
Chris@0
|
48 *
|
Chris@0
|
49 * @return self
|
Chris@0
|
50 */
|
Chris@12
|
51 public static function invalidParameterTypeHint(
|
Chris@12
|
52 $className,
|
Chris@12
|
53 $methodName,
|
Chris@12
|
54 $parameterName,
|
Chris@12
|
55 \Exception $previous = null
|
Chris@12
|
56 ) {
|
Chris@0
|
57 return new self(
|
Chris@0
|
58 sprintf(
|
Chris@0
|
59 'The type hint of parameter "%s" in method "%s" in class "%s" is invalid.',
|
Chris@0
|
60 $parameterName,
|
Chris@0
|
61 $methodName,
|
Chris@0
|
62 $className
|
Chris@0
|
63 ),
|
Chris@0
|
64 0,
|
Chris@0
|
65 $previous
|
Chris@0
|
66 );
|
Chris@0
|
67 }
|
Chris@12
|
68
|
Chris@12
|
69 /**
|
Chris@12
|
70 * @param $className
|
Chris@12
|
71 * @param $methodName
|
Chris@12
|
72 * @param \Exception|null $previous
|
Chris@12
|
73 *
|
Chris@12
|
74 * @return self
|
Chris@12
|
75 */
|
Chris@12
|
76 public static function invalidReturnTypeHint($className, $methodName, \Exception $previous = null)
|
Chris@12
|
77 {
|
Chris@12
|
78 return new self(
|
Chris@12
|
79 sprintf(
|
Chris@12
|
80 'The return type of method "%s" in class "%s" is invalid.',
|
Chris@12
|
81 $methodName,
|
Chris@12
|
82 $className
|
Chris@12
|
83 ),
|
Chris@12
|
84 0,
|
Chris@12
|
85 $previous
|
Chris@12
|
86 );
|
Chris@12
|
87 }
|
Chris@0
|
88 }
|