rspec/rules/S1467/flex/rule.adoc

23 lines
437 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
A listener can be attached to an object only after it has been constructed. So dispatching an event in a constructor is useless and error prone.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
public class MyClass
{
public function MyClass()
{
dispatchEvent( new Event( "uselessEvent" ) );
}
}
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]