Skip to content

Commit

Permalink
Merge pull request #432 from bearsunday/php5.x-support
Browse files Browse the repository at this point in the history
PHP 5.x Support
  • Loading branch information
koriym authored Jun 9, 2024
2 parents 1eb7e10 + 57bfffe commit 6e260eb
Show file tree
Hide file tree
Showing 59 changed files with 443 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
ci:
uses: ray-di/.github/.github/workflows/continuous-integration.yml@v1
with:
old_stable: '["8.1", "8.2"]
old_stable: '["8.1", "8.2"]'
current_stable: 8.3
2 changes: 1 addition & 1 deletion composer-require-checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed",
"Composer\\Autoload\\ClassLoader", "Doctrine\\Common\\Cache\\FilesystemCache", "Doctrine\\Common\\Cache\\PhpFileCache",
"BEAR\\Resource\\ReverseLinkInterface"
"BEAR\\Resource\\ReverseLinkInterface", "Doctrine\\Common\\Cache\\ArrayCache"
]
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"aura/cli": "^2.2",
"bear/app-meta": "^1.8",
"bear/query-repository": "^1.9.1",
"bear/resource": "^1.20",
"bear/resource": "^1.22",
"bear/streamer": "^1.2.2",
"bear/sunday": "^1.6.1",
"monolog/monolog": "^1.25 || ^2.0 || ^3.0",
Expand Down
11 changes: 11 additions & 0 deletions src-deprecated/AppInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

use BEAR\AppMeta\AbstractAppMeta;
use BEAR\AppMeta\Meta;
use BEAR\Package\Module\CacheModule;
use Doctrine\Common\Cache\FilesystemCache;
use Ray\Compiler\ScriptInjector;
use Ray\Di\AbstractModule;
use Ray\Di\Bind;
use Ray\Di\Injector;
use Ray\Di\InjectorInterface;
use Ray\Di\Name;
use RuntimeException;

/**
* @deprecated
Expand Down Expand Up @@ -58,6 +60,7 @@ final class AppInjector implements InjectorInterface

public function __construct(string $name, string $context, AbstractAppMeta $appMeta = null, string $cacheNamespace = null)
{
$this->checkVersion();
$this->context = $context;
$this->appMeta = $appMeta instanceof AbstractAppMeta ? $appMeta : new Meta($name, $context);
$this->cacheNamespace = (string) $cacheNamespace;
Expand Down Expand Up @@ -133,6 +136,7 @@ private function getModule() : AbstractModule
return $this->module;
}
$module = (new Module)($this->appMeta, $this->context);
$module->install(new CacheModule());
/* @var AbstractModule $module */
$container = $module->getContainer();
(new Bind($container, InjectorInterface::class))->toInstance($this->injector);
Expand All @@ -141,4 +145,11 @@ private function getModule() : AbstractModule

return $module;
}

private function checkVersion(): void
{
if (! class_exists('Doctrine\Common\Cache\FilesystemCache')) {
throw new RuntimeException('Doctrine cache ^1.0 is required for AppInjector. Please install doctrine/cache ^1.0');
}
}
}
28 changes: 28 additions & 0 deletions src-deprecated/Module/CacheModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace BEAR\Package\Module;

use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\Cache;
use Ray\Di\AbstractModule;
use function class_exists;
use function interface_exists;

/**
* @deprecated
*/
class CacheModule extends AbstractModule
{
/**
* {@inheritdoc}
*/
protected function configure(): void
{
if (interface_exists(Cache::class)) {
assert(class_exists(ArrayCache::class)); // ensure doctrine/cache ^1 is installed.
$this->bind(Cache::class)->to(ArrayCache::class);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"7.2.9","version":"2.14.2:v2.14.2#ff401e58261ffc5934a58f795b3f95b355e276cb","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"combine_nested_dirname":true,"declare_strict_types":true,"non_printable_character":true,"random_api_migration":{"replacements":{"mt_rand":"random_int","rand":"random_int"}},"pow_to_exponentiation":true,"align_multiline_comment":true,"array_indentation":true,"array_syntax":{"syntax":"short"},"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_return":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw"]},"cast_spaces":true,"class_attributes_separation":{"elements":["const","method"]},"combine_consecutive_issets":true,"combine_consecutive_unsets":true,"compact_nullable_typehint":true,"concat_space":{"spacing":"one"},"declare_equal_normalize":true,"dir_constant":true,"ereg_to_preg":true,"error_suppression":true,"escape_implicit_backslashes":true,"explicit_indirect_variable":true,"explicit_string_variable":true,"fully_qualified_strict_types":true,"function_to_constant":true,"function_typehint_space":true,"general_phpdoc_annotation_remove":["author","category","package","copyright","version"],"header_comment":{"header":"","comment_type":"comment"},"heredoc_to_nowdoc":true,"include":true,"is_null":{"use_yoda_style":false},"linebreak_after_opening_tag":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"method_chaining_indentation":true,"method_separation":true,"modernize_types_casting":true,"multiline_comment_opening_closing":true,"multiline_whitespace_before_semicolons":true,"native_function_casing":true,"no_alias_functions":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":true,"no_homoglyph_names":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_php4_constructor":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_elseif":true,"no_superfluous_phpdoc_tags":true,"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unreachable_default_argument_value":true,"no_unset_on_property":true,"no_unused_imports":true,"no_useless_else":true,"no_useless_return":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"not_operator_with_successor_space":true,"object_operator_without_whitespace":true,"ordered_class_elements":true,"ordered_imports":true,"php_unit_construct":true,"php_unit_dedicate_assert":true,"php_unit_expectation":true,"php_unit_fqcn_annotation":true,"php_unit_namespaced":true,"php_unit_no_expectation_annotation":true,"php_unit_ordered_covers":true,"php_unit_set_up_tear_down_visibility":true,"php_unit_strict":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_empty_return":true,"phpdoc_no_package":true,"phpdoc_order":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":true,"phpdoc_var_without_name":true,"protected_to_private":true,"psr0":true,"psr4":true,"return_assignment":true,"return_type_declaration":{"space_before":"one"},"self_accessor":true,"semicolon_after_instruction":true,"set_type_to_cast":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_quote":true,"space_after_semicolon":true,"standardize_increment":true,"standardize_not_equals":true,"strict_param":true,"ternary_operator_spaces":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true},"hashes":{"test\/HelperTest.php":4267459514,"test\/FakerTest.php":1096271447,"test\/TestCase.php":2520804778,"tests\/HelperTest.php":4267459514,"tests\/FakerTest.php":3266357280,"tests\/TestCase.php":2520804778,"src\/UnsupportedTypeException.php":1248848619,"src\/InvalidItemsException.php":2540628793,"src\/Faker.php":1180354433,"src\/Ref.php":3196288385}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return 'Import\\HelloWorld';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return 'page://self';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return '/Users/akihito/git/BEAR.Package/tests/Fake/import-app/var/tmp/app/di';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return unserialize('O:17:"BEAR\\AppMeta\\Meta":4:{s:4:"name";s:17:"Import\\HelloWorld";s:6:"appDir";s:53:"/Users/akihito/git/BEAR.Package/tests/Fake/import-app";s:6:"tmpDir";s:65:"/Users/akihito/git/BEAR.Package/tests/Fake/import-app/var/tmp/app";s:6:"logDir";s:65:"/Users/akihito/git/BEAR.Package/tests/Fake/import-app/var/log/app";}');
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Package\Provide\Error\NullPage();
$instance->setRenderer($singleton('BEAR\\Resource\\RenderInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\Anchor();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\EmbedInterceptor($singleton('BEAR\\Resource\\ResourceInterface-'));
$isSingleton = true;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\ExtraMethodInvoker($prototype('BEAR\\Resource\\RenderInterface-options'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\Factory($prototype('BEAR\\Resource\\SchemeCollectionInterface-', array('BEAR\\Resource\\Factory', '__construct', 'scheme')), $prototype('BEAR\\Resource\\UriFactory-'));
$instance->setSchemeCollection($prototype('BEAR\\Resource\\SchemeCollectionInterface-', array('BEAR\\Resource\\Factory', 'setSchemeCollection', 'scheme')));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\HalLink($prototype('BEAR\\Resource\\ReverseLinkInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\HalLinker($prototype('BEAR\\Resource\\ReverseLinkerInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\Invoker($prototype('BEAR\\Resource\\PhpClassInvoker-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\Linker($prototype('BEAR\\Resource\\InvokerInterface-'), $prototype('BEAR\\Resource\\FactoryInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\NullLogger();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\NamedParamMetas();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\NamedParameter($prototype('BEAR\\Resource\\NamedParamMetasInterface-'), $injector());
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\OptionsMethods('');
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\PhpClassInvoker($prototype('BEAR\\Resource\\NamedParameterInterface-'), $prototype('BEAR\\Resource\\ExtraMethodInvoker-'), $prototype('BEAR\\Resource\\LoggerInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\PrettyJsonRenderer();
$isSingleton = true;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\OptionsRenderer($prototype('BEAR\\Resource\\OptionsMethods-'), true);
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\Resource($prototype('BEAR\\Resource\\FactoryInterface-'), $prototype('BEAR\\Resource\\InvokerInterface-'), $prototype('BEAR\\Resource\\AnchorInterface-'), $prototype('BEAR\\Resource\\LinkerInterface-'), $prototype('BEAR\\Resource\\UriFactory-'));
$isSingleton = true;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\NullReverseLink();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\NullReverseLinker();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\Module\SchemeCollectionProvider('Import\\HelloWorld', $injector());
$isSingleton = false;
return $instance->get();
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Resource\UriFactory('page://self');
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \Import\HelloWorld\Module\App();
$isSingleton = true;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Sunday\Provide\Error\VndError($prototype('BEAR\\Sunday\\Extension\\Transfer\\TransferInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Sunday\Provide\Error\ThrowableHandler($prototype('BEAR\\Sunday\\Extension\\Error\\ErrorInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Sunday\Provide\Router\WebRouter('page://self');
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Sunday\Extension\Transfer\NullHttpCache();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Sunday\Provide\Transfer\HttpResponder($prototype('BEAR\\Sunday\\Provide\\Transfer\\HeaderInterface-'), $prototype('BEAR\\Sunday\\Provide\\Transfer\\ConditionalResponseInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Sunday\Provide\Transfer\ConditionalResponse();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \BEAR\Sunday\Provide\Transfer\Header();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \Koriym\Attributes\DualReader($prototype('Doctrine\\Common\\Annotations\\Reader-annotation'), $prototype('Doctrine\\Common\\Annotations\\Reader-attribute'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \Doctrine\Common\Annotations\AnnotationReader(null);
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \Koriym\Attributes\AttributeReader();
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \Import\HelloWorld\Resource\Page\Index();
$instance->setRenderer($singleton('BEAR\\Resource\\RenderInterface-'));
$isSingleton = false;
return $instance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ray\Di\Compiler;

$instance = new \Koriym\ParamReader\ParamReader($prototype('Doctrine\\Common\\Annotations\\Reader-'));
$isSingleton = false;
return $instance;
Loading

0 comments on commit 6e260eb

Please sign in to comment.