HomePhorge

Warn against writing to undeclared properties

Description

Warn against writing to undeclared properties

Summary:
I make this error quite often: I forget to declare a property I am writing to or I make a typo in it.
PHP implicitly creates a public property which I don't like.

I would much rather see a linter warning me against this than this runtime check but writing it is very difficult:

  • We need to explore all parents of the class we are checking.
  • It is even possible that children will declare that property but it's OK to treat this as error anyway.
  • We can extend also builtin or external classes.
  • It's somewhat doable for $this but even more complex for any $obj because we don't know the class of it.

This should catch significant part of these errors and I'm fine with that.

I don't plan escalating to exception because this error is not fatal and should not stop the application from working.

Test Plan: Loaded homepage, checked log.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3601

Details

Provenance
vranaAuthored on Oct 3 2012, 11:07 AM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rP7c39c4ca7d35: Declare common Lisk properties
Branches
Loading...
Tags
Loading...

Event Timeline