Skip to content

v0.10 offsetGet in conflict with getComponent #24

Closed
@solcik

Description

@solcik

Hello,

thank you very much for v0.10.
I tried it right away in my project and found a lot of these errors.

 ------ ------------------------------------------------------------------------------
  Line   src/....php
 ------ ------------------------------------------------------------------------------
  43     Cannot access offset 'form' on Nette\ComponentModel\IComponent.
  59     Cannot access offset 'form' on Nette\ComponentModel\IComponent.
  86     Cannot access offset 'price' on Nette\ComponentModel\IComponent.
  87     Access to an undefined property Nette\ComponentModel\IComponent::$onSuccess.
 ------ ------------------------------------------------------------------------------

These were not shown in 0.9 and I think that conflict is between new handling of offsetGet and current dynamicReturnType for getComponent().

https://github.com/phpstan/phpstan-nette/blob/master/src/Type/Nette/ComponentModelDynamicReturnTypeExtension.php

https://github.com/nette/application/blob/v2.4.12/src/Application/UI/Component.php#L377-L386

If I change arrayAccess to get components to ->getComponent() method calls, errors go away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions