Skip to content

Commit

Permalink
Merge branch "1.12.x" into "master"
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloKowalczyk committed Apr 12, 2019
2 parents 8cf48d0 + 27d36a6 commit cb4a6a0
Show file tree
Hide file tree
Showing 58 changed files with 2,134 additions and 734 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ changelog-linker.yml export-ignore
docker-compose.yml export-ignore
/docker export-ignore
box.json export-ignore
phpstan.neon export-ignore
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ php:
- 7.1
- 7.2
- 7.3
- nightly
- 7.4snapshot

matrix:
fast_finish: true
allow_failures:
- php: nightly
- php: 7.4snapshot

env:
matrix:
Expand All @@ -37,16 +37,24 @@ install:
- if [[ "$DEPENDENCIES" = 'low' ]]; then
travis_retry composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest;
fi
- if [[ "$DEPENDENCIES" = 'high' ]] && [[ "$TRAVIS_PHP_VERSION" = '7.2' ]]; then
- if [[ "$DEPENDENCIES" = 'high' ]] && [[ "$TRAVIS_PHP_VERSION" = '7.3' ]]; then
travis_retry composer bin cs-fixer install -a --no-dev;
travis_retry composer bin phpstan install -a;
fi
- if [[ "$DEPENDENCIES" = 'low' ]] && [[ "$TRAVIS_PHP_VERSION" = '7.3' ]]; then
travis_retry composer bin cs-fixer install -a;
travis_retry composer bin phpstan install -a;
fi
- travis_retry composer bin phpunit install -a;

before_script:
- composer install --prefer-source --no-interaction

script:
- if [[ "$DEPENDENCIES" = 'high' ]] && [[ "$TRAVIS_PHP_VERSION" = '7.2' ]]; then
- if [[ "$DEPENDENCIES" = 'high' ]] && [[ "$TRAVIS_PHP_VERSION" = '7.3' ]]; then
composer crunz:analyze;
fi
- if [[ "$DEPENDENCIES" = 'low' ]] && [[ "$TRAVIS_PHP_VERSION" = '7.3' ]]; then
composer phpstan:check;
fi
- vendor/bin/phpunit
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Removed `Crunz\Output\VerbosityAwareOutput` class - PR
[#103](https://github.com/lavary/crunz/pull/103), [@PabloKowalczyk](https://github.com/PabloKowalczyk)

## [v1.12.0] - 2019-04-07

### Added

- [#178], [#217] `timezone_log` configuration option to decide whether
configured `timezone` should be used for logs, thanks to [@SadeghPM]

### Deprecated

- Using `\Crunz\Event::setProcess` is deprecated, this method was intended to be `private`,
but for some reason is `public`.
In `v2.0` this method will became private and result in exception if you call it.
- [#199] Not returning `\Crunz\Schedule` instance from your task is deprecated.
In `v2` this will result in exception.

## [v1.11.2] - 2019-03-16

### Fixed

- [#209], [#210] Composer installs crunz executable to vendor/bin instead of symlink

## [v1.11.1] - 2019-01-27

### Fixed
Expand Down Expand Up @@ -159,9 +180,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [#77] Fix high cpu usage


[#217]: https://github.com/lavary/crunz/pull/217
[#210]: https://github.com/lavary/crunz/pull/210
[#209]: https://github.com/lavary/crunz/pull/209
[#199]: https://github.com/lavary/crunz/pull/199
[#190]: https://github.com/lavary/crunz/pull/190
[#181]: https://github.com/lavary/crunz/pull/181
[#180]: https://github.com/lavary/crunz/pull/180
[#178]: https://github.com/lavary/crunz/pull/178
[#173]: https://github.com/lavary/crunz/pull/173
[#171]: https://github.com/lavary/crunz/pull/171
[#166]: https://github.com/lavary/crunz/pull/166
Expand Down Expand Up @@ -253,13 +279,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[v1.6.1]: https://github.com/lavary/crunz/compare/v1.6.0...v1.6.1
[v1.6.0]: https://github.com/lavary/crunz/compare/v1.5.1...v1.6.0
[v1.5.1]: https://github.com/lavary/crunz/compare/v1.5.0...v1.5.1
[v1.11.2]: https://github.com/lavary/crunz/compare/v1.11.1...v1.11.2
[v1.11.1]: https://github.com/lavary/crunz/compare/v1.11.0...v1.11.1
[v1.11.0]: https://github.com/lavary/crunz/compare/v1.11.0-rc.1...v1.11.0
[v1.11.0-rc.1]: https://github.com/lavary/crunz/compare/v1.11.0-beta.2...v1.11.0-rc.1
[v1.11.0-beta.2]: https://github.com/lavary/crunz/compare/v1.11.0-beta.1...v1.11.0-beta.2
[v1.11.0-beta.1]: https://github.com/lavary/crunz/compare/v1.10.1...v1.11.0-beta.1
[v1.10.1]: https://github.com/lavary/crunz/compare/v1.10.0...v1.10.1
[v1.10.0]: https://github.com/lavary/crunz/compare/v1.9.0...v1.10.0
[v1.12.0]: https://github.com/lavary/crunz/compare/v1.11.2...v1.12.0
[@vinkla]: https://github.com/vinkla
[@timurbakarov]: https://github.com/timurbakarov
[@radarhere]: https://github.com/radarhere
Expand All @@ -274,3 +302,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[@TomasDuda]: https://github.com/TomasDuda
[@PhilETaylor]: https://github.com/PhilETaylor
[@FallDi]: https://github.com/FallDi
[@SadeghPM]: https://github.com/SadeghPM
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ Crunz is capable of executing any kind of executable command as well as PHP clos

|Version|Supported PHP versions|Linux build|Windows build|
|---|---|---|---|
|stable (v1.11.1)|![5.6+](https://img.shields.io/badge/php-%5E5.6%20%7C%7C%20%5E7.0-blue.svg?style=flat-square)|[![Build Status](https://img.shields.io/travis/lavary/crunz/v1.11.1.svg?style=flat-square)](https://travis-ci.org/lavary/crunz)|*Tag build not supported*
|stable (v1.12.0)|![5.6+](https://img.shields.io/badge/php-%5E5.6%20%7C%7C%20%5E7.0-blue.svg?style=flat-square)|[![Build Status](https://img.shields.io/travis/lavary/crunz/v1.12.0.svg?style=flat-square)](https://travis-ci.org/lavary/crunz)|*Tag build not supported*
|dev v2 (master/v2.x-dev)|![7.1.3+](https://img.shields.io/badge/php-%5E7.1.3-blue.svg?style=flat-square)|[![Build Status](https://img.shields.io/travis/lavary/crunz/master.svg?style=flat-square)](https://travis-ci.org/lavary/crunz)|[![AppVeyor branch](https://img.shields.io/appveyor/ci/lavary/crunz/master.svg?style=flat-square)](https://ci.appveyor.com/project/lavary/crunz)
|dev v1.12.x (v1.12.x-dev)|![5.6+](https://img.shields.io/badge/php-%5E5.6%20%7C%7C%20%5E7.0-blue.svg?style=flat-square)|[![Build Status](https://img.shields.io/travis/lavary/crunz/1.12.x.svg?style=flat-square)](https://travis-ci.org/lavary/crunz)|[![AppVeyor branch](https://img.shields.io/appveyor/ci/lavary/crunz/1.12.x.svg?style=flat-square)](https://ci.appveyor.com/project/lavary/crunz)
|dev v1.11.x (v1.11.x-dev)|![5.6+](https://img.shields.io/badge/php-%5E5.6%20%7C%7C%20%5E7.0-blue.svg?style=flat-square)|[![Build Status](https://img.shields.io/travis/lavary/crunz/1.11.x.svg?style=flat-square)](https://travis-ci.org/lavary/crunz)|[![AppVeyor branch](https://img.shields.io/appveyor/ci/lavary/crunz/1.11.x.svg?style=flat-square)](https://ci.appveyor.com/project/lavary/crunz)

## Roadmap
|Version|Release date|Active support until|Bug support until
Expand Down
55 changes: 55 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
# Upgrading from v1.11 to v1.12

## Always return `\Crunz\Schedule` from task files

Example of wrong task file:

```php
<?php

return [];
```

Example of correct task file:
```php
<?php

use Crunz\Schedule;

$scheduler = new Schedule();

$scheduler
->run('php -v')
->description('PHP version')
->everyMinute();

// Crunz\Schedule instance returned
return $scheduler;
```

## Stop using `\Crunz\Event::setProcess`

If you, for some reason, use above method you should stop it.
This method was intended to be `private` and will be in `v2.0`,
which will lead to exception if you call it.

Example of wrong usage

```php
<?php

use Crunz\Schedule;

$process = new \Symfony\Component\Process\Process('php -i');
$scheduler = new Schedule();
$task = $scheduler->run('php -v');
$task
// setProcess is deprecated
->setProcess($process)
->description('PHP version')
->everyMinute()
;

return $scheduler;
```

# Upgrading from v1.10 to v1.11

## Run `Crunz` in directory with your `crunz.yml`
Expand Down
4 changes: 3 additions & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
$envFlags = new \Crunz\EnvFlags\EnvFlags();
$envFlags->disableDeprecationHandler();

if (\strpos(\getcwd(), 'tests') !== false) {
$filesystem = new \Crunz\Filesystem\Filesystem();

if (\strpos($filesystem->getCwd(), 'tests') !== false) {
return;
}

Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@
},
"scripts": {
"crunz:cs-fix": "@php vendor/bin/php-cs-fixer fix --diff -v --ansi",
"crunz:analyze": "@php vendor/bin/php-cs-fixer fix --diff --dry-run -v",
"crunz:analyze": [
"@php vendor/bin/php-cs-fixer fix --diff --dry-run -v",
"@phpstan:check"
],
"crunz:link-changelog": "@php vendor/bin/changelog-linker dump-merges --dry-run --in-categories",
"crunz:link-changelog:since": "@php vendor/bin/changelog-linker dump-merges --dry-run --in-categories --since-id"
"crunz:link-changelog:since": "@php vendor/bin/changelog-linker dump-merges --dry-run --in-categories --since-id",
"phpstan:check": "@php vendor/bin/phpstan analyse -c phpstan.neon -l 7 src tests crunz config bootstrap.php .php_cs.dist"
},
"extra": {
"branch-alias": {
Expand Down
3 changes: 3 additions & 0 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
->setArguments(
[
new Reference(Configuration::class),
new Reference(FilesystemInterface::class),
]
)
;
Expand Down Expand Up @@ -149,6 +150,8 @@
->setArguments(
[
new Reference(Configuration::class),
new Reference(Timezone::class),
new Reference(ConsoleLoggerInterface::class),
]
)
;
Expand Down
8 changes: 8 additions & 0 deletions crunz
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ $autoloadPaths = [
'autoload.php'
]
),
// Vendor/Bin
$generatePath(
[
__DIR__,
'..',
'autoload.php'
]
),
// Local dev
$generatePath(
[
Expand Down
62 changes: 62 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
parameters:
reportUnmatchedIgnoredErrors: false
autoload_files:
- vendor-bin/cs-fixer/vendor/autoload.php
- vendor-bin/phpunit/vendor/autoload.php
ignoreErrors:
-
message: '#Undefined variable: \$container#'
path: config/services.php
-
message: '#Class Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder does not have a constructor#'
path: src/Configuration/Definition.php
-
message: '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\)#'
path: src/Configuration/Definition.php
-
message: '#Call to an undefined static method Swift_Mailer::newInstance()#'
path: src/Mailer.php
-
message: '#Call to an undefined static method Swift_SmtpTransport::newInstance()#'
path: src/Mailer.php
-
message: '#Return typehint of method Crunz\\Mailer::getMailTransport\(\) has invalid type Swift_MailTransport#'
path: src/Mailer.php
-
message: '#Call to static method newInstance\(\) on an unknown class Swift_MailTransport#'
path: src/Mailer.php
-
message: '#Call to an undefined static method Swift_SendmailTransport::newInstance\(\)#'
path: src/Mailer.php
-
message: '#Call to an undefined static method Swift_Message::newInstance\(\)#'
path: src/Mailer.php
-
message: '#Parameter \#1 \$transport of class Swift_Mailer constructor expects Swift_Transport#'
path: src/Mailer.php
- '#Constant CRUNZ_BIN_DIR not found#'
- '#Constant CRUNZ_BIN not found#'
-
message: '#Variable \$configFile might not be defined#'
path: src/Configuration/ConfigurationParser.php
-
message: '#Call to an undefined method Crunz\\Event::DummyFrequency\(\)#'
path: src/Stubs/BasicTask.php
-
message: '#Call to an undefined method Crunz\\Event::every.*(Minutes|Hours)\(\)#'
path: tests/Unit/EventTest.php
- '#Method Crunz\\(Event|Schedule|Tests\\Unit\\Pingable)::(pingBefore|thenPing)\(\) should return \$this\(Crunz\\Pinger\\PingableInterface\)#'
-
message: "#Call to function method_exists\\(\\) with 'Swift([a-zA-Z_…]+)?' and 'newInstance' will always evaluate to false#"
path: src/Mailer.php
-
message: "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component…' and '(fromShellCommandline|inheritEnvironmentV…)' will always evaluate to false#"
path: src/Process/Process.php
-
message: '#Parameter \#1 \$command of static method Symfony\\Component\\Process\\Process::fromShellCommandline\(\) expects string, array|string given#'
path: src/Process/Process.php

includes:
- vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/extension.neon
- vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/rules.neon
# - vendor-bin/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
14 changes: 12 additions & 2 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
Expand Down Expand Up @@ -67,6 +68,7 @@ public function __construct($appName, $appVersion)
$this->registerDeprecationHandler();

foreach (self::COMMANDS as $commandClass) {
/** @var Command $command */
$command = $this->container
->get($commandClass)
;
Expand All @@ -78,13 +80,19 @@ public function __construct($appName, $appVersion)
public function run(InputInterface $input = null, OutputInterface $output = null)
{
if (null === $output) {
$output = $this->container
/** @var OutputInterface $outputObject */
$outputObject = $this->container
->get(OutputInterface::class);

$output = $outputObject;
}

if (null === $input) {
$input = $this->container
/** @var InputInterface $inputObject */
$inputObject = $this->container
->get(InputInterface::class);

$input = $inputObject;
}

return parent::run($input, $output);
Expand Down Expand Up @@ -162,6 +170,7 @@ private function dumpContainer(
): void {
$dumper = new PhpDumper($container);

/** @var string $content */
$content = $dumper->dump(
[
'class' => $class,
Expand Down Expand Up @@ -236,6 +245,7 @@ private function registerDeprecationHandler(): void
return;
}

/** @var SymfonyStyle $io */
$io = $this->container
->get(SymfonyStyle::class);

Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Configuration
{
/** @var array */
private $config;
/** @var ConfigurationParser */
/** @var ConfigurationParserInterface */
private $configurationParser;
/** @var FilesystemInterface */
private $filesystem;
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()

->booleanNode('timezone_log')
->defaultFalse()
->info('Whether configured timezone will be used for logs')
->defaultFalse()
->info('Whether configured "timezone" will be used for logs')
->end()

->booleanNode('log_errors')
Expand Down
7 changes: 6 additions & 1 deletion src/Configuration/FileParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ public function parse(string $configPath): array
}

$yamlParser = $this->yamlParser;
$configContent = \file_get_contents($configPath);

return [$yamlParser::parse(\file_get_contents($configPath))];
if (false === $configContent) {
throw ConfigFileNotReadableException::fromFilePath($configPath);
}

return [$yamlParser::parse($configContent)];
}
}
Loading

0 comments on commit cb4a6a0

Please sign in to comment.