belgattitude /
soluble-japha
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare(strict_types=1); |
||||
| 4 | /** |
||||
| 5 | * soluble-japha / PHPJavaBridge driver client. |
||||
| 6 | * |
||||
| 7 | * Refactored version of phpjababridge's Java.inc file compatible |
||||
| 8 | * with php java bridge 6.2 |
||||
| 9 | * |
||||
| 10 | * |
||||
| 11 | * @credits http://php-java-bridge.sourceforge.net/pjb/ |
||||
| 12 | * |
||||
| 13 | * @see http://github.com/belgattitude/soluble-japha |
||||
| 14 | * |
||||
| 15 | * @author Jost Boekemeier |
||||
| 16 | * @author Vanvelthem Sébastien (refactoring and fixes from original implementation) |
||||
| 17 | * @license MIT |
||||
| 18 | * |
||||
| 19 | * The MIT License (MIT) |
||||
| 20 | * Copyright (c) 2014-2017 Jost Boekemeier |
||||
| 21 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
| 22 | * of this software and associated documentation files (the "Software"), to deal |
||||
| 23 | * in the Software without restriction, including without limitation the rights |
||||
| 24 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
| 25 | * copies of the Software, and to permit persons to whom the Software is |
||||
| 26 | * furnished to do so, subject to the following conditions: |
||||
| 27 | * |
||||
| 28 | * The above copyright notice and this permission notice shall be included in |
||||
| 29 | * all copies or substantial portions of the Software. |
||||
| 30 | * |
||||
| 31 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
| 32 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
| 33 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
| 34 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
| 35 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
| 36 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
| 37 | * THE SOFTWARE. |
||||
| 38 | */ |
||||
| 39 | |||||
| 40 | namespace Soluble\Japha\Bridge\Driver\Pjb62\Exception; |
||||
| 41 | |||||
| 42 | use Exception; |
||||
| 43 | use Soluble\Japha\Bridge\Driver\Pjb62\JavaType; |
||||
| 44 | use Soluble\Japha\Bridge\Driver\Pjb62\Client; |
||||
| 45 | use Soluble\Japha\Bridge\Driver\Pjb62\PjbProxyClient; |
||||
| 46 | use Soluble\Japha\Interfaces\JavaObject; |
||||
| 47 | |||||
| 48 | /** |
||||
| 49 | * @method JavaObject getCause() Standard java Throwable::getCause() method: java('java.lang.String') |
||||
| 50 | */ |
||||
| 51 | class JavaException extends Exception implements JavaType |
||||
| 52 | { |
||||
| 53 | public $__serialID; |
||||
| 54 | public $__java; |
||||
| 55 | |||||
| 56 | /** |
||||
| 57 | * @var Client |
||||
| 58 | */ |
||||
| 59 | public $__client; |
||||
| 60 | public $__delegate; |
||||
| 61 | public $__signature; |
||||
| 62 | public $__hasDeclaredExceptions; |
||||
| 63 | |||||
| 64 | /** |
||||
| 65 | * JavaException constructor. |
||||
| 66 | * |
||||
| 67 | * @param mixed|null ...$args arguments |
||||
| 68 | */ |
||||
| 69 | 1 | public function __construct(...$args) |
|||
| 70 | { |
||||
| 71 | 1 | $this->__client = PjbProxyClient::getInstance()->getClient(); |
|||
| 72 | 1 | $name = array_shift($args); |
|||
| 73 | 1 | if (is_array($name)) { |
|||
| 74 | $args = $name; |
||||
| 75 | $name = array_shift($args); |
||||
| 76 | } |
||||
| 77 | |||||
| 78 | 1 | if (empty($args)) { |
|||
| 79 | parent::__construct($name); |
||||
| 80 | } else { |
||||
| 81 | 1 | parent::__construct($args[0]); |
|||
| 82 | } |
||||
| 83 | |||||
| 84 | 1 | $this->__delegate = $this->__client->createObject($name, $args); |
|||
| 85 | 1 | $this->__java = $this->__delegate->get__java(); |
|||
| 86 | 1 | $this->__signature = $this->__delegate->get__signature(); |
|||
| 87 | 1 | $this->__hasDeclaredExceptions = 'T'; |
|||
| 88 | 1 | } |
|||
| 89 | |||||
| 90 | public function __cast(string $type) |
||||
| 91 | { |
||||
| 92 | return $this->__delegate->__cast($type); |
||||
| 93 | } |
||||
| 94 | |||||
| 95 | public function __sleep() |
||||
| 96 | { |
||||
| 97 | $this->__delegate->__sleep(); |
||||
| 98 | |||||
| 99 | return ['__delegate']; |
||||
| 100 | } |
||||
| 101 | |||||
| 102 | public function __wakeup() |
||||
| 103 | { |
||||
| 104 | $this->__delegate->__wakeup(); |
||||
| 105 | $this->__java = $this->__delegate->__java; |
||||
|
0 ignored issues
–
show
|
|||||
| 106 | $this->__client = $this->__delegate->__client; |
||||
| 107 | } |
||||
| 108 | |||||
| 109 | 22 | public function __get(string $key) |
|||
| 110 | { |
||||
| 111 | 22 | return $this->__delegate->__get($key); |
|||
| 112 | } |
||||
| 113 | |||||
| 114 | public function __set(string $key, $val): void |
||||
| 115 | { |
||||
| 116 | $this->__delegate->__set($key, $val); |
||||
| 117 | } |
||||
| 118 | |||||
| 119 | 22 | public function __call(string $method, array $args) |
|||
| 120 | { |
||||
| 121 | 22 | return $this->__delegate->__call($method, $args); |
|||
| 122 | } |
||||
| 123 | |||||
| 124 | /** |
||||
| 125 | * @return string |
||||
| 126 | */ |
||||
| 127 | 22 | public function __toString(): string |
|||
| 128 | { |
||||
| 129 | 22 | return (string) $this->__delegate->__toExceptionString($this->getTraceAsString()); |
|||
|
0 ignored issues
–
show
The method
__toExceptionString() does not exist on Soluble\Japha\Bridge\Driver\Pjb62\JavaProxy. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 130 | } |
||||
| 131 | |||||
| 132 | /** |
||||
| 133 | * @return int |
||||
| 134 | */ |
||||
| 135 | 1 | public function get__java(): int |
|||
| 136 | { |
||||
| 137 | 1 | return $this->__java; |
|||
| 138 | } |
||||
| 139 | |||||
| 140 | /** |
||||
| 141 | * Return java object id. |
||||
| 142 | * |
||||
| 143 | * @return int |
||||
| 144 | */ |
||||
| 145 | 1 | public function __getJavaInternalObjectId(): int |
|||
| 146 | { |
||||
| 147 | 1 | return $this->__java; |
|||
| 148 | } |
||||
| 149 | |||||
| 150 | /** |
||||
| 151 | * @return string|null |
||||
| 152 | */ |
||||
| 153 | 1 | public function get__signature(): ?string |
|||
| 154 | { |
||||
| 155 | 1 | return $this->__signature; |
|||
| 156 | } |
||||
| 157 | } |
||||
| 158 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..