Something that's extremely handy from the php-integrator in Atom is the icons on the side by the line numbers which would show when a method has been overridden, or when an interface method has been implemented. (This might be a separate feature?)
I think this is very important and I hope to achieve it as soon as possible
What I also miss is a warning, if not all interface methods are implemented yet.
Interfaces in intelephense are mostly silent now, at least compiler will throw errors.
Implement all method wouldn't be as necessary if there would be an error about not implemented method, existing autocomplete is enough for implementing methods one by one.
Test code (no intelephense warnings):
interface IAbc
{
function testMe(int $i): bool;
}
class Abc implements IAbc
{}
// results with:
// E_ERROR: Class Abc contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (IAbc::testMe) (in [...])
class Def implements IAbc
{
function testMe(int $i): int
{
return 1;
}
}
// results with:
// E_COMPILE_ERROR: Declaration of Def::testMe(int $i): int must be compatible with IAbc::testMe(int $i): bool (in [...])
Same story is with abstract
abstract class AB
{
abstract public function testMe(int $i): bool;
}
class CD extends AB
{
public function testMe(int $i): int
{
return 1;
}
}
// results with:
// E_COMPILE_ERROR: Declaration of CD::testMe(int $i): int must be compatible with AB::testMe(int $i): bool (in [...])
This one is high on the agenda. Diagnostics for the missing implementations will be in 1.3
@bmewburn Do you expect this to be enforced based on the entire method signature including arg types, or just the method name (and perhaps param count)? Hit a case recently where the former would have been a huge help in preventing a bug. Example:
interface Foo {
function bar(MyClass $arg);
}
class MyFoo implements Foo {
function bar(string $arg) { // <-- runtime error on $arg type; catching it statically would be great!
}
}
@nickcabral , yes the complete signature as found on the interface or abstract class.
Most helpful comment
What I also miss is a warning, if not all interface methods are implemented yet.