File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 3939 path : ~/.composer/cache
4040 key : ${{ runner.os }}-${{ matrix.php }}-${{ matrix.setup }}-composer-${{ hashFiles('**/composer.lock') }}
4141
42+ - name : Set PHPUnit version
43+ if : matrix.php >= 8.1
44+ run : composer require "phpunit/phpunit:^8.5.41" --no-update
45+
4246 - name : Install Dependencies
4347 run : composer update --prefer-dist --prefer-${{ matrix.setup }} --no-interaction --no-suggest
4448
Original file line number Diff line number Diff line change 1414 "require" : {
1515 "php" : " ^7.1 || ^8.0" ,
1616 "simple-cli/simple-cli" : " ^1.1" ,
17- "nesbot/carbon" : " ^2.20 "
17+ "nesbot/carbon" : " ^2.72.6 || ^3.0 "
1818 },
1919 "require-dev" : {
20- "phpunit/phpunit" : " ^7.5 || ^8.2 "
20+ "phpunit/phpunit" : " ^7.5.20 || ^8.5.41 "
2121 },
2222 "autoload" : {
2323 "psr-4" : {
Original file line number Diff line number Diff line change 33namespace Carbon \Types ;
44
55use Carbon \Carbon ;
6+ use Carbon \FactoryImmutable ;
67use Closure ;
78use ReflectionClass ;
89use ReflectionException ;
@@ -51,11 +52,17 @@ protected function getMethods($boots)
5152 $ this ->runBoot ($ boot );
5253 }
5354
54- $ c = new ReflectionClass (Carbon::now ());
55- $ macros = $ c ->getProperty ('globalMacros ' );
56- $ macros ->setAccessible (true );
55+ if (method_exists (FactoryImmutable::class, 'getDefaultInstance ' )) {
56+ // Carbon 3
57+ return FactoryImmutable::getDefaultInstance ()->getSettings ()['macros ' ] ?? [];
58+ } else {
59+ // Carbon 2
60+ $ c = new ReflectionClass (Carbon::now ());
61+ $ macros = $ c ->getProperty ('globalMacros ' );
62+ $ macros ->setAccessible (true );
5763
58- return $ macros ->getValue ();
64+ return $ macros ->getValue ();
65+ }
5966 }
6067
6168 /**
You can’t perform that action at this time.
0 commit comments