Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add injection of solutions in Exception constructor #119

Merged
merged 6 commits into from
Apr 2, 2020

Conversation

abbadon1334
Copy link
Collaborator

add injection of solutions in constructor.
Now to throw an exception and add a solution you have to :

$e = new Exception(['Exception with solution']);
throw $e->addSolution('One Solution');
// OR
throw (new Exception(['Exception with solution']))->addSolution('One Solution');
// OR
throw (new Exception(['Exception with solution']))
        ->addSolution('1st solution')
        ->addSolution('2nd solution')
;

With this PR it can be done this way :

throw new Exception([
        'Exception with solution',
        'solutions' => 'Solution to exception'
]);
// OR
throw new Exception([
        'Exception with solution',
        'solutions' =>[
                '1st solution to exception'
                '2nd solution to exception'
        ]
]);

Not a big change but a much atk syntax

@codecov
Copy link

codecov bot commented Feb 3, 2020

Codecov Report

Merging #119 into develop will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #119      +/-   ##
=============================================
+ Coverage      97.00%   97.01%   +0.01%     
- Complexity       442      444       +2     
=============================================
  Files             24       24              
  Lines           1035     1039       +4     
=============================================
+ Hits            1004     1008       +4     
  Misses            31       31              
Impacted Files Coverage Δ Complexity Δ
src/Exception.php 100.00% <100.00%> (ø) 20.00 <0.00> (+2.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0157d7d...30055b2. Read the comment docs.

src/Exception.php Outdated Show resolved Hide resolved
src/Exception.php Outdated Show resolved Hide resolved
@DarkSide666 DarkSide666 merged commit 882cf1c into develop Apr 2, 2020
@DarkSide666 DarkSide666 deleted the feature-add-fast-solutions branch April 2, 2020 10:10
DarkSide666 added a commit that referenced this pull request Apr 8, 2020
* Clean up badges in README file (#116)

* improve badges

* cleanup

* wip

* wip

* wip

* Configuration Elements cannot be replaced (#117)

* Apply fixes from StyleCI

* Update composer.json

* Update release-drafter.yml

* Update release-drafter.yml

* Create bundler.yml

* Add POC for "CRUD::addTo($app)" syntax (#123)

* Add POC for "CRUD::addTo($app)" syntax

* Apply fixes from StyleCI

* Add unit tests

* Apply fixes from StyleCI

* remove this weird file

* [REFACTOR] rename addHook to onHook with argument naming consistency (#124)

* rename addHook to onHook with argument naming consistency

* Apply fixes from StyleCI

* rename addHook to onHook with argument naming consistency

* update docs

* hook $this by default (#126)

* assign $this as default value for fx

* update exception info

* update docs

* Move doc builder instructions into Docker (#125)

* Releasing 2.0.1 into master (#122)

* Clean up badges in README file (#116)

* improve badges

* cleanup

* wip

* wip

* wip

* Configuration Elements cannot be replaced (#117)

* Apply fixes from StyleCI

* Update composer.json

* Update release-drafter.yml

* Update release-drafter.yml

* Create bundler.yml

* Setting release dependencies

Co-authored-by: Romans Malinovskis <[email protected]>
Co-authored-by: Georg Marx <[email protected]>
Co-authored-by: Imants Horsts <[email protected]>
Co-authored-by: GitHub Web Flow <[email protected]>

* Add POC for "CRUD::addTo($app)" syntax

* Apply fixes from StyleCI

* Add unit tests

* Apply fixes from StyleCI

* remove this weird file

* Add dockerfile for easier doc preview

* Update instructions

* add doc integration instructions for PhpStorm

* Add mention of addTo() into the docs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Georg Marx <[email protected]>
Co-authored-by: Imants Horsts <[email protected]>
Co-authored-by: GitHub Web Flow <[email protected]>

* Rename hook spot argument (#127)

* improve hook arguments versatility

* rename $hookSpot to $spot

* update tests

* update comment

* Apply fixes from StyleCI

* improve hook default argument versatility

* Apply fixes from StyleCI

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* avoid code duplication (#128)

* avoid code duplication

* outline logic by using brackets

* setLayout -> initLayout (#130)

* setLayout -> initLayout

* Apply fixes from StyleCI

* style

* Rename HEAD to develop for Composer in unit tests (#135)

* Fix EOL to NL (#132)

* Do not fail-fast PHP test matrix (#136)

* Improve StaticAddToTrait trait (#139)

* Fix initial StaticAddTo trait

* Prevent bad addTo usage

* Improve addTo method

* Fix add_arguments in tests

* Add similar method to addTo for seeds with class name

* Improve readability and prevent even more bad usage

* Fix typo

* Improve StaticAddTo tests and add unsafe method for BC UI impl. (#140)

* Improve StaticAddTo tests

* Add unsafe method of addToWithClassName to skip instanceof check

* Do not wrap exception message in array (#141)

* Add skip_add param to StaticAddToTrait trait methods (#143)

* Require class name in seed for addToWithClassName methods (#144)

* Update release-drafter.yml

* Update release-drafter.yml

* Update StaticAddToTrait.php

* Improve hooks and allow to delete/check specific priority (#133)

* Improve hooks and allow to delete/check specific priority

* Fix tests

* Introduce indexes hooks

* Fix hook doc

* fix compatibility

* Fix bad phpdoc

* Add injection of solutions in Exception constructor (#119)

* Rapid add solutions in constructor

* Apply fixes from StyleCI

* fixes

* Apply fixes from StyleCI

* style fix

Co-authored-by: DarkSide <[email protected]>
Co-authored-by: Imants Horsts <[email protected]>

* Fix CS - do not import classes without namespace (#147)

* Fix CS - do not import classes without namespace

* Apply fixes from StyleCI

Co-authored-by: Romans Malinovskis <[email protected]>

* Align exception header properly (#148)

* Setting release dependencies

Co-authored-by: Romans Malinovskis <[email protected]>
Co-authored-by: Georg Marx <[email protected]>
Co-authored-by: Imants Horsts <[email protected]>
Co-authored-by: Imants Horsts <[email protected]>
Co-authored-by: Georgi Hristov <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Web Flow <[email protected]>
Co-authored-by: Michael Voříšek <[email protected]>
Co-authored-by: Francesco Danti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants