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

isa('Number') is not worknig. #44

Closed
romaninsh opened this issue Jul 12, 2016 · 4 comments
Closed

isa('Number') is not worknig. #44

romaninsh opened this issue Jul 12, 2016 · 4 comments

Comments

@romaninsh
Copy link

Documentation is inconsistent about 'number' vs 'Number': https://github.com/c9s/GetOptionKit/search?utf8=✓&q=isa

$specs->add('s|system', 'Select system by ID' )->isa('Number');

Orange-Dream:tools rw$ php importer.php -s 123
-s, --system=
Select system by ID

PHP Fatal error: Uncaught GetOptionKit\InvalidOptionValue: Invalid value for -s, --system. Requires a type Number. in /Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php:264
Stack trace:
#0 /Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php(297): GetOptionKit\Option->_preprocessValue(true)
#1 /Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/OptionParser.php(48): GetOptionKit\Option->setValue(true)
#2 /Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/OptionParser.php(172): GetOptionKit\OptionParser->consumeOptionToken(Object(GetOptionKit\Option), Object(GetOptionKit\Argument), Object(GetOptionKit\Argument))
#3 /Users/rw/Sites/smbo/old/tools/importer.php(32): GetOptionKit\OptionParser->parse(Array)
#4 {main}

thrown in /Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on line 264

Fatal error: Uncaught GetOptionKit\InvalidOptionValue: Invalid value for -s, --system. Requires a type Number. in /Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on line 264

GetOptionKit\InvalidOptionValue: Invalid value for -s, --system. Requires a type Number. in /Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on line 264

@c9s
Copy link
Owner

c9s commented Jul 12, 2016

the option you defined is a flag

not an option with value, to define one option with value, please use the
follwoing spec

s|system:

Romans Malinovskis notifications@github.com 於 2016年7月12日 星期二寫道:

Documentation is inconsistent about 'number' vs 'Number':
https://github.com/c9s/GetOptionKit/search?utf8=✓&q=isa

$specs->add('s|system', 'Select system by ID' )->isa('Number');

Orange-Dream:tools rw$ php importer.php -s 123
-s, --system=
Select system by ID

PHP Fatal error: Uncaught GetOptionKit\InvalidOptionValue: Invalid value
for -s, --system. Requires a type Number. in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php:264
Stack trace:
#0
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php(297):
GetOptionKit\Option->_preprocessValue(true)
#1 #1
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/OptionParser.php(48):
GetOptionKit\Option->setValue(true)
#2 #2
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/OptionParser.php(172):
GetOptionKit\OptionParser->consumeOptionToken(Object(GetOptionKit\Option),
Object(GetOptionKit\Argument), Object(GetOptionKit\Argument))
#3 #3
/Users/rw/Sites/smbo/old/tools/importer.php(32):
GetOptionKit\OptionParser->parse(Array)
#4 #4 {main}
thrown in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on
line 264

Fatal error: Uncaught GetOptionKit\InvalidOptionValue: Invalid value for
-s, --system. Requires a type Number. in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on
line 264

GetOptionKit\InvalidOptionValue: Invalid value for -s, --system. Requires
a type Number. in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on
line 264


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#44, or mute the thread
https://github.com/notifications/unsubscribe/AADGzmfGWtP0GYDLvgMcf6BaldzQfGIcks5qU3VfgaJpZM4JKSBM
.

@c9s
Copy link
Owner

c9s commented Jul 12, 2016

it doesnt matter on Number or number, the factory method will capitalize
the word

Romans Malinovskis notifications@github.com 於 2016年7月12日 星期二寫道:

Documentation is inconsistent about 'number' vs 'Number':
https://github.com/c9s/GetOptionKit/search?utf8=✓&q=isa

$specs->add('s|system', 'Select system by ID' )->isa('Number');

Orange-Dream:tools rw$ php importer.php -s 123
-s, --system=
Select system by ID

PHP Fatal error: Uncaught GetOptionKit\InvalidOptionValue: Invalid value
for -s, --system. Requires a type Number. in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php:264
Stack trace:
#0
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php(297):
GetOptionKit\Option->_preprocessValue(true)
#1 #1
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/OptionParser.php(48):
GetOptionKit\Option->setValue(true)
#2 #2
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/OptionParser.php(172):
GetOptionKit\OptionParser->consumeOptionToken(Object(GetOptionKit\Option),
Object(GetOptionKit\Argument), Object(GetOptionKit\Argument))
#3 #3
/Users/rw/Sites/smbo/old/tools/importer.php(32):
GetOptionKit\OptionParser->parse(Array)
#4 #4 {main}
thrown in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on
line 264

Fatal error: Uncaught GetOptionKit\InvalidOptionValue: Invalid value for
-s, --system. Requires a type Number. in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on
line 264

GetOptionKit\InvalidOptionValue: Invalid value for -s, --system. Requires
a type Number. in
/Users/rw/Sites/smbo/old/vendor/corneltek/getoptionkit/src/Option.php on
line 264


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#44, or mute the thread
https://github.com/notifications/unsubscribe/AADGzmfGWtP0GYDLvgMcf6BaldzQfGIcks5qU3VfgaJpZM4JKSBM
.

@c9s c9s closed this as completed Jul 12, 2016
@c9s
Copy link
Owner

c9s commented Jul 12, 2016

the reason: flag option requires value to be boolean, however boolean is not a number.

@romaninsh
Copy link
Author

still unclear, but i leave it to you.

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

No branches or pull requests

2 participants