Skip to content

Commit

Permalink
Merge branch 'release/v0.10.23'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Nov 10, 2023
2 parents b56c50b + c57a4e4 commit 76c1f8c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.1"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

Expand Down Expand Up @@ -60,9 +60,9 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.1"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## v0.10.21 (2023-11-09)
## v0.10.23 (2023-11-10)
* Switched to Slingshot for function invocation
* Moved to PHP8.1 minimum

## v0.10.22 (2023-11-09)
* Fixed handling of private and protected class constants

## v0.10.21 (2023-11-08)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"email": "[email protected]"
} ],
"require": {
"php": "^8.0",
"php": "^8.1",

"decodelabs/exceptional": "^0.4",
"decodelabs/glitch-support": "^0.4",
Expand Down
39 changes: 6 additions & 33 deletions src/Veneer/Binding.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use DecodeLabs\Exceptional;
use DecodeLabs\Pandora\Container as PandoraContainer;
use DecodeLabs\Slingshot;
use DecodeLabs\Veneer;
use DecodeLabs\Veneer\Plugin\Wrapper as PluginWrapper;

Expand Down Expand Up @@ -98,42 +99,14 @@ public function resolveDeferral(
$ref = new ReflectionObject($instance);
$method = $ref->getMethod('__construct');
$method->setAccessible(true);
$args = [];

foreach ($method->getParameters() as $param) {
$type = $param->getType();
$value = null;

if (
$type instanceof ReflectionNamedType &&
$container
) {
if ($container instanceof PandoraContainer) {
$value = $container->tryGet($type->getName());
} elseif ($container->has($type->getName())) {
$value = $container->get($type->getName());
}
}

if (
$value === null &&
$type !== null &&
$type->allowsNull()
) {
$args[] = null;
continue;
}

if ($type === null) {
throw Exceptional::Definition(
'Unable to resolve constructor parameter ' . $param->getName() . ' for ' . $this->providerClass
);
}

$args[] = $value;
if (!$closure = $method->getClosure($instance)) {
throw Exceptional::Logic(
'Unable to get closure for constructor of ' . $this->providerClass
);
}

$method->invoke($instance, ...$args);
(new Slingshot($container))->invoke($closure);

// Load plugins
$this->loadPlugins();
Expand Down

0 comments on commit 76c1f8c

Please sign in to comment.