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 static isValid function to CronExpression #186

Open
wants to merge 169 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
8a84aee
Updated README and author information for 2.x
dragonmantank Oct 12, 2017
39cf81f
Update to PHPUnit 6
carusogabriel Nov 11, 2017
3322a1c
Merge pull request #2 from gabriel-caruso/phpunit-6
dragonmantank Nov 11, 2017
8bcdd1a
tweak
laurencei Dec 3, 2017
efa1844
fix capital
laurencei Dec 3, 2017
c40ce64
tweak
laurencei Dec 3, 2017
2a88eac
Fixed bad example in README (#7)
dragonmantank Jan 8, 2018
9f88567
Allow ranges and lists in the same expression (#5)
dragonmantank Mar 2, 2018
2b305e3
Fixed regression where literals were not converted to their numerical…
dragonmantank Mar 2, 2018
c1cfab2
Merge pull request #3 from laurencei/timezones
dragonmantank Apr 6, 2018
3f00985
Updated README for 2.1.0
dragonmantank Apr 6, 2018
d403cc2
Resolves #12, added support for numerals with leading 0s
dragonmantank Jun 6, 2018
2ff19fb
Resolves #6, added support for ranges to wrap around with large steps
dragonmantank Jun 6, 2018
92a2c37
Updated changelog for 2.2
dragonmantank Jun 6, 2018
700b373
fix symmetry in constructor and factory method
EntranceJew Jun 7, 2018
34318b4
Merge pull request #17 from EntranceJew/patch-1
dragonmantank Jul 28, 2018
55d20c6
highlight variables
atefBB Sep 13, 2018
0f844c4
Improve dependency declaration
phansys Dec 4, 2018
c2f2518
Get timezone from DateTimeInterface
piotr-cz Dec 6, 2018
73de60d
Adding missing docblocks
piotr-cz Dec 6, 2018
0753135
Adding missing docblocks for class properties
piotr-cz Dec 6, 2018
c7b878d
Normalize EOLs
piotr-cz Dec 6, 2018
8572241
Fixed infinite loop when resolving last weekday of the month from lit…
EimantasMorkunas Dec 19, 2018
02b8123
Merge pull request #28 from EimantasMorkunas/master
dragonmantank Dec 19, 2018
a2c6019
Started listing projects that use cron-expression
dragonmantank Feb 14, 2019
9ad428f
Merge pull request #25 from phansys/dependencies
dragonmantank Feb 14, 2019
91e4284
Merge pull request #26 from piotr-cz/bugfix/get-timezone-from-datetim…
dragonmantank Feb 14, 2019
864b92b
Merge pull request #27 from piotr-cz/cs/docblocks
dragonmantank Feb 14, 2019
b195d12
Positions used higher than 4 now throw a human readable error
dragonmantank Feb 14, 2019
e0848f7
Merge pull request #22 from atefBB/patch-1
dragonmantank Feb 14, 2019
714f6a8
Added PHP 7.3 support, fixed nightly
dragonmantank Feb 14, 2019
6e990d8
PHP 7.2 improvement + syntax cleanup + php_cs config update.
legionth Jan 15, 2019
05525cd
remove php <= 7.1
Webonaute Feb 15, 2019
5d2b256
Use null coalescing operator
holtkamp Feb 24, 2019
d929435
Introduce FieldFactoryInterface
holtkamp Feb 24, 2019
20e86a5
Introduce PHPStan
holtkamp Feb 24, 2019
30e6633
Reduce strictness level to add tests to analysis
holtkamp Feb 24, 2019
c38f254
Support DateTimeImmutable
cmorbitzer Mar 6, 2019
4d7bacd
Merge pull request #41 from cmorbitzer/support-datetimeimmutable
dragonmantank Mar 30, 2019
26da0f5
Merge pull request #39 from holtkamp/patch-adopt-PHPStan
dragonmantank Mar 30, 2019
c36a6d7
Merge branch 'master' into master
dragonmantank Mar 30, 2019
c8d107f
Fixed infinite loop when resolving last weekday of the month from lit…
EimantasMorkunas Dec 19, 2018
5b53033
Started listing projects that use cron-expression
dragonmantank Feb 14, 2019
362cb11
Improve dependency declaration
phansys Dec 4, 2018
899ea1c
Get timezone from DateTimeInterface
piotr-cz Dec 6, 2018
02b94aa
Adding missing docblocks
piotr-cz Dec 6, 2018
63d388f
Adding missing docblocks for class properties
piotr-cz Dec 6, 2018
9b67b7e
Normalize EOLs
piotr-cz Dec 6, 2018
b3e6ce9
Positions used higher than 4 now throw a human readable error
dragonmantank Feb 14, 2019
ab9f57a
highlight variables
atefBB Sep 13, 2018
e54f124
Added PHP 7.3 support, fixed nightly
dragonmantank Feb 14, 2019
72b6fbf
Support DateTimeImmutable
cmorbitzer Mar 6, 2019
be02d48
Introduce PHPStan
holtkamp Feb 24, 2019
df735ef
Reduce strictness level to add tests to analysis
holtkamp Feb 24, 2019
7bee65e
Upped PHP to 7.2
dragonmantank Mar 31, 2019
f821a10
Merge branch 'master' into master
dragonmantank Mar 31, 2019
548ad7e
Cleaned up some issues from rebasing
dragonmantank Mar 31, 2019
1aba9b9
Removed test that checked for invalid character
dragonmantank Mar 31, 2019
0bea225
Move PHPStan to require-dev
holtkamp Apr 15, 2019
d48a515
Invalid numeric ranges
piotr-cz Apr 25, 2019
d75fc51
Switch to short array syntax
GrahamCampbell Jun 27, 2019
136454a
Merge pull request #43 from holtkamp/patch-1
dragonmantank Jul 29, 2019
4c8a4dd
Merge pull request #47 from GrahamCampbell/patch-1
dragonmantank Jul 29, 2019
c6fee8c
Apply fixes from StyleCI
dragonmantank Jul 29, 2019
734d946
Merge pull request #48 from dragonmantank/analysis-XZNv26
dragonmantank Jul 30, 2019
315afc7
Merge pull request #45 from piotr-cz/bugfix/invalid-numeric-ranges
dragonmantank Jul 30, 2019
1fcc224
Dropped support back to 7.1 from 7.2
dragonmantank Jul 30, 2019
b80b95b
Added macros we support
dragonmantank Jul 30, 2019
9420e43
Cleaned up some README formatting, and typo on PHP version
dragonmantank Jul 30, 2019
b8d6872
Verified that 0/5 should now fail
dragonmantank Jul 30, 2019
c9d0f45
Fixed #24, incoming literals are automatically converted to uppercase
dragonmantank Jul 30, 2019
d7ca62d
fixed constructor optional argument
fabpot Aug 1, 2019
df10c80
fixed issue with timezones
fabpot Aug 1, 2019
e444523
fixed cloning dates in isDue()
fabpot Aug 1, 2019
63cfc1c
Merge pull request #49 from fabpot/constructor-fix
dragonmantank Oct 11, 2019
8629d91
Merge pull request #50 from fabpot/timezone-issue-fix
dragonmantank Oct 11, 2019
2be5d5e
Merge pull request #51 from fabpot/clone-fix
dragonmantank Oct 11, 2019
832f1bd
Initial fix for and/or problem
dragonmantank Oct 11, 2019
49c8b8a
Make sure that shortcuts are not case sensitive
dragonmantank Nov 14, 2019
228b7e0
Removed branch alias, as actual branches should be used not aliases
dragonmantank Nov 14, 2019
2820a7e
Created a FUNDING.yml
dragonmantank Dec 5, 2019
e57d8bf
Update .travis.yml
GrahamCampbell Dec 19, 2019
de10060
Merge pull request #65 from GrahamCampbell/patch-1
dragonmantank Dec 20, 2019
507b2ff
Add Crunz to "Projects that Use cron-expression" section
PabloKowalczyk Jan 4, 2020
a2b6829
Mark this package as replace for mtdowling/cron-expression
alexander-schranz Jan 23, 2020
d1623a2
Merge pull request #68 from PabloKowalczyk/add-crunz
dragonmantank Feb 3, 2020
4181db5
Replace deprecated expectedException annotations
rgson Feb 10, 2020
7c33116
Merge pull request #70 from rgson/phpunit-deprecations
dragonmantank Feb 10, 2020
bcc31c7
Merge pull request #69 from alexander-schranz/patch-1
dragonmantank Feb 10, 2020
1ef6255
Merge branch 'master' of https://github.com/dragonmantank/cron-expres…
holtkamp Feb 29, 2020
bff1f0f
Merge branch 'master' of https://github.com/dragonmantank/cron-expres…
holtkamp Feb 29, 2020
a97cd66
Fix CI issues
holtkamp Feb 29, 2020
33e9c65
Sync with master
holtkamp Feb 29, 2020
1942ec1
Actually use FieldFactoryInterface
holtkamp Feb 29, 2020
b55e1f8
Merge pull request #61 from dragonmantank/issue/35-fix-and-or-problem
dragonmantank Mar 25, 2020
07ca402
Merge pull request #38 from holtkamp/patch-use-FieldFactoryInterface
dragonmantank Mar 25, 2020
d4307f1
Merge pull request #37 from holtkamp/patch-use-null-coalescing-operator
dragonmantank Mar 25, 2020
86abbda
Updated changelog for 2.4.0
dragonmantank Nov 14, 2019
2815ad8
Added regression test and cleaned up some ?CHANGELOG language
dragonmantank Mar 25, 2020
5e2fce6
Expanded tests for casing
dragonmantank Mar 25, 2020
90efed9
Added CHANGELOG entry for #38
dragonmantank Mar 25, 2020
70c187e
StyleCI fixes
dragonmantank Mar 25, 2020
2d923cd
Added missing check for ? in DOM and DOW
dragonmantank Aug 21, 2020
fa4e95f
Cast step to an int as part of calling range(), see #80
dragonmantank Aug 21, 2020
0801fd5
Add compatibility with PHP 8.0
ausi Sep 16, 2020
562588e
Fix type error
ausi Sep 16, 2020
914fd0f
Merge pull request #92 from ausi/fix/php-8-compatibility
dragonmantank Oct 12, 2020
4e77957
Added support for PHP 8
dragonmantank Oct 12, 2020
48212cd
Fixed phpstan and phpunit dependencies for v3 line
dragonmantank Oct 13, 2020
ecb44fe
set phpstan to level max and fix issues
oallain Oct 5, 2020
45e740b
add phpstan to travis
oallain Oct 5, 2020
658991e
fix StyleCI
oallain Oct 6, 2020
7c8900c
fix dependencies for webmozart/assert
oallain Oct 6, 2020
da10dc3
Allow proper usage of interfaces
DerekCresswell Nov 6, 2020
54a50e1
Merge pull request #98 from DerekCresswell/use-interfaces
dragonmantank Nov 24, 2020
4e6d76e
Depreceate CronExpression::factory and remove references (#99)
DerekCresswell Nov 24, 2020
c6738a4
Adds getParts to CronExpression (#84)
DerekCresswell Nov 24, 2020
786b314
Ignore files when exporting package (#78)
simonschaufi Nov 24, 2020
908609e
Updates Phpunit configuration (#102)
DerekCresswell Nov 24, 2020
7f960c9
add github action - phpstan and phpunit (#95)
oallain Nov 24, 2020
faf4bc3
Merge branch 'master' into phpstan-level-max
dragonmantank Nov 24, 2020
2fe1b7d
Fixing max run tests for PHP 7.x, excluding 8.0
dragonmantank Nov 24, 2020
45c666c
Merge branch 'oallain-phpstan-level-max'
dragonmantank Nov 24, 2020
323b563
Cleaned up GHA, dropped PHP 7.1 support (#104)
dragonmantank Nov 24, 2020
df032c2
Mark YEAR constant as deprecated to prevent usage (#87)
holtkamp Nov 24, 2020
7a8c6e5
Added changelog for 3.1.0
dragonmantank Nov 24, 2020
76ec733
Change private class variables to protected (#106)
DerekCresswell Mar 17, 2021
49b8832
refactor(optimize): getMultipleRunDates method (#75)
oleksiikhr Jan 5, 2022
4f6482a
Improve instance of assertion (#105)
peter279k Jan 5, 2022
cc1d62c
midnight is also an allowed shortcut in crontab (#117)
BlackIkeEagle Jan 5, 2022
570c4f0
F Updated changelog for v3.2.0 release
dragonmantank Jan 5, 2022
e89a549
Fix "," delimiter precedence (#122)
selfiens Jan 5, 2022
2146fe7
Fixed getPreviousRunDate return value for cron expression with both d…
olafkryus Jan 5, 2022
6a9fccc
Update tests.yml (#125)
Jan 5, 2022
7a364e7
Fix failing PHPStan issue (#130)
peter279k Jan 5, 2022
5d6c9a7
DST handling fixes (fixes #111, #112) (#115)
AllenJB Jan 5, 2022
cf3bbe9
Added changelog for v3.2.1
dragonmantank Jan 5, 2022
ebb006b
Marked a bunch of field stuff @internal
dragonmantank Jan 5, 2022
9d513a7
Fixing #89, wraparound shouldn't check the high value
dragonmantank Jan 5, 2022
4445c6f
Fixes #88, if step is larger than small range only set start
dragonmantank Jan 5, 2022
c9e2083
Added changelog for v3.2.2
dragonmantank Jan 5, 2022
6ba5cb5
Changed how hours and minutes increment/decrement for better TZ handling
dragonmantank Jan 6, 2022
47c53bb
Added changelog for v3.2.3
dragonmantank Jan 6, 2022
ae5123b
Changed handling of DOM for DST crossover
dragonmantank Jan 6, 2022
9c6ee74
Additional tests covering other times that cropped up from v3.2.1 and…
dragonmantank Jan 13, 2022
9545dea
Fix for DOW DST changes, and updated README
dragonmantank Jan 13, 2022
6e0003e
Fixed run date calculations when ? is used to skip
dragonmantank Jan 13, 2022
9b377d5
Changed requirements from 7.1+ to 7.2+
dragonmantank Jan 14, 2022
d10f969
Adding Registering alias feature to the package (#132)
nyamsprod Jan 14, 2022
99a8406
More tests around DOW and DOM resolutions
dragonmantank Jan 14, 2022
d81a567
Fixed PHPStan errors
dragonmantank Jan 14, 2022
63f2a76
Added changelog for 3.3.0
dragonmantank Jan 14, 2022
be85b3f
Fixed #134, no transitions now immediately returns null
dragonmantank Jan 18, 2022
75916a4
[PHP 8.2] Fix `${var}` string interpolation deprecation (#142)
Ayesh Sep 6, 2022
4fe4677
Skip PHP 8.1 unstable daylight savings tests (#146)
athos-ribeiro Sep 6, 2022
7d97005
Allowed some additional composer plugins to run
dragonmantank Sep 6, 2022
fc75c83
Fixed some PHPStan errors around comparisons and literal positions
dragonmantank Sep 10, 2022
782ca59
Changelog for 3.3.2
dragonmantank Sep 10, 2022
8e78e44
#137 Add check for multiple question marks (#148)
LeoVie Aug 10, 2023
ab597c8
Fix skipped next execution time (#160)
imyip Aug 10, 2023
fafeaac
Update CronExpression.php (#158)
onemoreangle Aug 10, 2023
357e4a5
Mark `phpstan.neon` as `export-ignore` in `.gitattributes` (#144)
TimWolla Aug 10, 2023
6dda217
Update .gitattributes (#143)
erikn69 Aug 10, 2023
9f6ad16
Change Crunz repository (#139)
PabloKowalczyk Aug 10, 2023
93a3622
Fix skipped next execution time (#160)
imyip Aug 10, 2023
13e72fc
Added regression tests for issue #151
dragonmantank Aug 10, 2023
adfb1f5
Added Changelog for 3.3.3
dragonmantank Aug 10, 2023
e67da80
Add isValid static function to test expressions before use. (and use …
loneregister Sep 5, 2023
4cb540f
Merge remote-tracking branch 'origin/master'
loneregister Sep 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
* text=auto

.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.styleci.yml export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
/.github export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/phpstan.neon export-ignore
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [dragonmantank]
77 changes: 77 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: Tests

jobs:
phpstan:
name: PHPStan - PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0, 8.1]

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, mbstring

- name: Install dependencies
run: composer update --prefer-dist --no-interaction

- name: Start Static Analyze
run: composer phpstan -n

phpunit:
name: PHPUnit - PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0, 8.1]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, mbstring
coverage: pcov
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Get Composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer update --prefer-dist --no-interaction

- name: Analyze & test
run: composer test -- -v --coverage-clover=coverage.xml
87 changes: 77 additions & 10 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,82 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
$finder = PhpCsFixer\Finder::create()
->in(__DIR__);

$fixers = array(
'-psr0',
'long_array_syntax',
);
$config = PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'declare_strict_types' => true,
'native_function_invocation' => [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
],
'phpdoc_align' => [
'align' => 'left',
],
'blank_line_before_statement' => true,
'align_multiline_comment' => false,
'concat_space' => [
'spacing' => 'one',
],
'array_syntax' => [
'syntax' => 'short',
],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'array_indentation' => true,
'no_extra_blank_lines' => [
'break',
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'switch',
'throw',
'use',
'useTrait',
'use_trait',
],
'compact_nullable_typehint' => true,
'escape_implicit_backslashes' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'final_internal_class' => true,
'fully_qualified_strict_types' => true,
'function_to_constant' => [
'functions' => [
'get_class',
'get_called_class',
'php_sapi_name',
'phpversion',
'pi',
],
],
'list_syntax' => [
'syntax' => 'short',
],
'logical_operators' => true,
'no_alternative_syntax' => true,
'no_null_property_initialization' => true,
'no_short_echo_tag' => true,
'no_superfluous_elseif' => false,
'no_unreachable_default_argument_value' => true,
'no_unset_on_property' => false,
'no_useless_else' => false,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types_order' => true,
'return_assignment' => true,
'string_line_ending' => true,
'strict_param' => true,
'strict_comparison' => true,
])
->setFinder($finder);

return Symfony\CS\Config\Config::create()
->finder($finder)
->fixers($fixers)
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->setUsingCache(true);
return $config;
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
preset: psr2

enabled:
- long_array_syntax
- short_array_syntax
- method_separation
39 changes: 27 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
language: php

php:
- 7.0
- 7.1
- hhvm
dist: bionic

sudo: false

install: travis_retry composer install --no-interaction --prefer-dist
matrix:
include:
- php: 7.1
- php: 7.1
env: dependencies=lowest
- php: 7.2
- php: 7.2
env: dependencies=lowest
- php: 7.3
- php: 7.3
env: dependencies=lowest
- php: 7.4
- php: 7.4
env: dependencies=lowest
- php: nightly
install: travis_retry composer install --no-interaction --prefer-dist --ignore-platform-reqs

script: phpunit --coverage-text
install:
- |
if [[ "$dependencies" = "lowest" ]]; then
travis_retry composer update --no-interaction --prefer-lowest --prefer-stable -n
else
travis_retry composer install --no-interaction --prefer-dist
fi

matrix:
allow_failures:
- php: hhvm
fast_finish: true
script:
- vendor/bin/phpunit --coverage-text
- composer phpstan
Loading