Skip to content

Commit

Permalink
Merge pull request #48 from vanilla/remove-psr-log-composer-lock
Browse files Browse the repository at this point in the history
VNLA-3436: Upgrade to PHP 8.1
  • Loading branch information
charrondev authored Jan 27, 2023
2 parents 5ab4461 + 29feb48 commit d246ebb
Show file tree
Hide file tree
Showing 10 changed files with 435 additions and 279 deletions.
64 changes: 0 additions & 64 deletions .circleci/config.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches:
- master
pull_request:

concurrency:
# Concurrency is only limited on pull requests. head_ref is only defined on PR triggers so otherwise it will use the random run id and always build all pushes.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
phpunit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ["7.4", "8.0", "8.1", "8.2"]
steps:
- uses: actions/checkout@v3
- name: Installing PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Composer Install
run: composer install -o
- name: PHPUnit
run: ./vendor/bin/phpunit -c ./phpunit.xml.dist
- name: Static Analysis
run: ./vendor/bin/psalm
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"require": {
"php": ">=7.4",
"psr/container": "^1.0"
"psr/container": "*"
},
"require-dev": {
"phpunit/phpunit": "~8.0",
Expand Down
17 changes: 12 additions & 5 deletions src/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

namespace Garden\Container;

use Prophecy\Call\Call;

/**
* A reference that uses a callback to resolve.
*/
class Callback implements ReferenceInterface {
class Callback implements ReferenceInterface
{
/**
* @var callable $callback
*/
Expand All @@ -21,14 +24,16 @@ class Callback implements ReferenceInterface {
*
* @param callable $callback The callback of the reference.
*/
public function __construct(callable $callback) {
public function __construct(callable $callback)
{
$this->callback = $callback;
}

/**
* {@inheritdoc}
*/
public function resolve(Container $container, $instance = null) {
public function resolve(Container $container, mixed $instance = null)
{
return call_user_func($this->callback, $container, $instance);
}

Expand All @@ -37,7 +42,8 @@ public function resolve(Container $container, $instance = null) {
*
* @return callable Returns the callback.
*/
public function getCallback() {
public function getCallback(): callable
{
return $this->callback;
}

Expand All @@ -47,7 +53,8 @@ public function getCallback() {
* @param callable $callback The new callback to set.
* @return Callback Returns `$this` for fluent calls.
*/
public function setCallback($callback) {
public function setCallback(callable $callback): Callback
{
$this->callback = $callback;
return $this;
}
Expand Down
Loading

0 comments on commit d246ebb

Please sign in to comment.