Review main Merged

63480[TASK] Setup missing constants in phpstan bootstrap file

Alexander Schnitzler CR +2 V +2 Easy +23 −0 updated 02/28/20, 15:49

Commit message

This patch introduces a bootstrap file for phpstan to define
missing constants phpstan would report otherwise.

A dedicated config file phpstan.typo3.neon has been
introduced because there are plans to release a seperate
configuration package that not only the core uses but
which is also useful for TYPO3 users that test their
codebase with phpstan.

Review

  • Code review CR +2 Done
    • Susi Moog +2
    • Daniel Goerz +1
  • Verified V +2 Done
    • Susi Moog +2
    • Daniel Goerz +1
    • TYPO3com +1 CI

Issues 1

Files 3

Review log 1316

  1. Alexander Schnitzler uploaded patch set 1 02/28/20, 13:55

  2. Alexander Schnitzler wrote 02/28/20, 13:55

    Topic set to phpstan
  3. TYPO3com voted on patch set 1 V -1 02/28/20, 14:05 Completed build in 10m 01s on Fri, 28 Feb, 02:05 PM Test Summary: 72042 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-790

  4. Daniel Goerz commented on patch set 1 02/28/20, 14:09

    phpstan.typo3.neon:4

    Why not adding this directly to phpstan.neon?
  5. TYPO3com voted on patch set 1 V +1 02/28/20, 14:31 Completed build in 46m 07s on Fri, 28 Feb, 02:31 PM Test Summary: 72051 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-790

  6. Alexander Schnitzler updated the commit message in patch set 2 02/28/20, 14:34

  7. Alexander Schnitzler commented on patch set 2 02/28/20, 14:34

    phpstan.typo3.neon:4 Reply

    Please see commit message.
  8. TYPO3com voted on patch set 2 V +1 02/28/20, 14:50 Completed build in 13m 44s on Fri, 28 Feb, 02:50 PM Test Summary: 72051 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-794

  9. Daniel Goerz commented on patch set 2 02/28/20, 14:58

    phpstan.typo3.neon:4 Reply

    Ack
  10. Daniel Goerz commented on patch set 2 V +1 CR +1 02/28/20, 15:04

    Thanks for explaining. Down to 25 errors for Level 1 with this patch.
  11. Susi Moog commented on patch set 2 02/28/20, 15:16

    phpstan.bootstrap.php:3

    there is no way to call / use the SystemEnvironmentBuilder here? I fear duplicating all those basics is a bit annoying in the long run.
  12. Alexander Schnitzler commented on patch set 2 02/28/20, 15:26

    phpstan.bootstrap.php:3 Reply

    Not in the current state as the SystemEnvironmentBuilder builder needs to be booted to set the constants. Also, some constants are set elsewhere. And on top, some constants are set dynamically, like TYPO3_REQUESTTYPE. If you would adjust the core to have a class, setting all the static constants, we could use that. But what we don't want, is to bootstrap parts of TYPO3 to make phpstan happy. That will go south and then we rather ignore the errors.
  13. Alexander Schnitzler commented on patch set 2 02/28/20, 15:28

    phpstan.bootstrap.php:3 Reply

    Also, please keep in mind that we want to release this as a separate package in the future where we don't have access to the SystemEnvironmentBuilder. I fear the best thing to do is to reduce the amount of global constants in our code base.
  14. Susi Moog commented on patch set 2 02/28/20, 15:33

    phpstan.bootstrap.php:3 Reply Unresolved

    That's nothing to fear ;) but something to look forward to. (I basically just compared how we do it for the testing framework etc. that's why I was asking - but I'm also fine with using it this way for now and will merge after running locally - I guess we will hopefully not introduce more global constants in the future).
  15. Susi Moog voted on patch set 2 V +2 CR +2 02/28/20, 15:49

  16. Susi Moog merged patch set 3 02/28/20, 15:49