Skip to content

Commit

Permalink
Merge pull request #401 from koriym/null_page
Browse files Browse the repository at this point in the history
Set null renderer with setter injection
  • Loading branch information
koriym authored May 12, 2022
2 parents f56a3d4 + 0062249 commit 7944cac
Show file tree
Hide file tree
Showing 5 changed files with 474 additions and 173 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '42 15 * * *'

jobs:
phpunit:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ jobs:
- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist
composer require --dev maglnet/composer-require-checker ^3.0
- name: Run composer-require-checker
run: ./vendor/bin/composer-require-checker check --config-file=./php-require-checker.config.json ./composer.json
13 changes: 12 additions & 1 deletion src/Provide/Error/NullPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,28 @@

use BEAR\RepositoryModule\Annotation\Cacheable;
use BEAR\Resource\NullRenderer;
use BEAR\Resource\RenderInterface;
use BEAR\Resource\ResourceObject;
use Ray\Di\Di\Inject;

/**
* @Cacheable
*/
#[Cacheable]
class NullPage extends ResourceObject
{
public function __construct()
/**
* @return self
*
* @Inject(optional=true)
*/
#[Inject(optional: true)]
public function setRenderer(RenderInterface $renderer)
{
unset($renderer);
$this->renderer = new NullRenderer();

return $this;
}

public function onGet(string $required, int $optional = 0): ResourceObject
Expand Down
3 changes: 2 additions & 1 deletion vendor-bin/tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"phpstan/phpstan": "^1.3",
"psalm/plugin-phpunit": "^0.13",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.2"
"vimeo/psalm": "^4.2",
"maglnet/composer-require-checker": "^3.0"
},
"config": {
"allow-plugins": {
Expand Down
Loading

0 comments on commit 7944cac

Please sign in to comment.