[ Index ] |
PHP Cross Reference of phpBB-3.3.7-deutsch |
[Summary view] [Print] [Text view]
1 --- 2 title: Changelog 3 --- 4 5 This is a list of changes/improvements that were introduced in ProxyManager 6 7 ## 2.1.1 8 9 This release provides aggressive improvements in static introspection via 10 [phpstan/phpstan](https://github.com/phpstan/phpstan). No functional 11 changes, just removed possible bugs due to excessive parameter count 12 in method calls, as well as test type hint fixes. 13 14 Total issues resolved: **3** 15 16 - [351: Travis already has xdebug pre-installed for PHP 7.1](https://github.com/Ocramius/ProxyManager/pull/351) 17 - [358: Fix #351 - travis has xdebug pre-installed for PHP 7.1](https://github.com/Ocramius/ProxyManager/pull/358) 18 - [361: PHPStan inspection fixes](https://github.com/Ocramius/ProxyManager/pull/361) 19 20 ## 2.1.0 21 22 ### Improved 23 24 - Introduced support for PHP 7.1, `void` and nullable (`?`) 25 types [#314](https://github.com/Ocramius/ProxyManager/issues/314) 26 [#327](https://github.com/Ocramius/ProxyManager/pull/327) 27 - The test suite is now fully CI-covered by mutation testing [#348](https://github.com/Ocramius/ProxyManager/pull/348) 28 - Moved all performance testing to PHPBench [#326](https://github.com/Ocramius/ProxyManager/pull/326) 29 - PHP 7.0 support dropped [#327](https://github.com/Ocramius/ProxyManager/pull/327) 30 31 Total issues resolved: **9** 32 33 - [290: Branch-alias version bump: master bump to 3.0.x](https://github.com/Ocramius/ProxyManager/pull/290) 34 - [314: Nullable params type](https://github.com/Ocramius/ProxyManager/issues/314) 35 - [326: Moved performance tests to phpbench-based suite](https://github.com/Ocramius/ProxyManager/pull/326) 36 - [327: PHP 7.1 support](https://github.com/Ocramius/ProxyManager/pull/327) 37 - [336: Hotfix tests for php 7 support](https://github.com/Ocramius/ProxyManager/pull/336) 38 - [339: Provided type ?... is invalid](https://github.com/Ocramius/ProxyManager/issues/339) 39 - [343: Fix typo in ghost objects lazy loading code example](https://github.com/Ocramius/ProxyManager/pull/343) 40 - [348: Introduced full mutation testing](https://github.com/Ocramius/ProxyManager/pull/348) 41 - [349: install xdebug manually for php 7.1](https://github.com/Ocramius/ProxyManager/pull/349) 42 43 ## 2.0.4 44 45 ### Fixed 46 47 - Remove deprecated `getMock` usage from tests [#325](https://github.com/Ocramius/ProxyManager/pull/325) 48 - Fix incorrect type in docs example [#329](https://github.com/Ocramius/ProxyManager/pull/329) 49 - Bug when proxy `__get` magic method [#344](https://github.com/Ocramius/ProxyManager/pull/344) 50 - Fix lazy loading value holder magic method support [#345](https://github.com/Ocramius/ProxyManager/pull/345) 51 52 ## 2.0.3 53 54 ### Fixed 55 56 - Various test suite cleanups, mostly because of 57 [new PHPUnit 5.4.0 deprecations being introduced](https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.4.0) 58 [#318](https://github.com/Ocramius/ProxyManager/issues/318) 59 - Removed `zendframework/zend-code:3.0.3` from installable dependencies, since 60 a critical bug was introduced in it [#321](https://github.com/Ocramius/ProxyManager/issues/321) 61 [#323](https://github.com/Ocramius/ProxyManager/issues/323) 62 [#324](https://github.com/Ocramius/ProxyManager/issues/324). Please upgrade to 63 `zendframework/zend-code:3.0.4` or newer. 64 65 ## 2.0.2 66 67 ### Fixed 68 69 - Various optimizations were performed in the [`ocramius/package-versions`](https://github.com/Ocramius/PackageVersions) 70 integration in order to prevent "class not found" fatals. [#294](https://github.com/Ocramius/ProxyManager/issues/294) 71 - Null objects produced via a given class name were not extending from the given class name, causing obvious LSP 72 compliance and type-compatibility issues. [#300](https://github.com/Ocramius/ProxyManager/issues/300) 73 [#301](https://github.com/Ocramius/ProxyManager/issues/301) 74 - Specific installation versions were removed from the [README.md](README.md) install instructions, since composer 75 is installing the latest available version by default. [#305](https://github.com/Ocramius/ProxyManager/issues/305) 76 - PHP 7.0.6 support was dropped. PHP 7.0.6 includes some nasty reflection bugs that caused `__isset` to be called when 77 `ReflectionProperty#getValue()` is used (https://bugs.php.net/72174). 78 [#306](https://github.com/Ocramius/ProxyManager/issues/306) 79 [#308](https://github.com/Ocramius/ProxyManager/issues/308) 80 - PHP 7.0.7 contains additional limitations as to when `$this` can be used. Specifically, `$this` cannot be used as a 81 parameter name for closures that have an already assigned `$this`. Due to `$this` being incorrectly used as parameter 82 name within this library, running ProxyManager on PHP 7.0.7 would have caused a fatal error. 83 [#306](https://github.com/Ocramius/ProxyManager/issues/306) 84 [#308](https://github.com/Ocramius/ProxyManager/issues/308) 85 [#316](https://github.com/Ocramius/ProxyManager/issues/316) 86 - PHP 7.1.0-DEV includes type-checks for incompatible arithmetic operations: some of those operations were erroneously 87 performed in the library internals. [#308](https://github.com/Ocramius/ProxyManager/issues/308) 88 89 ## 2.0.1 90 91 ### Fixed 92 93 - Travis-CI environment was fixed to test the library using the minimum dependencies version. 94 95 ### Added 96 97 - Added unit test to make sure that properties skipped should be preserved even being cloned. 98 99 ## 2.0.0 100 101 ### BC Breaks 102 103 Please refer to [the upgrade documentation](UPGRADE.md) to see which backwards-incompatible 104 changes were applied to this release. 105 106 ### New features 107 108 #### PHP 7 support 109 110 ProxyManager will now correctly operate in PHP 7 environments. 111 112 #### PHP 7 Return type hints 113 114 ProxyManager will now correctly mimic signatures of methods with return type hints: 115 116 ```php 117 class SayHello 118 { 119 public function hello() : string 120 { 121 return 'hello!'; 122 } 123 } 124 ``` 125 126 #### PHP 7 Scalar type hints 127 128 ProxyManager will now correctly mimic signatures of methods with scalar type hints 129 130 ```php 131 class SayHello 132 { 133 public function hello(string $name) : string 134 { 135 return 'hello, ' . $name; 136 } 137 } 138 ``` 139 140 #### PHP 5.6 Variadics support 141 142 ProxyManager will now correctly mimic behavior of methods with variadic parameters: 143 144 ```php 145 class SayHello 146 { 147 public function hello(string ...$names) : string 148 { 149 return 'hello, ' . implode(', ', $names); 150 } 151 } 152 ``` 153 154 By-ref variadic arguments are also supported: 155 156 ```php 157 class SayHello 158 { 159 public function hello(string ... & $names) 160 { 161 foreach ($names as & $name) { 162 $name = 'hello, ' . $name; 163 } 164 } 165 } 166 ``` 167 168 #### Constructors in proxies are not replaced anymore 169 170 In ProxyManager v1.x, the constructor of a proxy was completely replaced with a method 171 accepting proxy-specific parameters. 172 173 This is no longer true, and you will be able to use the constructor of your objects as 174 if the class wasn't proxied at all: 175 176 ```php 177 class SayHello 178 { 179 public function __construct() 180 { 181 echo 'Hello!'; 182 } 183 } 184 185 /* @var $proxyGenerator \ProxyManager\ProxyGenerator\ProxyGeneratorInterface */ 186 $proxyClass = $proxyGenerator->generateProxy( 187 new ReflectionClass(SayHello::class), 188 new ClassGenerator('ProxyClassName') 189 ); 190 191 eval('<?php ' . $proxyClass->generate()); 192 193 $proxyName = $proxyClass->getName(); 194 $object = new ProxyClassName(); // echoes "Hello!" 195 196 var_dump($object); // a proxy object 197 ``` 198 199 If you still want to manually build a proxy (without factories), a 200 `public static staticProxyConstructor` method is added to the generated proxy classes. 201 202 #### Friend classes support 203 204 You can now access state of "friend objects" at any time. 205 206 ```php 207 class EmailAddress 208 { 209 private $address; 210 211 public function __construct(string $address) 212 { 213 assertEmail($address); 214 215 $this->address = $address; 216 } 217 218 public function equalsTo(EmailAddress $other) 219 { 220 return $this->address === $other->address; 221 } 222 } 223 ``` 224 225 When using lazy-loading or access-interceptors, the `equalsTo` method will 226 properly work, as even `protected` and `private` access are now correctly proxied. 227 228 #### Ghost objects now only lazy-load on state-access 229 230 Lazy loading ghost objects now trigger lazy-loading only when their state is accessed. 231 This also implies that lazy loading ghost objects cannot be used with interfaces anymore. 232 233 ```php 234 class AccessPolicy 235 { 236 private $policyName; 237 238 /** 239 * Calling this method WILL cause lazy-loading, when using a ghost object, 240 * as the method is accessing the object's state 241 */ 242 public function getPolicyName() : string 243 { 244 return $this->policyName; 245 } 246 247 /** 248 * Calling this method WILL NOT cause lazy-loading, when using a ghost object, 249 * as the method is not reading any from the object. 250 */ 251 public function allowAccess() : bool 252 { 253 return false; 254 } 255 } 256 ``` 257 258 #### Faster ghost object state initialization 259 260 Lazy loading ghost objects can now be initialized in a more efficient way, by avoiding 261 reflection or setters: 262 263 ```php 264 class Foo 265 { 266 private $a; 267 protected $b; 268 public $c; 269 } 270 271 $factory = new \ProxyManager\Factory\LazyLoadingGhostFactory(); 272 273 $proxy = $factory-createProxy( 274 Foo::class, 275 function ( 276 GhostObjectInterface $proxy, 277 string $method, 278 array $parameters, 279 & $initializer, 280 array $properties 281 ) { 282 $initializer = null; 283 284 $properties["\0Foo\0a"] = 'abc'; 285 $properties["\0*\0b"] = 'def'; 286 $properties['c'] = 'ghi'; 287 288 return true; 289 } 290 ); 291 292 293 $reflectionA = new ReflectionProperty(Foo::class, 'a'); 294 $reflectionA->setAccessible(true); 295 296 var_dump($reflectionA->getValue($proxy)); // dumps "abc" 297 298 $reflectionB = new ReflectionProperty(Foo::class, 'b'); 299 $reflectionB->setAccessible(true); 300 301 var_dump($reflectionB->getValue($proxy)); // dumps "def" 302 303 var_dump($proxy->c); // dumps "ghi" 304 ``` 305 306 #### Skipping lazy-loaded properties in generated proxies 307 308 Lazy loading ghost objects can now skip lazy-loading for certain properties. 309 This is especially useful when you have properties that are always available, 310 such as identifiers of entities: 311 312 ```php 313 class User 314 { 315 private $id; 316 private $username; 317 318 public function getId() : int 319 { 320 return $this->id; 321 } 322 323 public function getUsername() : string 324 { 325 return $this->username; 326 } 327 } 328 329 /* @var $proxy User */ 330 $proxy = (new \ProxyManager\Factory\LazyLoadingGhostFactory())->createProxy( 331 User::class, 332 function ( 333 GhostObjectInterface $proxy, 334 string $method, 335 array $parameters, 336 & $initializer, 337 array $properties 338 ) { 339 $initializer = null; 340 341 var_dump('Triggered lazy-loading!'); 342 343 $properties["\0User\0username"] = 'Ocramius'; 344 345 return true; 346 }, 347 [ 348 'skippedProperties' => [ 349 "\0User\0id", 350 ], 351 ] 352 ); 353 354 $idReflection = new \ReflectionProperty(User::class, 'id'); 355 356 $idReflection->setAccessible(true); 357 $idReflection->setValue($proxy, 123); 358 359 var_dump($proxy->getId()); // 123 360 var_dump($proxy->getUsername()); // "Triggered lazy-loading!", then "Ocramius" 361 ``` 362 363 #### Proxies are now always generated on-the-fly by default 364 365 Proxies are now automatically generated any time you require them: no configuration 366 needed. If you want to gain better performance, you may still want to read 367 the [tuning for production docs](docs/tuning-for-production.md). 368 369 #### Proxy names are now hashed, simplified signature is attached to them 370 371 Proxy classes now have shorter names, as the parameters used to generate them are 372 hashed into their name. A signature is attached to proxy classes (as a private static 373 property) so that proxy classes aren't re-used across library updates. 374 Upgrading ProxyManager will now cause all proxies to be re-generated automatically, 375 while the old proxy files are going to be ignored.
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Mar 24 21:31:15 2022 | Cross-referenced by PHPXref 0.7.1 |