Skip to content

Commit 75d988d

Browse files
authored
Prepare first release (#3)
* Bump version alias in composer.json * Remove unnecessary folder * Add PHP v7.3 to travis CI * Update CHANGELOG * Update phpunit to v7.5 * Update README * Remove useless comments * Add clarification to getIterator phpdoc
1 parent e5615d3 commit 75d988d

File tree

11 files changed

+38
-109
lines changed

11 files changed

+38
-109
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ language: php
77
php:
88
- 7.1
99
- 7.2
10+
- 7.3
1011

1112
## Cache composer
1213
cache:
@@ -23,11 +24,12 @@ matrix:
2324
fast_finish: true
2425
include:
2526
- php: 7.1
27+
- php: 7.2
2628
env:
2729
- EXECUTE_COVERAGE=true
28-
- php: 7.2
30+
- php: 7.3
2931
allow_failures:
30-
- php: 7.2
32+
- php: 7.3
3133

3234
notifications:
3335
email: false
@@ -46,4 +48,4 @@ script:
4648
- if [[ $EXECUTE_COVERAGE != 'true' ]]; then ./vendor/bin/phpunit ; fi
4749

4850
after_script:
49-
- if [[ $EXECUTE_COVERAGE == 'true' ]]; then ./vendor/bin/ocular code-coverage:upload --format=php-clover $CLOVER_PATH ; fi
51+
- if [[ $EXECUTE_COVERAGE == 'true' ]]; then ./vendor/bin/ocular code-coverage:upload --format=clover $CLOVER_PATH ; fi

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Security - in case of vulnerabilities.
1818

1919
_TBD_
2020

21-
## [0.1.0] 2018-05-26
21+
## [1.0.0] 2019-01-10
2222

2323
Initial release.

README.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Errors Notification
22
An easy to use, implementation of the [Notification Pattern][notification-pattern]
33

4-
[![Software License][ico-license]][link-license]
5-
[![Latest Version on Packagist][ico-version]][link-packagist]
64
[![Build Status][ico-travis]][link-travis]
7-
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
5+
[![Code Coverage][ico-scrutinizer]][link-scrutinizer]
86
[![Quality Score][ico-code-quality]][link-code-quality]
7+
[![GitHub issues][ico-issues]][link-issues]
98

10-
*TBD*
11-
12-
## TL;DR
9+
[![Software License][ico-license]][link-license]
10+
[![Latest Version on Packagist][ico-version]][link-packagist]
11+
[![PHP Version][ico-php-version]][link-github]
1312

1413
## Install
1514

@@ -19,39 +18,34 @@ Using [Composer](https://getcomposer.org)
1918
composer require zeeproject/errors-notification
2019
~~~
2120

21+
## TL;DR
22+
23+
*TBD*
24+
2225
## Testing
2326

2427
~~~bash
25-
# install required files
26-
composer self-update
27-
composer install
28-
29-
# run the test (from project root)
3028
phpunit
3129
~~~
3230

3331
## Contributing
3432

35-
Contributions are welcome and will be fully credited. Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE OF CONDUCT](CODE_OF_CONDUCT.md) for details.
36-
37-
## Credits
38-
39-
[To All Awesome Contributors](../../contributors)
40-
41-
## License
42-
43-
The BSD 2-Clause License. Please see [LICENSE][link-license] for more information.
33+
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE OF CONDUCT](CODE_OF_CONDUCT.md) for more details.
4434

4535
[notification-pattern]: https://martinfowler.com/eaaDev/Notification.html
4636

47-
[ico-license]: https://img.shields.io/badge/License-BSD%202--Clause-blue.svg?style=flat-square
48-
[ico-version]: https://img.shields.io/packagist/v/zeeproject/errors-notification.svg?style=flat-square
49-
[ico-travis]: https://img.shields.io/travis/zee/errors-notification/master.svg?style=flat-square
50-
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/zee/errors-notification.svg?style=flat-square
51-
[ico-code-quality]: https://img.shields.io/scrutinizer/g/zee/errors-notification.svg?style=flat-square
37+
[ico-version]: https://img.shields.io/packagist/v/zeeproject/errors-notification.svg?style=for-the-badge&label=Latest
38+
[ico-php-version]: https://img.shields.io/packagist/php-v/zeeproject/errors-notification.svg?style=for-the-badge
39+
[ico-license]: https://img.shields.io/badge/License-BSD%202--Clause-blue.svg?style=for-the-badge
40+
[ico-issues]: https://img.shields.io/github/issues/zee/errors-notification.svg?style=for-the-badge&logo=github
41+
[ico-travis]: https://img.shields.io/travis/zee/errors-notification.svg?style=for-the-badge&logo=travis
42+
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/zee/errors-notification.svg?style=for-the-badge&logo=scrutinizer
43+
[ico-code-quality]: https://img.shields.io/scrutinizer/g/zee/errors-notification.svg?style=for-the-badge&logo=scrutinizer
5244

53-
[link-license]: LICENSE
5445
[link-packagist]: https://packagist.org/packages/zeeproject/errors-notification
46+
[link-github]: https://github.com/zee/errors-notification
47+
[link-issues]: https://github.com/zee/errors-notification/issues
48+
[link-license]: LICENSE
5549
[link-travis]: https://travis-ci.org/zee/errors-notification
5650
[link-scrutinizer]: https://scrutinizer-ci.com/g/zee/errors-notification/code-structure
5751
[link-code-quality]: https://scrutinizer-ci.com/g/zee/errors-notification

build/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"php": "^7.1"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "^7.1",
16+
"phpunit/phpunit": "^7.5",
1717
"scrutinizer/ocular": "^1.5"
1818
},
1919
"autoload": {
@@ -37,7 +37,7 @@
3737
},
3838
"extra": {
3939
"branch-alias": {
40-
"dev-master": "1.0.x-dev"
40+
"dev-master": "1.1.x-dev"
4141
}
4242
}
4343
}

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.1/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
colors="true"
66
failOnRisky="true"

src/Error.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,34 @@
11
<?php
22
/**
3-
* This file is part of Zee Project.
4-
*
5-
* @see https://github.com/zee/
3+
* {@see https://github.com/zee/ Zee Project (c)}
64
*/
75

86
declare(strict_types=1);
97

108
namespace Zee\Errors;
119

12-
/**
13-
* Class Error.
14-
*/
1510
final class Error
1611
{
17-
/**
18-
* @var string
19-
*/
2012
private $message;
2113

22-
/**
23-
* @var array
24-
*/
2514
private $context;
2615

27-
/**
28-
* @param string $message
29-
* @param array $context
30-
*/
31-
public function __construct(string $message, array $context)
16+
public function __construct(string $message, array $context = [])
3217
{
3318
$this->message = $message;
3419
$this->context = $context;
3520
}
3621

37-
/**
38-
* @inheritdoc
39-
*/
4022
public function __toString(): string
4123
{
4224
return $this->getMessage();
4325
}
4426

45-
/**
46-
* @return string
47-
*/
4827
public function getMessage(): string
4928
{
5029
return $this->message;
5130
}
5231

53-
/**
54-
* @return array
55-
*/
5632
public function getContext(): array
5733
{
5834
return $this->context;

src/Notification.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
/**
3-
* This file is part of Zee Project.
4-
*
5-
* @see https://github.com/zee/
3+
* {@see https://github.com/zee/ Zee Project (c)}
64
*/
75

86
declare(strict_types=1);
@@ -14,18 +12,12 @@
1412
use IteratorAggregate;
1513
use Traversable;
1614

17-
/**
18-
* Class Notification.
19-
*/
2015
final class Notification implements Countable, IteratorAggregate
2116
{
2217
private $errors = [];
2318

2419
/**
2520
* Adds new error to the notification.
26-
*
27-
* @param string $message
28-
* @param array $context
2921
*/
3022
public function addError(string $message, array $context = []): void
3123
{
@@ -34,8 +26,6 @@ public function addError(string $message, array $context = []): void
3426

3527
/**
3628
* Returns whether the notification has any errors.
37-
*
38-
* @return bool
3929
*/
4030
public function hasErrors(): bool
4131
{
@@ -54,7 +44,7 @@ public function flushErrors(): array
5444
}
5545

5646
/**
57-
* @return array
47+
* Returns list of error messages only.
5848
*/
5949
public function getErrorMessages(): array
6050
{
@@ -67,9 +57,7 @@ function (Error $error) {
6757
}
6858

6959
/**
70-
* Counts the errors.
71-
*
72-
* @inheritdoc
60+
* Counts the errors in the notification.
7361
*/
7462
public function count(): int
7563
{
@@ -79,8 +67,6 @@ public function count(): int
7967
/**
8068
* Builds the iterator by errors.
8169
*
82-
* @inheritdoc
83-
*
8470
* @return Traversable|Error[]
8571
*/
8672
public function getIterator(): Traversable

tests/ErrorTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
/**
3-
* This file is part of Zee Project.
4-
*
5-
* @see https://github.com/zee/
3+
* {@see https://github.com/zee/ Zee Project (c)}
64
*/
75

86
declare(strict_types=1);
@@ -11,15 +9,10 @@
119

1210
use Zee\Errors\Error;
1311

14-
/**
15-
* Class ErrorTest.
16-
*/
1712
final class ErrorTest extends TestCase
1813
{
1914
/**
2015
* @test
21-
*
22-
* @return Error
2316
*/
2417
public function errorContainsMessageAndItsContextData(): Error
2518
{
@@ -34,10 +27,8 @@ public function errorContainsMessageAndItsContextData(): Error
3427
/**
3528
* @test
3629
* @depends errorContainsMessageAndItsContextData
37-
*
38-
* @param Error $error
3930
*/
40-
public function canBeCastedToString(Error $error)
31+
public function canBeCastedToString(Error $error): void
4132
{
4233
self::assertSame('Something went wrong', (string) $error);
4334
}

tests/NotificationTest.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
/**
3-
* This file is part of Zee Project.
4-
*
5-
* @see https://github.com/zee/
3+
* {@see https://github.com/zee/ Zee Project (c)}
64
*/
75

86
declare(strict_types=1);
@@ -12,15 +10,10 @@
1210
use Zee\Errors\Error;
1311
use Zee\Errors\Notification;
1412

15-
/**
16-
* Class NotificationTest.
17-
*/
1813
final class NotificationTest extends TestCase
1914
{
2015
/**
2116
* @test
22-
*
23-
* @return Notification
2417
*/
2518
public function canAddMultipleErrorsAndCountThem(): Notification
2619
{
@@ -37,8 +30,6 @@ public function canAddMultipleErrorsAndCountThem(): Notification
3730
/**
3831
* @test
3932
* @depends canAddMultipleErrorsAndCountThem
40-
*
41-
* @param Notification $notification
4233
*/
4334
public function canIterateErrors(Notification $notification): void
4435
{
@@ -50,8 +41,6 @@ public function canIterateErrors(Notification $notification): void
5041
/**
5142
* @test
5243
* @depends canAddMultipleErrorsAndCountThem
53-
*
54-
* @param Notification $notification
5544
*/
5645
public function canGenerateListOfErrorMessages(Notification $notification): void
5746
{
@@ -61,8 +50,6 @@ public function canGenerateListOfErrorMessages(Notification $notification): void
6150
/**
6251
* @test
6352
* @depends canAddMultipleErrorsAndCountThem
64-
*
65-
* @param Notification $notification
6653
*/
6754
public function canClearNotificationErrors(Notification $notification): void
6855
{

0 commit comments

Comments
 (0)