-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from danuiachimovschi/dev
CI , tests and phpstan
- Loading branch information
Showing
16 changed files
with
254 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
name: CI Branch Dev | ||
|
||
jobs: | ||
phpunit: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: umutphp/php-docker-images-for-ci:latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Install Composer | ||
run: | | ||
apt-get update | ||
apt-get install -y unzip | ||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | ||
php composer-setup.php --install-dir=/usr/local/bin --filename=composer | ||
php -r "unlink('composer-setup.php');" | ||
- name: Install composer dependencies | ||
run: | | ||
ls -la | ||
composer install --no-scripts | ||
- name: Run Testsuite | ||
run: | | ||
./vendor/bin/phpunit tests --color | ||
- name: Run PHPstan (Static Analysis Tool) | ||
run: | | ||
vendor/bin/phpstan analyse |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
} | ||
], | ||
"require-dev": { | ||
"phpunit/phpunit": "^10.5" | ||
"phpunit/phpunit": "^10.5", | ||
"phpstan/phpstan": "^1.10" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
parameters: | ||
level: 1 | ||
paths: | ||
- src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Danu\PhpDi\Contracts; | ||
|
||
interface ContainerContract | ||
{ | ||
/** | ||
* Finds an entry of the container by its identifier and returns it. | ||
* | ||
* @param string $id Identifier of the entry to look for. | ||
* | ||
* @throws NotFoundExceptionInterface No entry was found for **this** identifier. | ||
* @throws ContainerExceptionInterface Error while retrieving the entry. | ||
* | ||
* @return mixed Entry. | ||
*/ | ||
public function get(string $id): mixed; | ||
|
||
/** | ||
* Returns true if the container can return an entry for the given identifier. | ||
* Returns false otherwise. | ||
* | ||
* `has($id)` returning true does not mean that `get($id)` will not throw an exception. | ||
* It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. | ||
* | ||
* @param string $id Identifier of the entry to look for. | ||
* | ||
* @return bool | ||
*/ | ||
public function has(string $id): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Danu\PhpDi\Exception; | ||
|
||
class ContainerException extends InternalException | ||
{ | ||
/** | ||
* @param string $id | ||
* @return static | ||
*/ | ||
public static function NotFoundContainer(string $id): static | ||
{ | ||
return self::make("No entry was found for **this** identifier: {$id}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Danu\PhpDi\Exception; | ||
|
||
class InternalException extends \Exception | ||
{ | ||
/** | ||
* @param string $message | ||
* @return static | ||
*/ | ||
public static function make(string $message): static | ||
{ | ||
return new self($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":1,"defects":[],"times":{"Tests\\ContainerTest::test":0.001}} | ||
{"version":1,"defects":{"Tests\\ContainerTest::test":5},"times":{"Tests\\ContainerTest::test":0.001}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters