Skip to content

Commit

Permalink
Fix deprecated ObjectMixin method (#326)
Browse files Browse the repository at this point in the history
* fix deprecated Nette ObjectMixin methods

* fix phpstan + indentation
  • Loading branch information
janatjak authored and enumag committed Aug 10, 2018
1 parent d81cbcb commit 95f6e35
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"kdyby/doctrine-cache": "^2.6.1",
"kdyby/strict-objects": "^1.0",
"nette/di": "^2.4@dev",
"nette/utils": "^2.4@dev",
"nette/utils": "^2.5@dev",
"nette/finder": "^2.4@dev"
},
"require-dev": {
Expand Down
7 changes: 1 addition & 6 deletions src/Kdyby/Doctrine/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ public function insert($tableExpression, array $data, array $types = [])


/**
* @param string $query
* @param array $params
* @param array $types
* @param \Doctrine\DBAL\Cache\QueryCacheProfile $qcp
* @return \Doctrine\DBAL\Driver\Statement
* @throws DBALException
* {@inheritdoc}
*/
public function executeQuery($query, array $params = [], $types = [], Doctrine\DBAL\Cache\QueryCacheProfile $qcp = NULL)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Kdyby/Doctrine/Diagnostics/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ public static function renderException($e, Nette\DI\Container $dic)

if ($invalidTable = Strings::match($e->getMessage(), '~table \'(.*?)\'~i')) {
foreach ($em->getMetadataFactory()->getAllMetadata() as $class) {
/** @var Kdyby\Doctrine\Mapping\ClassMetadata $class */
if ($class->getTableName() === $invalidTable[1]) {
if ($class instanceof Doctrine\ORM\Mapping\ClassMetadata && $class->getTableName() === $invalidTable[1]) {
$refl = $class->getReflectionClass();
break;
}
Expand Down
10 changes: 6 additions & 4 deletions src/Kdyby/Doctrine/Entities/MagicAccessors.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@

namespace Kdyby\Doctrine\Entities;

use Doctrine;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Kdyby;
use Kdyby\Doctrine\Collections\ReadOnlyCollectionWrapper;
use Kdyby\Doctrine\MemberAccessException;
use Kdyby\Doctrine\UnexpectedValueException;
use Nette;
use Nette\Utils\Callback;
use Nette\Utils\ObjectHelpers;
use Nette\Utils\ObjectMixin;


Expand Down Expand Up @@ -261,7 +260,7 @@ public function __call($name, $args)
*/
public static function __callStatic($name, $args)
{
ObjectMixin::callStatic(get_called_class(), $name, $args);
ObjectHelpers::strictStaticCall(get_called_class(), $name);
return NULL;
}

Expand Down Expand Up @@ -428,7 +427,10 @@ public function __isset($name)
*/
public function __unset($name)
{
ObjectMixin::remove($this, $name);
$class = get_class($this);
if (!ObjectHelpers::hasProperty($class, $name)) {
throw new Nette\MemberAccessException("Cannot unset the property $class::\$$name.");
}
}


Expand Down

0 comments on commit 95f6e35

Please sign in to comment.