PackageTrack
Sign in Get early access

mglaman/phpstan-drupal

Drupal extension and rules for PHPStan

2.1.2 33M downloads/mo #736 most downloaded on Packagist mglaman/phpstan-drupal

What this package is like to depend on

Last release 10 days ago

13 Aug 2026

Release timing varies

gaps range from 2 weeks to 4 months

Rarely documented

notes for 10 of 119 stable releases

Nothing withdrawn

no release was ever pulled

8 years old

119 releases · first in 2019

12 releases in the last 12 months

see the full history below

Release timeline

119 releases · Jan 2019 to Aug 2026
2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 60 of 119
  1. 2.1.2 13 Aug 2026
    Release notes

    What's Changed

    • Ignore environment-dependent instanceof.alwaysTrue in getChildren() by @mglaman in #1033
    • Do not crash on first-class callables or missing args in getStorage() by @mglaman in #1026
    • Harden include-loading rules against masked failures by @mglaman in #1034
    • Do not fatal when a shorthand service class cannot be loaded by @mglaman in #1023

    Full Changelog: 2.0.18...2.1.2

    Open source →
  2. 2.1.1 17 Jul 2026
    Release notes

    What's Changed

    • Add PathItem field type stub by @oiahoon in #1007
    • Fix readonly false positive in DependencySerializationTraitPropertyRule by @mglaman in #1010
    • Test against Drupal 11.4 and PHP 8.5, drop EOL 11.2 by @mglaman in #1011
    • Fix never type for dynamic container service IDs by @mglaman in #1014

    New Contributors

    Full Changelog: 2.1.0...2.1.1

    Open source →
  3. 2.1.0 14 Jul 2026
    Release notes

    phpstan-drupal 2.1.0 graduates a set of opt-in rules and bleeding-edge behavior to the defaults. Expect new reported errors after upgrading — each change below includes the configuration to restore the old behavior.

    Upgrading from 2.0

    Nine rules are now enabled by default

    testClassSuffixNameRule, dependencySerializationTraitPropertyRule, accessResultConditionRule, cacheableDependencyRule, hookFormAlterRule, loggerFromFactoryPropertyAssignmentRule, entityStorageDirectInjectionRule, symfonyYamlParseRule, and entityOperationsCacheabilityRule no longer require opt-in. Disable any of them individually:

    parameters:
        drupal:
            rules:
                cacheableDependencyRule: false

    See the README for what each rule reports.

    hookRules renamed to hookFormAlterRule

    If your configuration referenced hookRules, rename the key. The old name is no longer recognized.

    ContainerInterface::has() returns bool for known services

    containerHasAlwaysTrue now defaults to false, so conditional service guards are no longer reported as always-true. This graduated from bleedingEdge.neon. Restore the old inference:

    parameters:
        drupal:
            bleedingEdge:
                containerHasAlwaysTrue: true

    loadInclude() checks now apply to concrete ModuleHandler receivers

    An inverted type check made the LoadIncludes rule silently skip receivers typed as the concrete ModuleHandler class and fire on plain object/mixed receivers. Both directions are fixed, which may surface new loadIncludes.* errors in code that was previously skipped. Thanks @donquixote!

    New

    Opt out of class resolver return type narrowing

    getInstanceFromDefinition() narrows to the passed class name, but the container can substitute a different class at runtime. Set classResolverReturnType: false to fall back to the declared object return type and keep instanceof assertions meaningful:

    parameters:
        drupal:
            classResolverReturnType: false

    drupal-finder constraint widened

    The webflo/drupal-finder constraint is now ^1.3.1 || ^2.0, so projects pick up drupal-finder 2.0 as soon as it releases. Nothing changes today — 1.3.1 remains the latest published version.

    What's Changed

    • Widen drupal-finder constraint and drop stale baseline entries by @mglaman in #999
    • Promote 9 opt-in rules to default; rename hookRules to hookFormAlterRule by @mglaman in #1000
    • Fix supertype condition in LoadIncludes. by @donquixote in #587
    • Run CI on 2.0.x maintenance branch by @mglaman in #1002
    • Allow disabling class resolver return type narrowing by @mglaman in #1003
    • Make containerHasAlwaysTrue false by default by @mglaman in #1005

    New Contributors

    Full Changelog: 2.0.17...2.1.0

    Open source →
  4. 2.0.18 17 Jul 2026
    Release notes

    What's Changed

    • Add PathItem field type stub by @oiahoon in #1007
    • Fix readonly false positive in DependencySerializationTraitPropertyRule by @mglaman in #1010
    • Test against Drupal 11.4 and PHP 8.5, drop EOL 11.2 by @mglaman in #1011
    • Fix never type for dynamic container service IDs by @mglaman in #1014

    New Contributors

    Full Changelog: 2.1.0...2.0.18

    Open source →
  5. 2.0.17 13 Jul 2026
    Release notes

    What's Changed

    Full Changelog: 2.0.16...2.0.17

    Open source →
  6. 2.0.16 30 Jun 2026
    Release notes

    What's Changed

    • Fix InspectorTypeExtensionTest failure with PHPStan HEAD by @mglaman in #991
    • Allow symfony/runtime plugin to be blocked in composer config by @mglaman in #990
    • Fix false positive when deprecation helper is inside functioncall by @bbrala in #989
    • Bump actions/checkout from 6 to 7 by @dependabot[bot] in #994
    • Bump actions/cache from 5 to 6 by @dependabot[bot] in #997

    Full Changelog: 2.0.15...2.0.16

    Open source →
  7. 2.0.15 24 Apr 2026
    Release notes

    2.1.0 is coming soon, which will enable some rules that are currently disabled by default. The rules can still be turned off. If you're worried about disruptions, change your Composer constraint to ~2.0.14 to avoid minor version bumps.

    What's Changed

    • Fix hook_entity_operation cacheability parameter should not be nullable by @mglaman in #985
    • Fix false positive in entityStoragePropertyAssignment rule when assigning null by @mglaman in #986
    • Fix ContainerInterface::has() returning always-true for known services by @mglaman in #987
    • Fix wrongly deprecated method RevisionableStorageInterface::loadRevision by @TheFakeCake in #980

    New Contributors

    Full Changelog: 2.0.14...2.0.15

    Open source →
  8. 2.0.14 22 Apr 2026
    Release notes

    2.1.0 is coming soon, which will enable some rules that are currently disabled by default. The rules can still be turned off. If you're worried about disruptions, change your Composer constraint to ~2.0.14 to avoid minor version bumps.

    What's Changed

    • Fix multisite extension discovery by scanning all sites/*/ directories by @dpagini in #956
    • Add stubs for daterange field type by @ceesgeene in #786
    • Infer return type from class-string in ClassResolver extensions by @mglaman in #965
    • Fix inverted isCount cache key logic in EntityQueryType by @mglaman in #966
    • Add LoggerFromFactoryPropertyAssignmentRule by @mglaman in #968
    • Add EntityStorageDirectInjectionRule by @mglaman in #969
    • Document opt-in rules and bleedingEdge parameters by @mglaman in #970
    • Add entity-type-id custom PHPDoc type by @mglaman in #972
    • Allow \Drupal usage check on render elements by @mglaman in #973
    • Fix InspectorTypeExtension compatibility with PHPStan 2.1.47 mixed~null type by @mglaman in #976
    • Move phpstan_fixtures test data to tests/src/Rules/data by @mglaman in #974
    • Add rule to detect Symfony\Component\Yaml\Yaml::parse() usage by @mglaman in #978
    • Add rules to detect missing CacheableMetadata parameter in entity operation methods and hooks by @mglaman in #979

    New Contributors

    Full Changelog: 2.0.13...2.0.14

    Open source →
  9. 2.0.13 07 Apr 2026
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 2.0.12...2.0.13

    Open source →
  10. 2.0.12 20 Mar 2026
    Release notes

    What's Changed

    • Make FieldItemListPropertyReflection entity property nullable by @Niklan in #950
    • Fix method.alreadyNarrowedType from all QueryInterface::accessCheck()s (#825) by @travis-bradbury in #951
    • Use container to resolve PHPStan built-in rules in tests by @mglaman in #954
    • Add TodoCommentWithIssueUrlRule to flag @todo comments referencing the current issue by @mglaman in #953

    New Contributors

    Full Changelog: 2.0.11...2.0.12

    Open source →
  11. 2.0.11 25 Feb 2026

    Nothing published for this version

  12. 2.0.10 22 Oct 2025

    Nothing published for this version

  13. 2.0.9 05 Aug 2025

    Nothing published for this version

  14. 2.0.8 04 Aug 2025

    Nothing published for this version

  15. 2.0.7 22 May 2025

    Nothing published for this version

  16. 2.0.6 20 May 2025

    Nothing published for this version

  17. 2.0.5 15 Apr 2025

    Nothing published for this version

  18. 2.0.4 10 Apr 2025

    Nothing published for this version

  19. 2.0.3 03 Apr 2025

    Nothing published for this version

  20. 2.0.2 27 Mar 2025

    Nothing published for this version

  21. 2.0.1 17 Jan 2025

    Nothing published for this version

  22. 2.0.0 11 Dec 2024

    Nothing published for this version

  23. 1.3.9 22 May 2025

    Nothing published for this version

  24. 1.3.8 20 May 2025

    Nothing published for this version

  25. 1.3.7 15 Apr 2025

    Nothing published for this version

  26. 1.3.6 10 Apr 2025

    Nothing published for this version

  27. 1.3.5 03 Apr 2025

    Nothing published for this version

  28. 1.3.4 27 Mar 2025

    Nothing published for this version

  29. 1.3.3 23 Jan 2025

    Nothing published for this version

  30. 1.3.2 19 Nov 2024

    Nothing published for this version

  31. 1.3.1 27 Sep 2024

    Nothing published for this version

  32. 1.3.0 27 Sep 2024

    Nothing published for this version

  33. 1.2.12 07 Aug 2024

    Nothing published for this version

  34. 1.2.11 10 May 2024

    Nothing published for this version

  35. 1.2.10 02 Apr 2024

    Nothing published for this version

  36. 1.2.9 22 Mar 2024

    Nothing published for this version

  37. 1.2.8 21 Mar 2024

    Nothing published for this version

  38. 1.2.7 14 Feb 2024

    Nothing published for this version

  39. 1.2.6 16 Jan 2024

    Nothing published for this version

  40. 1.2.5 10 Jan 2024

    Nothing published for this version

  41. 1.2.4 14 Nov 2023

    Nothing published for this version

  42. 1.2.3 13 Nov 2023

    Nothing published for this version

  43. 1.2.2 09 Nov 2023

    Nothing published for this version

  44. 1.2.1 03 Nov 2023

    Nothing published for this version

  45. 1.2.0 24 Aug 2023

    Nothing published for this version

  46. 1.1.37 25 Jul 2023

    Nothing published for this version

  47. 1.1.36 28 Jun 2023

    Nothing published for this version

  48. 1.1.35 14 Jun 2023

    Nothing published for this version

  49. 1.1.34 24 May 2023

    Nothing published for this version

  50. 1.1.33 17 May 2023

    Nothing published for this version

  51. 1.1.32 10 May 2023

    Nothing published for this version

  52. 1.1.31 27 Apr 2023

    Nothing published for this version

  53. 1.1.30 07 Apr 2023

    Nothing published for this version

  54. 1.1.29 08 Feb 2023

    Nothing published for this version

  55. 1.1.28 01 Feb 2023

    Nothing published for this version

  56. 1.1.27 25 Jan 2023

    Nothing published for this version

  57. 1.1.26 22 Dec 2022

    Nothing published for this version

  58. 1.1.25 18 Jul 2022

    Nothing published for this version

  59. 1.1.24 14 Jul 2022

    Nothing published for this version

  60. 1.1.23 14 Jul 2022

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive