Closed cxj closed 8 years ago
Hmm, maybe I actually moved backward on the chain of commits. Sometimes Github's view is not the clearest. Reverting. I don't even remember why I updated it to begin with.
Baffling. My require
statement in composer.json
says "~1.0" but it keeps grabbing the 1.0.0-alpha7
release. Composer can be really frustrating sometimes.
Hey @cxj is this still a problem?
I'm attempting to reverify it now. IIRC it seemed to be more a matter of Composer pulling code with the bug rather than the newer code actually being wrong.
Maybe I'm just ignorant when it comes to Composer, but the following seems to be what causes the problem of pulling outdated code (it also is pulling pipeline/pipeline, for example):
Your recommended install procedure, which seems to work correctly:
composer create-project -s dev radar/project example-project
My install procedure, which I use because radar/adr is part of my project, not a standalone thing:
composer install
However, the composer.json files are functionally identical where it counts. I've just added a couple of dependencies for local libraries and a psr-4 clause for my local code. In theory -- at least to my way of understanding -- Composer should install exactly the same versions of the packages it does grab from Github. But it doesn't.
Is it my misunderstanding, or is there some config/release anomaly somewhere in your packaging, or a bug in Composer?
Is this a valid test? Namely, I altered your example code which works to explicitly call input() and and responder() as I do in my project, but using your generic classes.
$adr->get('Hello', '/{name}?', function (array $input) {
$payload = new Aura\Payload\Payload();
return $payload
->setStatus(Aura\Payload_Interface\PayloadStatus::SUCCESS)
->setOutput([
'phrase' => 'Hello ' . $input['name']
]);
})
->input('\Radar\Adr\Input')
->responder('\Radar\Adr\Responder\Responder')
->defaults(['name' => 'world']);
Well, I'm baffled as to the why, but I found a way to fix it. I removed an extraneous require from my root composer.json, and now it grabs the correct version of radar/adr. With the correct version, the fluent interface works as expected.
Somewhere between whatever version Composer was picking up using
"require": { "radar/adr": "~1.0" }
and the1.0.0-alpha7
version, this stopped working:$adr
goes null after the call toinput()
. I've had to change my code to read like this when using alpha7: