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