Skip to content

Commit ea15573

Browse files
authored
Merge pull request #21 from shochdoerfer/feature/autoload
Provide default autoload.php for PHPStan phar
2 parents d573e03 + 2a25172 commit ea15573

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,12 @@ Below is a list of known issues when using this extension:
3333

3434
This is because the PHPStan shim is included as a phar archive and does therefore not support overriding certain methods in it's namespace. The current known fix for this is to manually load the autoloader that comes with this extension.
3535

36-
Create a file in your project (for example `phpstan.php`) with the following content:
37-
38-
```php
39-
<?php
40-
\bitExpert\PHPStan\Magento\Autoload\Autoloader::register();
41-
```
42-
43-
Include this to the `autoload_files`-section of your `phpstan.neon`:
36+
Include the autoload.php file in the `autoload_files`-section of your `phpstan.neon`:
4437

4538
```neon
4639
parameters:
4740
autoload_files:
48-
- phpstan.php
41+
- vendor/bitexpert/phpstan-magento/autoload.php
4942
```
5043

5144
## Contribute

autoload.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the phpstan-magento package.
5+
*
6+
* (c) bitExpert AG
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
// Include this file if you are using the phar version of PHPStan. Since the phar version make use of dynamic namespaces
13+
// the hack in registration.php to overload spl_autoload_register() and spl_autoload_unregister() does not work any more.
14+
\bitExpert\PHPStan\Magento\Autoload\Autoloader::register();

0 commit comments

Comments
 (0)