This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 213609 - Overriding methods visibility in traits does not affects on CC hints
Summary: Overriding methods visibility in traits does not affects on CC hints
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2012-06-05 14:51 UTC by fruit
Modified: 2016-09-22 17:08 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fruit 2012-06-05 14:51:12 UTC
Product Version: NetBeans IDE Dev (Build 201206040001)
Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21
System: Linux version 2.6.35.14-106.fc14.x86_64 running on amd64; UTF-8; en_US (nb)

Hi,

Traits allows you to adjust a method visibility. By now, CC shows both 2 methods publicly available ("getAnswer" and "getName"), but should return only one "getToken".


<?php

  trait TheAbsoluteEssenceOfAll
  {
    public function getAnswer () { return 42; }
    public function getName () { return null; }
    protected function getToken () { return 'ABC'; }
  }

  class Universe
  {
    use TheAbsoluteEssenceOfAll {
      getAnswer as private;
      getName as protected;
      getToken as public;
    }
  }

  $uni = new Universe();
  $uni->
       +--------------------------------------+
       | getAnswer()  TheAbsoluteEssenceOfAll |
       | getName()    TheAbsoluteEssenceOfAll |
       +--------------------------------------+
Comment 1 Ondrej Brejla 2012-06-05 14:56:39 UTC
Nothing from "use traits block" wasn't implemented in this firts support implementation (which is in 7.2). All things are enhancements for 7.3 and later (adding aliased methods into CC, and such). It has been mentioned in blog post afaik.

Thanks for your interrest.
Comment 2 Ondrej Brejla 2012-06-05 14:58:39 UTC
By "use traits block" I mean that block part after use trait statement ;) Where conflicts are solved and such :)
Comment 3 EdmondX 2012-09-14 11:16:59 UTC
Code inspector ignores implementation trait methods when class implements interface.

Example:

<?PHP

interface DependencyInjection
{
    public function _inject_dependencies();
}

trait LazyInjector
{
    public function _inject_dependencies()
    {
         ...
    }
}

class Configurator      implements      DependencyInjection
      ^^^^^^^^^^^^ -- IDE marks the class does not implement the method _inject_dependencies()
{
    use LazyInjector;
Comment 4 Ondrej Brejla 2012-09-17 07:41:53 UTC
EdmondX that issue is fixed in dev build.
Comment 5 amobilia 2016-09-22 17:08:35 UTC
Reproductible in 8.2rc / Dev 201609210002