Skip to content

Commit

Permalink
Merge branch 'master' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgmyr committed Nov 22, 2021
2 parents fa79ad2 + b196b25 commit 8320099
Show file tree
Hide file tree
Showing 17 changed files with 260 additions and 184 deletions.
55 changes: 55 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

Please read and understand the contribution guide before creating an issue or pull request.

## Etiquette

This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.

## Requirements

If the project maintainer has any additional requirements, you will find them listed here.

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.

**Happy coding**!
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/cmgmyr/laravel-messenger/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/cmgmyr/laravel-messenger/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/cmgmyr/laravel-messenger/security/policy
about: Learn how to notify us for sensitive bugs
- name: Report a bug
url: https://github.com/cmgmyr/laravel-messenger/issues/new
about: Report a reproducable bug
3 changes: 3 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Security Policy

If you discover any security related issues, please email [email protected] instead of using the issue tracker.
26 changes: 0 additions & 26 deletions .github/stale.yml

This file was deleted.

14 changes: 3 additions & 11 deletions .github/workflows/run-tests-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: Laravel Messenger - MySQL Tests
on:
push:
branches:
- master
- develop
- feature/**
pull_request:
branches:
- master
- develop

on: [push, pull_request]

jobs:
laravel-tests:
Expand Down Expand Up @@ -36,7 +28,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.0' ]
php-versions: [ '8.1','8.0' ]
dependency-stability: [ prefer-stable ]

laravel: [ '8.*' ]
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/run-tests-postgres.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: Laravel Messenger - PostgreSQL Tests
on:
push:
branches:
- master
- develop
- feature/**
pull_request:
branches:
- master
- develop

on: [push, pull_request]

jobs:
laravel-tests:
Expand Down Expand Up @@ -37,7 +29,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.0' ]
php-versions: [ '8.1','8.0' ]
dependency-stability: [ prefer-stable ]

laravel: [ '8.*' ]
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: Laravel Messenger - Tests
on:
push:
branches:
- master
- develop
- feature/**
pull_request:
branches:
- master
- develop

on: [push, pull_request]

jobs:
laravel-tests:
Expand All @@ -18,7 +10,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.0','7.4','7.3','7.2' ]
php-versions: [ '8.1','8.0','7.4','7.3','7.2' ]
dependency-stability: [ prefer-stable ]
laravel: [ '8.*','7.*','6.*' ]

Expand All @@ -37,8 +29,12 @@ jobs:
php-versions: 7.3
- laravel: 8.*
php-versions: 7.2
- laravel: 7.*
php-versions: 8.1
- laravel: 7.*
php-versions: 8.0
- laravel: 6.*
php-versions: 8.1
- laravel: 6.*
php-versions: 8.0

Expand Down
116 changes: 85 additions & 31 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,109 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config)
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR1' => false,
'@PSR2' => true,
'@PSR12' => true,

/**
* symfony
* Array Notation.
*/
// PHP arrays should be declared using the configured syntax.
'array_syntax' => ['syntax' => 'short'],

/**
* Cast Notation.
*/
// A single space should be between cast and variable.
'cast_spaces' => true,

/**
* Class Notation.
*/
// Methods must be separated with one blank line.
'class_attributes_separation' => true,

/**
* Control Structure.
*/
// Ensure there is no code on the same line as the PHP open tag and it is followed by a blankline.
'blank_line_after_opening_tag' => true,
// Remove duplicated semicolons.
'no_empty_statement' => true,
// PHP multi-line arrays should have a trailing comma.
'trailing_comma_in_multiline' => true,
// There should be no empty lines after class opening brace.
'no_blank_lines_after_class_opening' => true,

/**
* Function Notation.
*/
// In method arguments and method call, there MUST NOT be a space before each comma and there MUST be one space after each comma. Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line.
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],

/**
* Import.
*/
// Unused use statements must be removed.
'no_unused_imports' => true,
// Ordering use statements.
'ordered_imports' => ['sort_algorithm' => 'alpha'],
// Transforms imported FQCN parameters and return types in function arguments to short version.
'fully_qualified_strict_types' => true,
// Imports or fully qualifies global classes/functions/constants.
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => null,
'import_functions' => null,
],

/**
* Operator.
*/
// Unary operators should be placed adjacent to their operands.
'unary_operator_spaces' => true,
// Binary operators should be surrounded by at least one space.
'binary_operator_spaces' => true,
// Concatenation should be used with at least one whitespace around.
'concat_space' => ['spacing' => 'one'],
// Logical NOT operators `(!)` should have one trailing whitespace.
'not_operator_with_successor_space' => true,

/**
* PHPDoc.
*/
// Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double.
'phpdoc_scalar' => true,
// Single line @var PHPDoc should have proper spacing.
'phpdoc_single_line_var_spacing' => true,
// @var and @type annotations of classy properties should not contain the name.
'phpdoc_var_without_name' => true,
// There should not be blank lines between docblock and the documented element.
'no_blank_lines_after_phpdoc' => true,
// Phpdocs short descriptions should end in either a full stop, exclamation mark, or question mark.
'phpdoc_summary' => true,
// Phpdocs should start and end with content, excluding the very first and last line of the docblocks.
'phpdoc_trim' => true,
// Removes line breaks between use statements.
'no_extra_blank_lines' => ['tokens' => ['use']],
// An empty line feed should precede a return statement.
'blank_line_before_statement' => true,
// There should be exactly one blank line before a namespace declaration.
'single_blank_line_before_namespace' => true,

/**
* Semicolon.
*/
// Remove duplicated semicolons.
'no_empty_statement' => true,

/**
* String Notation.
*/
// Convert double quotes to single quotes for simple strings.
'single_quote' => true,
// Unused use statements must be removed.
'no_unused_imports' => true,
// Methods must be separated with one blank line.
'class_attributes_separation' => true,
// Binary operators should be surrounded by at least one space.
'binary_operator_spaces' => ['operators' => ['=>' => 'single_space']],
// A single space should be between cast and variable.
'cast_spaces' => true,

/**
* contrib
* Whitespace.
*/
// Concatenation should be used with at least one whitespace around.
'concat_space' => ['spacing' => 'one'],
// Ordering use statements.
'ordered_imports' => true,
// PHP arrays should be declared using the configured syntax.
'array_syntax' => ['syntax' => 'short']
// An empty line feed should precede a return statement.
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
// Removes line breaks between use statements.
'no_extra_blank_lines' => ['tokens' => ['use']],
])
->setFinder($finder)
->setUsingCache(true);
4 changes: 2 additions & 2 deletions examples/MessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function store()
Participant::create([
'thread_id' => $thread->id,
'user_id' => Auth::id(),
'last_read' => new Carbon,
'last_read' => new Carbon(),
]);

// Recipients
Expand Down Expand Up @@ -138,7 +138,7 @@ public function update($id)
'thread_id' => $thread->id,
'user_id' => Auth::id(),
]);
$participant->last_read = new Carbon;
$participant->last_read = new Carbon();
$participant->save();

// Recipients
Expand Down
11 changes: 4 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,13 @@ class User extends Authenticatable {
* [WIP] [Lumen API](https://github.com/cmgmyr/lumen-messenger-api)


## Contributing?
Please format your code before creating a pull-request. This will format all files as specified in `.php_cs`:
## Contributing

```
vendor/bin/php-cs-fixer fix .
```
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Security
## Security Vulnerabilities

If you discover any security related issues, please email [Chris Gmyr](mailto:[email protected]) instead of using the issue tracker.
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

Expand Down
Loading

0 comments on commit 8320099

Please sign in to comment.