You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Tomáš Procházka (Jira)" <ji...@apache.org> on 2022/07/17 18:19:00 UTC

[jira] [Commented] (NETBEANS-6078) Remove `mixed` type from JsonSerializable

    [ https://issues.apache.org/jira/browse/NETBEANS-6078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17567701#comment-17567701 ] 

Tomáš Procházka commented on NETBEANS-6078:
-------------------------------------------

I was not able to reproduce this issue in NetBeans 14.

> Remove `mixed` type from JsonSerializable
> -----------------------------------------
>
>                 Key: NETBEANS-6078
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-6078
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: php - Code Analysis
>            Reporter: Fabian Grutschus
>            Assignee: Tomáš Procházka
>            Priority: Minor
>
> Hello,
> I get the following error when using JsonSerializable in a PHP project:
> {quote}{className} is not abstract and does not override abstract method jsonSerialize() in \JsonSerializable
> {quote}
> The PHP code is the following:
>  
> {code:java}
> <?php
> class ClassName implements JsonSerializable {
>     public function jsonSerialize(): array {
>         return [];
>     }
> }
> {code}
>  
> As of PHP 8 {{JsonSerializable::jsonSerialize()}} has the return type mixed defined and Netbeans now defines that return type. But it is perfectly fine to change the return type of an interface method with return type mixed.
> From the RFC:
> {quote}"The mixed return type could be narrowed in a subclass as this is covariant and is allowed in LSP." ([https://wiki.php.net/rfc/mixed_type_v2])
> {quote}
> The error is very misleading and wrong. So I propose removing `mixed` again from the interface definition in Netbeans.
> Thank you!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists