Skip to content

Commit

Permalink
Drop support to laminas-servicemanager < 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk committed Nov 12, 2020
1 parent 67045ad commit 337cdf6
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 635 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,5 +4,6 @@
/docs/html/
/laminas-mkdoc-theme.tgz
/laminas-mkdoc-theme/
/.phpunit.result.cache
/phpunit.xml
/vendor/
18 changes: 0 additions & 18 deletions autoload/formElementManagerPolyfill.php

This file was deleted.

23 changes: 3 additions & 20 deletions composer.json
Expand Up @@ -35,7 +35,7 @@
"doctrine/annotations": "^1.10.4",
"laminas/laminas-cache": "^2.9.0",
"laminas/laminas-captcha": "^2.9.0",
"laminas/laminas-code": "3.4.99",
"laminas/laminas-code": "^3.5.0",
"laminas/laminas-coding-standard": "^1.0.0",
"laminas/laminas-escaper": "^2.6.1",
"laminas/laminas-eventmanager": "^3.3.0",
Expand All @@ -50,23 +50,9 @@
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.4.2"
},
"repositories": [
{
"type": "package",
"package": {
"name": "laminas/laminas-code",
"version": "3.4.99",
"dist": {
"url": "https://github.com/Slamdunk/laminas-code/archive/php_80_support.zip",
"type": "zip"
}
}
}

],
"suggest": {
"laminas/laminas-captcha": "^2.9, required for using CAPTCHA form elements",
"laminas/laminas-code": "^3.4.1, required to use laminas-form annotations support",
"laminas/laminas-code": "^3.5, required to use laminas-form annotations support",
"laminas/laminas-eventmanager": "^3.3, reuired for laminas-form annotations support",
"laminas/laminas-i18n": "^2.10, required when using laminas-form view helpers",
"laminas/laminas-recaptcha": "^3.2, in order to use the ReCaptcha form element",
Expand All @@ -76,10 +62,7 @@
"autoload": {
"psr-4": {
"Laminas\\Form\\": "src/"
},
"files": [
"autoload/formElementManagerPolyfill.php"
]
}
},
"autoload-dev": {
"files": [
Expand Down
Expand Up @@ -6,10 +6,11 @@
* @license https://github.com/laminas/laminas-form/blob/master/LICENSE.md New BSD License
*/

namespace Laminas\Form\FormElementManager;
namespace Laminas\Form;

use Interop\Container\ContainerInterface;
use Laminas\Form\Element;
use Laminas\Form\Exception;
use Laminas\Form\ElementFactory;
use Laminas\Form\ElementInterface;
use Laminas\Form\Fieldset;
Expand All @@ -32,10 +33,8 @@
*
* Enforces that elements retrieved are instances of ElementInterface.
*/
class FormElementManagerV3Polyfill extends AbstractPluginManager
class FormElementManager extends AbstractPluginManager
{
use FormElementManagerTrait;

/**
* Aliases for default set of helpers
*
Expand Down Expand Up @@ -399,4 +398,62 @@ public function configure(array $config)

return $this;
}
/**
* Try to pull hydrator from the creation context, or instantiates it from its name
*
* @param string $hydratorName
* @return mixed
* @throws Exception\DomainException
*/
public function getHydratorFromName($hydratorName)
{
$services = $this->creationContext;

if ($services && $services->has('HydratorManager')) {
$hydrators = $services->get('HydratorManager');
if ($hydrators->has($hydratorName)) {
return $hydrators->get($hydratorName);
}
}

if ($services && $services->has($hydratorName)) {
return $services->get($hydratorName);
}

if (! class_exists($hydratorName)) {
throw new Exception\DomainException(sprintf(
'Expects string hydrator name to be a valid class name; received "%s"',
$hydratorName
));
}

$hydrator = new $hydratorName;
return $hydrator;
}

/**
* Try to pull factory from the creation context, or instantiates it from its name
*
* @param string $factoryName
* @return mixed
* @throws Exception\DomainException
*/
public function getFactoryFromName($factoryName)
{
$services = $this->creationContext;

if ($services && $services->has($factoryName)) {
return $services->get($factoryName);
}

if (! class_exists($factoryName)) {
throw new Exception\DomainException(sprintf(
'Expects string factory name to be a valid class name; received "%s"',
$factoryName
));
}

$factory = new $factoryName;
return $factory;
}
}
121 changes: 0 additions & 121 deletions src/FormElementManager/FormElementManagerTrait.php

This file was deleted.

0 comments on commit 337cdf6

Please sign in to comment.