Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Designate $options arg as being optional #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewryantech
Copy link

@andrewryantech andrewryantech commented May 1, 2019

Bonjour :)

Currently code like:

if (extension_loaded('tideways')) {
    tideways_enable(TIDEWAYS_FLAGS_CPU + TIDEWAYS_FLAGS_MEMORY);   // IDE warns about lack of second arg, $options
}

causes the IDE to warn that the required second arg is missing, however reflection indicates that tideways_enable() (version 4.1.2) has no required args:

$function = new ReflectionFunction('tideways_enable');
var_dump($function->getParameters()); // [flags, options]
var_dump($function->getNumberOfRequiredParameters()); // 0

I'm not sure if the default value is empty array or null, as it appears reflection can't provide that info: https://bugs.php.net/bug.php?id=50798, but practically I don't think it will matter.

It would also be great if you could release a stable version on packagist, at the moment this library is tagged as dev-master. My understanding is to release a stable version you need to add a a git tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants