|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79515 Incorrect ReflectionParameter information for bitset methods
Submitted: 2020-04-23 14:58 UTC Modified: -
From: Assigned:
Status: Open Package: Bitset (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-04-23 14:58 UTC]
class BitSet is missing reflection parameter information for various methods.
For example, I'd assume that andOp() would take one argument (another BitSet to add to it).

Note that adding param and return type information might be considered a backwards incompatible change if people write classes that override BitSet. I haven't checked if anyone does that.

A compact rendering of the information available from reflection is below (generated by

class BitSet {

    // methods
    public function __construct($value) {}
    public function andOp() {}
    public function andNotOp() {}
    public function cardinality() {}
    public function clear() {}
    public static function fromArray($arr) {}
    public static function fromString($str) {}
    public static function fromRawValue($str) {}
    public function get($index) {}
    public function getRawValue() {}
    public function intersects() {}
    public function isEmpty() {}
    public function length() {}
    public function nextClearBit() {}
    public function nextSetBit() {}
    public function orOp() {}
    public function previousClearBit() {}
    public function previousSetBit() {}
    public function set() {}
    public function size() {}
    public function toArray() {}
    public function xorOp() {}
    public function __toString() {}

Test script:
php > var_export((new ReflectionMethod('BitSet', 'andOp'))->getParameters());
array (
php > $x = new BitSet(128);
php > $x->andOp();
Warning: BitSet::andOp() expects exactly 1 parameter, 0 given in php shell code on line 1
php > $x->andOp('invalid');
Warning: BitSet::andOp() expects parameter 1 to be BitSet, string given in php shell code on line 1

Expected result:
ReflectionParameter information should be available for all functions. For example, getParameters() should probably return an array with one Parameter of ReflectionNamedType BitSet.

Actual result:
Many methods have no reflection information available for parameters


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 21 03:03:36 2021 UTC