Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

3.0.0 sql type hints #373

Open
wants to merge 49 commits into
base: 3.0.0
Choose a base branch
from

Conversation

guidofaecke
Copy link

Provide a narrative description of what you are trying to accomplish:

  • Are you fixing a bug?

    • Detail how the bug is invoked currently.
    • Detail the original, incorrect behavior.
    • Detail the new, expected behavior.
    • Base your feature on the master branch, and submit against that branch.
    • Add a regression test that demonstrates the bug, and proves the fix.
    • Add a CHANGELOG.md entry for the fix.
  • Are you creating a new feature?

    • Why is the new feature needed? What purpose does it serve?
    • How will users use the new feature?
    • Base your feature on the develop branch, and submit against that branch.
    • Add only one feature per pull request; split multiple features over multiple pull requests
    • Add tests for the new feature.
    • Add documentation for the new feature.
    • Add a CHANGELOG.md entry for the new feature.
  • Is this related to quality assurance?

  • Is this related to documentation?

guidofaecke and others added 30 commits March 14, 2019 06:45
…tain multiple spaces between the tag, type and description
@arueckauer
Copy link
Contributor

This PR provides changes described in #362

Copy link
Member

@michalbundyra michalbundyra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I haven't review the whole PR (yet), but I caught some major issues with it which are repeated in the whole PR.

The PR has also some conflicts which needs to be resolved.

.gitignore Outdated
@@ -1,3 +1,4 @@
.idea/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have any IDE/OS specific files/directories here. Please revert and add it to your global .gitignore.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

/**
* @var string
*/
/** @var string[] */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is invalid type, values are mixed, keys are sting

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to mixed[]

{
$adapterPlatform = ($adapterPlatform) ?: new DefaultAdapterPlatform;
$adapterPlatform = $adapterPlatform ?: new DefaultAdapterPlatform;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add parenthesis on class instantiation

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parenthesis added back in

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not these parentheses - on class instantiation so it should be: new DefaultAdapterPlatform()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that - I guess I am starring at the code for too long 😆

DriverInterface $driver = null,
ParameterContainer $parameterContainer = null
) {
PlatformInterface $platform,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this parameters alignment, but if we are gonna go that way here we are missing on space

'Elements returned from getExpressionData() array must be a string or array.'
);
}

// Process values and types (the middle and last position of the
// expression data)
$values = $part[1];
$types = isset($part[2]) ? $part[2] : [];
$types = isset($part[2]) ? $part[2] : [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP 7.2 - use: $part[2] ?? []

$decimal = null,
$nullable = false,
$default = null,
string $name = '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we have default value here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original Column.php setName method is a bit confusing. Not sure which way to go here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can leave the null option in the constructor as it was and handle the null parameter in the setter to ensure '' (empty string)
or
force at least an empty string in the constructor.
Any good ideas here?

* @param mixed[] $options
*/
public function __construct($name = null, $nullable = false, $default = null, array $options = [])
public function __construct(string $name = '', bool $nullable = false, ?$default = null, array $options = [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed default value for $name, I think it should be noted

* @param mixed[] $options
*/
public function __construct($name = null, $nullable = false, $default = null, array $options = [])
public function __construct(string $name = '', bool $nullable = false, ?$default = null, array $options = [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again: question mark before variable name (missing type?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below

*/
public function setDefault($default)
public function setDefault(?$default) : self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here, question mark, please check all places

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed back, but open for discussion based on the PSR-12 draft

@@ -146,10 +113,9 @@ protected function processTable(PlatformInterface $adapterPlatform = null)

/**
* @param PlatformInterface $adapterPlatform
*
* @return string[][]|null
* @return string[][]|void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are trying to avoid that, and do not mix void with the other type

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@arueckauer
Copy link
Contributor

@webimpress Thanks for the feedback. There are quite a few cs breaks which have not been introduced by this PR. Instead of the laborious manual work of comparing and fixing everything, I suggest to either update zend-coding-standard to the latest 2.0.0-alpha.3 and use it or wait for the stable release. Btw a valid coding-standard is not in the scope of this issue.

@guidofaecke
Copy link
Author

Ok folks, that's it for now.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at laminas/laminas-db#9.

@weierophinney
Copy link
Member

This repository has been moved to laminas/laminas-db. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:

  • Squash all commits in your branch (git rebase -i origin/{branch})
  • Make a note of all changed files (`git diff --name-only origin/{branch}...HEAD
  • Run the laminas/laminas-migration tool on the code.
  • Clone laminas/laminas-db to another directory.
  • Copy the files from the second bullet point to the clone of laminas/laminas-db.
  • In your clone of laminas/laminas-db, commit the files, push to your fork, and open the new PR.
    We will be providing tooling via laminas/laminas-migration soon to help automate the process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants