![]() ![]() It needs to be part of your continuous integration process. Start using PHPStan as part of your development flow. ![]() Helping junior developers grow by using PHPStan One of those was handled in GitHub issues versus Slack/Twitter. This example is based on real support that I have provided multiple times. This is because the hook has the default type of EntityInterface when it should be NodeInterface, which has isPublished. When the typo is fixed, assuming that is the problem, PHPStan may say that it still does not exist. PHPStan does not report the typo until we go to level 2. The slides go through the example of a typo for a call to an expected isPublished method in a hook_node_insert hook. ![]() Level 2 begins to report undefined methods called on classes. Why do we need to run PHPStan at level 2? You should add PHPStan as part of your development workflow to help your team leads and junior developers.Running PHPStan at level 0 is not enough, and we all should be running at level 2 for catching deprecations.Two main takeaways could be taken away from my session, I believe: Dries suggested we provide something more straightforward for the end-users, hence the birth of drupal-check and its demo during the DrupalCon Seattle Driesnote. vendor/mglaman/phpstan-drupal/extension.neon vendor/phpstan/phpstan-deprecation-rules/rules.neon Setting up PHPStan + phpstan-drupal wasn't difficult, but you had to make sure to include the extension configuration files in your phpstan.neon for phpstan-drupal and phpstan-deprecation-rules. The phpstan/extension-installer package did not exist. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |