opentracing / opentracing-php

OpenTracing API for PHP
Apache License 2.0
505 stars 56 forks source link

What's the benefit of isTypeReferenceFrom() over instanceof ReferenceFrom? #5

Closed felixfbecker closed 7 years ago

felixfbecker commented 7 years ago

From @felixfbecker on June 9, 2017 16:59

If more types are added in the future, this puts a burden on us to always add type checking methods for them

Copied from original issue: jcchavezs/opentracing-php#7

felixfbecker commented 7 years ago

From @jcchavezs on July 4, 2017 7:59

@felixfbecker I'd avoid using typeof as I believe it is much better to ask questions to the object about its type rather than bypassing its knowledge by using typeof. In addition, that would make impossible to compose the reference classes for references. I'd rather leave the Reference as an interface and let the implementor to use composition or whatever other pattern making sure the contract is fulfilled and that it is the object itself the one answering questions about its type.

jcchavezs commented 7 years ago

Closed by https://github.com/opentracing/opentracing-php/pull/9