eclipse-pdt / pdt

PHP Development Tools project (PDT)
https://eclipse.org/pdt
Eclipse Public License 2.0
189 stars 46 forks source link

Missing validation on excessive arguments #191

Open the-liquid-metal opened 1 year ago

the-liquid-metal commented 1 year ago

Bug Description Relying on excessive arguments on function call is considered obsolete design for modern php. Excessive arguments can be represented with variadic parameter. If a warning/info is shown, it is expected that the user changes the function signature.

Eclipse environment Version: 2023-06 (4.28.0) Build id: 20230608-1333 PDT: 8.0.0.202306050832

System

To Reproduce Steps to reproduce the behavior: copy-paste this script to the IDE

<?php
declare(strict_types=1);

namespace ns1\ns2;

class Test15 {
    public function fn1(int $par1, int $par2, int $par3) {}
}

$test15 = new Test15;
$test15->fn1(10, 20, 30, 40); // this statement should trigger warning

// -------------------------------------------------------------------------

function fn1(int $par1, int $par2, int $par3) {}

fn1(10, 20, 30, 40); // this statement should trigger warning

// -------------------------------------------------------------------------

$var1 = function(int $par1, int $par2, int $par3) {};

$var1(10, 20, 30, 40); // this statement should trigger warning

// -------------------------------------------------------------------------

$var2 = fn(int $par1, int $par2, int $par3) => 10;

$var2(10, 20, 30, 40); // this statement should trigger warning

NOTE: please change this label from bug to enhancement, i clicked the wrong button.