Larastan: v0.3.19 with PHPStan 0.11.14 will crash

Created on 17 Aug 2019  Â·  9Comments  Â·  Source: nunomaduro/larastan

 Symfony\Component\Debug\Exception\FatalErrorException  : Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)

  at /project/vendor/nunomaduro/larastan/src/Methods/Macro.php:19
    15|
    16| use ReflectionClass;
    17| use PHPStan\Reflection\Php\BuiltinMethodReflection;
    18|
  > 19| final class Macro implements BuiltinMethodReflection
    20| {
    21|     /**
    22|      * The class name.
    23|      *


   Whoops\Exception\ErrorException  : Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)

  at /project/vendor/nunomaduro/larastan/src/Methods/Macro.php:19
    15|
    16| use ReflectionClass;
    17| use PHPStan\Reflection\Php\BuiltinMethodReflection;
    18|
  > 19| final class Macro implements BuiltinMethodReflection
    20| {
    21|     /**
    22|      * The class name.
    23|      *

  Exception trace:

  1   Whoops\Run::handleError("Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)", "/project/vendor/nunomaduro/larastan/src/Methods/Macro.php")
      /project/vendor/filp/whoops/src/Whoops/Run.php:433

  2   Whoops\Run::handleShutdown()
      [internal]:0
bug

Most helpful comment

I had no idea this is gonna be a BC break, BuiltinMethodReflection is meant
for internal use only... will look for a fix.

On Sat, 17 Aug 2019 at 15:30, 刘相轩 notifications@github.com wrote:

Symfony\Component\Debug\Exception\FatalErrorException : Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)

at /project/vendor/nunomaduro/larastan/src/Methods/Macro.php:19
15|
16| use ReflectionClass;
17| use PHPStan\Reflection\Php\BuiltinMethodReflection;
18|

19| final class Macro implements BuiltinMethodReflection
20| {
21| /**
22| * The class name.
23| *

Whoops\Exception\ErrorException : Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)

at /project/vendor/nunomaduro/larastan/src/Methods/Macro.php:19
15|
16| use ReflectionClass;
17| use PHPStan\Reflection\Php\BuiltinMethodReflection;
18|

19| final class Macro implements BuiltinMethodReflection
20| {
21| /**
22| * The class name.
23| *

Exception trace:

1 Whoops\Run::handleError("Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)", "/project/vendor/nunomaduro/larastan/src/Methods/Macro.php")
/project/vendor/filp/whoops/src/Whoops/Run.php:433

2 Whoops\Run::handleShutdown()
[internal]:0

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nunomaduro/larastan/issues/297?email_source=notifications&email_token=AAAZTOG464H4N2MGT4AQ4JDQE74PRA5CNFSM4IMPNFA2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFZAAMA,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAZTOE4CMOLSSXDHLGKG63QE74PRANCNFSM4IMPNFAQ
.

>

Ondřej Mirtes

All 9 comments

I had no idea this is gonna be a BC break, BuiltinMethodReflection is meant
for internal use only... will look for a fix.

On Sat, 17 Aug 2019 at 15:30, 刘相轩 notifications@github.com wrote:

Symfony\Component\Debug\Exception\FatalErrorException : Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)

at /project/vendor/nunomaduro/larastan/src/Methods/Macro.php:19
15|
16| use ReflectionClass;
17| use PHPStan\Reflection\Php\BuiltinMethodReflection;
18|

19| final class Macro implements BuiltinMethodReflection
20| {
21| /**
22| * The class name.
23| *

Whoops\Exception\ErrorException : Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)

at /project/vendor/nunomaduro/larastan/src/Methods/Macro.php:19
15|
16| use ReflectionClass;
17| use PHPStan\Reflection\Php\BuiltinMethodReflection;
18|

19| final class Macro implements BuiltinMethodReflection
20| {
21| /**
22| * The class name.
23| *

Exception trace:

1 Whoops\Run::handleError("Class NunoMaduro\Larastan\Methods\Macro contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (PHPStan\Reflection\Php\BuiltinMethodReflection::isFinal, PHPStan\Reflection\Php\BuiltinMethodReflection::isInternal)", "/project/vendor/nunomaduro/larastan/src/Methods/Macro.php")
/project/vendor/filp/whoops/src/Whoops/Run.php:433

2 Whoops\Run::handleShutdown()
[internal]:0

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nunomaduro/larastan/issues/297?email_source=notifications&email_token=AAAZTOG464H4N2MGT4AQ4JDQE74PRA5CNFSM4IMPNFA2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFZAAMA,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAZTOE4CMOLSSXDHLGKG63QE74PRANCNFSM4IMPNFAQ
.

>

Ondřej Mirtes

Fix in #298.

@ondrejmirtes @szepeviktor The pervious crash is gone, but I got another one.

PHPStan: v0.11.14
Larastan: v0.3.20
php-parse: v4.2.3

   InvalidArgumentException  : Expected string, array of parts or Name instance

  at /Users/xuan/Projects/api/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php:234
    230|         } elseif ($name instanceof self) {
    231|             return $name->parts;
    232|         }
    233|
  > 234|         throw new \InvalidArgumentException(
    235|             'Expected string, array of parts or Name instance'
    236|         );
    237|     }
    238|

  Exception trace:

  1   PhpParser\Node\Name::prepareName(Object(Closure))
     /project/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php:26

  2   PhpParser\Node\Name::__construct(Object(Closure))
     /project/vendor/nunomaduro/larastan/src/Methods/Pipes/Macros.php:68

  Please use the argument -v to see more details.

There’s a new PR waiting already, sorry 😊

On Sun, 18 Aug 2019 at 05:02, 刘相轩 notifications@github.com wrote:

@ondrejmirtes https://github.com/ondrejmirtes @szepeviktor
https://github.com/szepeviktor The pervious crash is gone, but I got
another one.

PHPStan: v0.11.14
Larastan: v0.3.20
php-parse: v4.2.3

InvalidArgumentException : Expected string, array of parts or Name instance

at /Users/xuan/Projects/api/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php:234
230| } elseif ($name instanceof self) {
231| return $name->parts;
232| }
233|

234| throw new \InvalidArgumentException(
235| 'Expected string, array of parts or Name instance'
236| );
237| }
238|

Exception trace:

1 PhpParser\Node\Name::prepareName(Object(Closure))
/Users/xuan/Projects/api/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php:26

2 PhpParser\Node\Name::__construct(Object(Closure))
/Users/xuan/Projects/api/vendor/nunomaduro/larastan/src/Methods/Pipes/Macros.php:68

Please use the argument -v to see more details.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/nunomaduro/larastan/issues/297?email_source=notifications&email_token=AAAZTOF6ALM5UVEPJU4J2KTQFC3UHA5CNFSM4IMPNFA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QXNEI#issuecomment-522286737,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAZTODA2DNONWFH6YWGUYTQFC3UHANCNFSM4IMPNFAQ
.

>

Ondřej Mirtes

Can you test with v0.3.21? @nauxliu

Tested PHPStan 0.11.15 with v0.3.21, no more crash, thanks @ondrejmirtes @nunomaduro

Thanks to @ondrejmirtes.

Was this page helpful?
0 / 5 - 0 ratings