Releases: mglaman/phpstan-drupal
1.1.11
Entity field analysis improvements
Field types provided by Drupal core have been stubbed to provide @property annotations. If you have a field value and it has been type hinted, PHPStan will not complain about accessing a non-existent property.
Example:
// EntityReferenceItem.
$entity_reference_field = $node->get('field_entity_reference')->first();
assert($entity_reference_field instanceof EntityReferenceItem);
assertType(EntityReferenceItem::class, $entity_reference_field);
assertType('int|string', $entity_reference_field->target_id);
assertType('Drupal\Core\Entity\EntityInterface', $entity_reference_field->entity);Updated deprecated global constants
Drupal 9.3.x and 9.4.x deprecated more global constants. The rule to check for these has been updated.
What's Changed
- Optimize BrowserTestBaseDefaultThemeRule by @neclimdul in #323
- BrowserTestBaseDefaultThemeRule namespace check by @mglaman in #319
- Resolve conflicts on root with drupal/core-dev:10.0.x by @mglaman in #324
- Update constants by @mallezie in #332
- Update README.md by @mallezie in #333
- Provide a stub for twig_escape_filter by @neclimdul in #327
- drupal/core:10.0.x requires PHP 8.1 by @mglaman in #345
- Fix HEAD fails on branch alias for build integration jobs by @mglaman in #346
- Add stubs for core field types by @mglaman in #344
New Contributors
- @neclimdul made their first contribution in #323
- @mallezie made their first contribution in #332
Full Changelog: 1.1.10...1.1.11
1.1.10
1.1.9
1.1.8
RenderCallbackRule Improvements
The RenderCallbackRule added in 1.1.5 had various flaws. This release should fix them:
- Improper analysis of
#access_callback– not an array, single callable. - Improper analysis of
#lazy_builder– an array, but of call_user_func_array values ([callable, args]) service_name:methodstyle callbacks were not parsed, now they are
What's Changed
- Calling getStorage with a constant does not resolve entity mapped storage class by @dpi in #300
- Handle controller notation for callbacks by @mglaman in #302
- Fix #lazy_builder callback analysis and static::class concatenation warning by @mglaman in #304
New Contributors
Full Changelog: 1.1.7...1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
What's Changed
- Add phpstan prophecy suggestion by @ptt-homme in #282
- Add phpstan/phpstan-phpunit to the suggested packages list by @ptt-homme in #283
- Add documentation for contrib entity mapping by @mglaman in #285
- Add tips to the extends internal class rule errors by @mglaman in #286
- Add return type extensions for AccessResult methods by @mglaman in #287
Full Changelog: 1.1.3...1.1.4
1.1.3
What's Changed
- Expand list of entity type storages by @ptt-homme in #277
- Allow ::referencedEntities on field items by @eiriksm in #265
New Contributors
- @ptt-homme made their first contribution in #277
Full Changelog: 1.1.2...1.1.3
1.1.2
Highlights
With #264 we have added the ability to look up discovered extensions, which should greatly improve the rules which load files called by module_load_include and ModuleHandlerInterface::loadInclude. Previously these two rules had to re-scan for extensions whenever the function or method was analyzed.
What's Changed
- Fail to map a service with a parent which overrides its parent too by @brambaud in #260
- Detect when a class extends a class that has been flagged as
@internalby @brambaud in #248 - issue #142: resolve incorrect $reflection definition by @eugene-brit in #178
- Add 10.0.x to tests by @mglaman in #269
- Make the discovered Drupal extensions accessible via a service by @brambaud in #264
- Respect
@propertyannotations on Entity classes by @jacktonkin in #268
New Contributors
- @eugene-brit made their first contribution in #178
- @jacktonkin made their first contribution in #268
Full Changelog: 1.1.1...1.1.2